libfsdriver: prefill st_dev for stat requests

This obviates the need for several file system implementations to
remember the device on which they are mounted.

Change-Id: Ida8325cf4bcf072e61761cfee34e3f7ed2d750b9
This commit is contained in:
David van Moolenbroek
2014-11-14 15:52:22 +00:00
parent 31b6611abf
commit 289b04677a
18 changed files with 26 additions and 46 deletions

View File

@@ -25,8 +25,6 @@ EXTERN int err_code; /* temporary storage for error number */
EXTERN struct puffs_kcred global_kcred;
EXTERN dev_t fs_dev; /* The device that is handled by this FS proc
*/
EXTERN char fs_name[PATH_MAX+1];
EXTERN int mounted;

View File

@@ -52,8 +52,8 @@ int fs_putnode(ino_t ino_nr, unsigned int count)
}
if (pn == NULL) {
lpuffs_debug("%s:%d putnode: pnode #%"PRIu64" dev: %"PRIu64
" not found\n", __FILE__, __LINE__, ino_nr, fs_dev);
lpuffs_debug("%s:%d putnode: pnode #%"PRIu64" not found\n",
__FILE__, __LINE__, ino_nr);
panic("fs_putnode failed");
}

View File

@@ -12,12 +12,11 @@
/*===========================================================================*
* fs_mount *
*===========================================================================*/
int fs_mount(dev_t dev, unsigned int flags, struct fsdriver_node *root_node,
unsigned int *res_flags)
int fs_mount(dev_t __unused dev, unsigned int flags,
struct fsdriver_node *root_node, unsigned int *res_flags)
{
struct vattr *root_va;
fs_dev = dev;
is_readonly_fs = !!(flags & REQ_RDONLY);
/* Open root pnode */

View File

@@ -45,7 +45,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf)
/* true iff special */
s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL);
statbuf->st_dev = fs_dev;
statbuf->st_ino = va.va_fileid;
statbuf->st_mode = va.va_mode;
statbuf->st_nlink = va.va_nlink;