1 /* VTreeFS - mount.c - mounting and unmounting */
4 #include <minix/vfsif.h>
7 * Mount the file system. Obtain the root inode and send back its details.
10 fs_mount(dev_t __unused dev
, unsigned int flags
,
11 struct fsdriver_node
* root_node
, unsigned int * res_flags
)
15 /* VTreeFS must not be mounted as a root file system. */
16 if (flags
& REQ_ISROOT
)
19 /* Get the root inode and increase its reference count. */
20 root
= get_root_inode();
23 /* The system is now mounted. Call the initialization hook. */
24 if (vtreefs_hooks
->init_hook
!= NULL
)
25 vtreefs_hooks
->init_hook();
27 /* Return the root inode's properties. */
28 root_node
->fn_ino_nr
= get_inode_number(root
);
29 root_node
->fn_mode
= root
->i_stat
.mode
;
30 root_node
->fn_size
= root
->i_stat
.size
;
31 root_node
->fn_uid
= root
->i_stat
.uid
;
32 root_node
->fn_gid
= root
->i_stat
.gid
;
33 root_node
->fn_dev
= NO_DEV
;
35 *res_flags
= RES_NOFLAGS
;
41 * Unmount the file system.
48 /* Decrease the count of the root inode. */
49 root
= get_root_inode();
53 /* The system is unmounted. Call the cleanup hook. */
54 if (vtreefs_hooks
->cleanup_hook
!= NULL
)
55 vtreefs_hooks
->cleanup_hook();