2 #include <minix/vfsif.h>
3 #include <minix/bdev.h>
8 /*===========================================================================*
10 *===========================================================================*/
13 cp_grant_id_t label_gid
;
17 fs_dev
= fs_m_in
.m_vfs_fs_readsuper
.device
;
18 label_gid
= fs_m_in
.m_vfs_fs_readsuper
.grant
;
19 label_len
= fs_m_in
.m_vfs_fs_readsuper
.path_len
;
21 if (label_len
> sizeof(fs_dev_label
))
24 r
= sys_safecopyfrom(fs_m_in
.m_source
, label_gid
, 0, (vir_bytes
)fs_dev_label
,
27 printf("ISOFS %s:%d safecopyfrom failed: %d\n", __FILE__
, __LINE__
, r
);
31 /* Map the driver label for this major */
32 bdev_driver(fs_dev
, fs_dev_label
);
34 /* Open the device the file system lives on in read only mode */
35 if (bdev_open(fs_dev
, BDEV_R_BIT
) != OK
) {
39 /* Read the superblock */
40 r
= read_vds(&v_pri
, fs_dev
);
46 lmfs_set_blocksize(v_pri
.logical_block_size_l
, major(fs_dev
));
48 /* Return some root inode properties */
49 fs_m_out
.m_fs_vfs_readsuper
.inode
= ID_DIR_RECORD(v_pri
.dir_rec_root
);
50 fs_m_out
.m_fs_vfs_readsuper
.mode
= v_pri
.dir_rec_root
->d_mode
;
51 fs_m_out
.m_fs_vfs_readsuper
.file_size
= v_pri
.dir_rec_root
->d_file_size
;
52 fs_m_out
.m_fs_vfs_readsuper
.uid
= SYS_UID
; /* Always root */
53 fs_m_out
.m_fs_vfs_readsuper
.gid
= SYS_GID
; /* operator */
54 fs_m_out
.m_fs_vfs_readsuper
.flags
= RES_NOFLAGS
;
60 /*===========================================================================*
62 *===========================================================================*/
65 /* This function looks up the mount point, it checks the condition whether
66 * the partition can be mounted on the inode or not.
69 register struct dir_record
*rip
;
72 /* Temporarily open the file. */
73 if ((rip
= get_dir_record(fs_m_in
.m_vfs_fs_mountpoint
.inode
)) == NULL
)
76 if (rip
->d_mountpoint
)
79 /* If the inode is not a dir returns error */
80 if ((rip
->d_mode
& I_TYPE
) != I_DIRECTORY
)
83 release_dir_record(rip
);
86 rip
->d_mountpoint
= TRUE
;
92 /*===========================================================================*
94 *===========================================================================*/
95 int fs_unmount(void) {
96 release_v_pri(&v_pri
); /* Release the super block */