Remove building with NOCRYPTO option
[minix3.git] / minix / lib / libvtreefs / mount.c
blobf30184bd00d38ee17e9ee68a0aa737a2887eab92
1 /* VTreeFS - mount.c - mounting and unmounting */
3 #include "inc.h"
4 #include <minix/vfsif.h>
6 /*
7 * Mount the file system. Obtain the root inode and send back its details.
8 */
9 int
10 fs_mount(dev_t __unused dev, unsigned int flags,
11 struct fsdriver_node * root_node, unsigned int * res_flags)
13 struct inode *root;
15 /* VTreeFS must not be mounted as a root file system. */
16 if (flags & REQ_ISROOT)
17 return EINVAL;
19 /* Get the root inode and increase its reference count. */
20 root = get_root_inode();
21 ref_inode(root);
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;
37 return OK;
41 * Unmount the file system.
43 void
44 fs_unmount(void)
46 struct inode *root;
48 /* Decrease the count of the root inode. */
49 root = get_root_inode();
51 put_inode(root);
53 /* The system is unmounted. Call the cleanup hook. */
54 if (vtreefs_hooks->cleanup_hook != NULL)
55 vtreefs_hooks->cleanup_hook();