1 /* Created (MFS based):
2 * June 2011 (Evgeniy Ivanov)
11 #include <minix/vfsif.h>
13 #include "puffs_priv.h"
15 /*===========================================================================*
17 *===========================================================================*/
20 struct vattr
*root_va
;
22 fs_dev
= fs_m_in
.REQ_DEV
;
23 is_readonly_fs
= (fs_m_in
.REQ_FLAGS
& REQ_RDONLY
) ? 1 : 0;
24 is_root_fs
= (fs_m_in
.REQ_FLAGS
& REQ_ISROOT
) ? 1 : 0;
27 global_pu
->pu_pn_root
->pn_count
= 1;
29 /* Root pnode properties */
30 root_va
= &global_pu
->pu_pn_root
->pn_va
;
31 fs_m_out
.RES_INODE_NR
= root_va
->va_fileid
;
32 fs_m_out
.RES_MODE
= root_va
->va_mode
;
33 fs_m_out
.RES_FILE_SIZE_LO
= root_va
->va_size
;
34 fs_m_out
.RES_UID
= root_va
->va_uid
;
35 fs_m_out
.RES_GID
= root_va
->va_gid
;
36 fs_m_out
.RES_CONREQS
= 1;
42 /*===========================================================================*
44 *===========================================================================*/
47 /* This function looks up the mount point, it checks the condition whether
48 * the partition can be mounted on the pnode or not.
51 struct puffs_node
*pn
;
55 * XXX: we assume that lookup was done first, so pnode can be found with
58 if ((pn
= puffs_pn_nodewalk(global_pu
, 0, &fs_m_in
.REQ_INODE_NR
)) == NULL
)
62 if (pn
->pn_mountpoint
) r
= EBUSY
;
64 /* It may not be special. */
65 bits
= pn
->pn_va
.va_mode
& I_TYPE
;
66 if(bits
== I_BLOCK_SPECIAL
|| bits
== I_CHAR_SPECIAL
) r
= ENOTDIR
;
69 pn
->pn_mountpoint
= TRUE
;
75 /*===========================================================================*
77 *===========================================================================*/
82 /* XXX there is no information about flags, 0 should be safe enough */
83 error
= global_pu
->pu_ops
.puffs_fs_unmount(global_pu
, 0);
85 /* XXX we can't return any error to VFS */
86 lpuffs_debug("user handler failed to unmount filesystem!\
92 /* Finish off the unmount. */
93 PU_SETSTATE(global_pu
, PUFFS_STATE_UNMOUNTED
);
95 global_pu
->pu_pn_root
->pn_count
--;