minix/lib/libvtreefs/mount.c
David van Moolenbroek cc810ee4d9 VFS/FS: replace protocol version with flag field
The main motivation for this change is that only Loris supports
multithreading, and Loris supports dynamic thread allocation, so the
number of supported threads can be implemented as a bit flag (i.e.,
either 1 or "at least as many as VFS has"). The ABI break obviates the
need to support file system versioning at this time, and several
other aspects are better implemented as flags as well. Other changes:

- replace peek/bpeek test upon mount with FS flag as well;
- mark libsffs as 64-bit file size capable;
- remove old (3.2.1) getdents support.

Change-Id: I313eace9c50ed816656c31cd47d969033d952a03
2014-02-18 11:25:02 +01:00

67 lines
1.7 KiB
C

/* VTreeFS - mount.c - by Alen Stojanov and David van Moolenbroek */
#include "inc.h"
/*===========================================================================*
* fs_readsuper *
*===========================================================================*/
int fs_readsuper(void)
{
/* This function gets the root inode and sends back its details.
*/
struct inode *root;
/* Get the device number, for stat requests. */
fs_dev = fs_m_in.REQ_DEV;
/* The VTreeFS must not be mounted as a root file system. */
if (fs_m_in.REQ_FLAGS & REQ_ISROOT)
return EINVAL;
/* Get the root inode and increase its reference count. */
root = get_root_inode();
ref_inode(root);
/* The system is now mounted. Call the initialization hook. */
if (vtreefs_hooks->init_hook != NULL)
vtreefs_hooks->init_hook();
/* Return the root inode's properties. */
fs_m_out.RES_INODE_NR = get_inode_number(root);
fs_m_out.RES_MODE = root->i_stat.mode;
fs_m_out.RES_FILE_SIZE_HI = 0;
fs_m_out.RES_FILE_SIZE_LO = root->i_stat.size;
fs_m_out.RES_UID = root->i_stat.uid;
fs_m_out.RES_GID = root->i_stat.gid;
fs_m_out.RES_DEV = NO_DEV;
fs_m_out.RES_FLAGS = RES_NOFLAGS;
fs_mounted = TRUE;
return OK;
}
/*===========================================================================*
* fs_unmount *
*===========================================================================*/
int fs_unmount(void)
{
/* Unmount the file system.
*/
struct inode *root;
/* Decrease the count of the root inode. */
root = get_root_inode();
put_inode(root);
/* The system is unmounted. Call the cleanup hook. */
if (vtreefs_hooks->cleanup_hook != NULL)
vtreefs_hooks->cleanup_hook();
/* We can now be shut down safely. */
fs_mounted = FALSE;
return OK;
}