Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / fs / isofs / mount.c
blob54160b040d48ae609aa65a22506fcb47d4c1a65f
1 #include "inc.h"
2 #include <minix/vfsif.h>
4 int fs_mount(dev_t dev, unsigned int __unused flags,
5 struct fsdriver_node *root_node, unsigned int *res_flags)
7 int r;
9 fs_dev = dev;
11 /* Open the device the file system lives on in read only mode */
12 if (bdev_open(fs_dev, BDEV_R_BIT) != OK)
13 return EINVAL;
15 /* Read the superblock */
16 r = read_vds(&v_pri, fs_dev);
17 if (r != OK) {
18 bdev_close(fs_dev);
19 return r;
22 /* Return some root inode properties */
23 root_node->fn_ino_nr = v_pri.inode_root->i_stat.st_ino;
24 root_node->fn_mode = v_pri.inode_root->i_stat.st_mode;
25 root_node->fn_size = v_pri.inode_root->i_stat.st_size;
26 root_node->fn_uid = SYS_UID; /* Always root */
27 root_node->fn_gid = SYS_GID; /* wheel */
28 root_node->fn_dev = NO_DEV;
30 *res_flags = RES_NOFLAGS;
32 return r;
35 int fs_mountpt(ino_t ino_nr)
38 * This function looks up the mount point, it checks the condition
39 * whether the partition can be mounted on the inode or not.
41 struct inode *rip;
43 if ((rip = get_inode(ino_nr)) == NULL)
44 return EINVAL;
46 if (rip->i_mountpoint)
47 return EBUSY;
49 /* The inode must be a directory. */
50 if ((rip->i_stat.st_mode & I_TYPE) != I_DIRECTORY)
51 return ENOTDIR;
53 rip->i_mountpoint = TRUE;
55 return OK;
58 void fs_unmount(void)
60 release_vol_pri_desc(&v_pri); /* Release the super block */
62 bdev_close(fs_dev);
64 if (check_inodes() == FALSE)
65 puts("ISOFS: unmounting with in-use inodes!\n");