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