1 /* Created (MFS based):
2 * June 2011 (Evgeniy Ivanov)
11 #include <minix/vfsif.h>
13 #include "puffs_priv.h"
15 /*===========================================================================*
17 *===========================================================================*/
18 int fs_readsuper(void)
20 struct vattr
*root_va
;
22 fs_dev
= fs_m_in
.m_vfs_fs_readsuper
.device
;
23 is_readonly_fs
= (fs_m_in
.m_vfs_fs_readsuper
.flags
& REQ_RDONLY
) ? 1 : 0;
24 is_root_fs
= (fs_m_in
.m_vfs_fs_readsuper
.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
.m_fs_vfs_readsuper
.inode
= root_va
->va_fileid
;
32 fs_m_out
.m_fs_vfs_readsuper
.mode
= root_va
->va_mode
;
33 fs_m_out
.m_fs_vfs_readsuper
.file_size
= root_va
->va_size
;
34 fs_m_out
.m_fs_vfs_readsuper
.uid
= root_va
->va_uid
;
35 fs_m_out
.m_fs_vfs_readsuper
.gid
= root_va
->va_gid
;
36 fs_m_out
.m_fs_vfs_readsuper
.flags
= RES_NOFLAGS
;
42 /*===========================================================================*
44 *===========================================================================*/
45 int fs_mountpoint(void)
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
.m_vfs_fs_mountpoint
.inode
))
63 if (pn
->pn_mountpoint
) r
= EBUSY
;
65 /* It may not be special. */
66 bits
= pn
->pn_va
.va_mode
& I_TYPE
;
67 if(bits
== I_BLOCK_SPECIAL
|| bits
== I_CHAR_SPECIAL
) r
= ENOTDIR
;
70 pn
->pn_mountpoint
= TRUE
;
76 /*===========================================================================*
78 *===========================================================================*/
83 /* XXX there is no information about flags, 0 should be safe enough */
84 error
= global_pu
->pu_ops
.puffs_fs_unmount(global_pu
, 0);
86 /* XXX we can't return any error to VFS */
87 lpuffs_debug("user handler failed to unmount filesystem!\
93 /* Finish off the unmount. */
94 PU_SETSTATE(global_pu
, PUFFS_STATE_UNMOUNTED
);
96 global_pu
->pu_pn_root
->pn_count
--;