1 /* Created (MFS based):
2 * June 2011 (Evgeniy Ivanov)
7 #include <minix/vfsif.h>
9 /*===========================================================================*
11 *===========================================================================*/
12 int fs_mount(dev_t __unused dev
, unsigned int flags
,
13 struct fsdriver_node
*root_node
, unsigned int *res_flags
)
15 struct vattr
*root_va
;
17 is_readonly_fs
= !!(flags
& REQ_RDONLY
);
20 global_pu
->pu_pn_root
->pn_count
= 1;
22 /* Root pnode properties */
23 root_va
= &global_pu
->pu_pn_root
->pn_va
;
24 root_node
->fn_ino_nr
= root_va
->va_fileid
;
25 root_node
->fn_mode
= root_va
->va_mode
;
26 root_node
->fn_size
= root_va
->va_size
;
27 root_node
->fn_uid
= root_va
->va_uid
;
28 root_node
->fn_gid
= root_va
->va_gid
;
29 root_node
->fn_dev
= NO_DEV
;
31 *res_flags
= RES_NOFLAGS
;
39 /*===========================================================================*
41 *===========================================================================*/
42 int fs_mountpt(ino_t ino_nr
)
44 /* This function looks up the mount point, it checks the condition whether
45 * the partition can be mounted on the pnode or not.
48 struct puffs_node
*pn
;
51 if ((pn
= puffs_pn_nodewalk(global_pu
, find_inode_cb
, &ino_nr
)) == NULL
)
54 if (pn
->pn_mountpoint
) r
= EBUSY
;
56 /* It may not be special. */
57 bits
= pn
->pn_va
.va_mode
& I_TYPE
;
58 if(bits
== I_BLOCK_SPECIAL
|| bits
== I_CHAR_SPECIAL
) r
= ENOTDIR
;
61 pn
->pn_mountpoint
= TRUE
;
67 /*===========================================================================*
69 *===========================================================================*/
74 /* Always force unmounting, as VFS will not tolerate failure. */
75 error
= global_pu
->pu_ops
.puffs_fs_unmount(global_pu
, MNT_FORCE
);
77 lpuffs_debug("user handler failed to unmount filesystem!\
83 /* Finish off the unmount. */
84 PU_SETSTATE(global_pu
, PUFFS_STATE_UNMOUNTED
);
86 global_pu
->pu_pn_root
->pn_count
--;