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;
}
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");
}
/*===========================================================================*
* 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 */
/* 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;
/* Update library-local state. */
fsdriver_mounted = TRUE;
+ fsdriver_device = dev;
fsdriver_root = root_node.fn_ino_nr;
}
return ENOSYS;
memset(&buf, 0, sizeof(buf));
+ buf.st_dev = fsdriver_device;
if ((r = fdp->fdr_stat(ino_nr, &buf)) == OK)
r = sys_safecopyto(m_in->m_source, grant, 0, (vir_bytes)&buf,
#include "fsdriver.h"
/* Library-local variables. */
+dev_t fsdriver_device;
ino_t fsdriver_root;
int fsdriver_mounted = FALSE;
extern int fsdriver_getname(endpoint_t endpt, cp_grant_id_t grant, size_t len,
char *name, size_t size, int not_empty);
+extern dev_t fsdriver_device;
extern ino_t fsdriver_root;
extern int fsdriver_mounted;
extern int (*fsdriver_callvec[])(const struct fsdriver * __restrict,
EXTERN const struct sffs_table *sffs_table; /* call table */
EXTERN struct sffs_params *sffs_params; /* parameters */
-EXTERN struct state state; /* global state */
+EXTERN int read_only; /* mounted read-only? */
extern struct fsdriver sffs_dtable; /* driver table */
r = sffs_table->t_opendir(path, &ino->i_dir);
}
else {
- if (!state.s_read_only)
+ if (!read_only)
r = sffs_table->t_open(path, O_RDWR, 0, &ino->i_file);
/* Protection or mount status might prevent us from writing. With the
* information that we have available, this is the best we can do..
*/
- if (state.s_read_only || r != OK)
+ if (read_only || r != OK)
r = sffs_table->t_open(path, O_RDONLY, 0, &ino->i_file);
}
#define dprintf(x)
#endif
-#include "type.h"
#include "const.h"
#include "proto.h"
#include "glo.h"
int r;
/* We cannot create files on a read-only file system. */
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((parent = find_inode(dir_nr)) == NULL)
int r;
/* We cannot create directories on a read-only file system. */
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((parent = find_inode(dir_nr)) == NULL)
int r;
/* We cannot delete files on a read-only file system. */
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((parent = find_inode(dir_nr)) == NULL)
int r;
/* We cannot remove directories on a read-only file system. */
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((parent = find_inode(dir_nr)) == NULL)
int r;
/* We cannot do rename on a read-only file system. */
- if (state.s_read_only)
+ if (read_only)
return EROFS;
/* Get possibly preexisting inodes for the old and new paths. */
/*===========================================================================*
* do_mount *
*===========================================================================*/
-int do_mount(dev_t dev, unsigned int flags, struct fsdriver_node *root_node,
- unsigned int *res_flags)
+int do_mount(dev_t __unused dev, unsigned int flags,
+ struct fsdriver_node *root_node, unsigned int *res_flags)
{
/* Mount the file system.
*/
return EINVAL;
}
- state.s_read_only = !!(flags & REQ_RDONLY);
- state.s_dev = dev;
+ read_only = !!(flags & REQ_RDONLY);
init_dentry();
ino = init_inode();
else
mode = S_IFREG | (mode & sffs_params->p_file_mask);
- if (state.s_read_only)
+ if (read_only)
mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
return mode;
if ((r = verify_inode(ino, path, &attr)) != OK)
return r;
- stat->st_dev = state.s_dev;
stat->st_ino = ino_nr;
stat->st_mode = get_mode(ino, attr.a_mode);
stat->st_uid = sffs_params->p_uid;
struct sffs_attr attr;
int r;
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((ino = find_inode(ino_nr)) == NULL)
struct sffs_attr attr;
int r;
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((ino = find_inode(ino_nr)) == NULL)
+++ /dev/null
-#ifndef _SFFS_TYPE_H
-#define _SFFS_TYPE_H
-
-/* Structure with global file system state. */
-struct state {
- int s_read_only; /* is the file system mounted read-only? note,
- * has no relation to the shared folder mode */
- dev_t s_dev; /* device the file system is mounted on */
-};
-
-#endif /* _SFFS_TYPE_H */
*/
struct inode *ino;
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((ino = find_inode(ino_nr)) == NULL)
uint64_t delta;
ssize_t r;
- if (state.s_read_only)
+ if (read_only)
return EROFS;
if ((ino = find_inode(ino_nr)) == NULL)
EXTERN struct fs_hooks *vtreefs_hooks;
-EXTERN dev_t fs_dev;
-
extern struct fsdriver vtreefs_table;
#endif /* _VTREEFS_GLO_H */
* Mount the file system. Obtain the root inode and send back its details.
*/
int
-fs_mount(dev_t dev, unsigned int flags, struct fsdriver_node * root_node,
- unsigned int * res_flags)
+fs_mount(dev_t __unused dev, unsigned int flags,
+ struct fsdriver_node * root_node, unsigned int * res_flags)
{
struct inode *root;
- /* Get the device number, for stat requests. */
- fs_dev = dev;
-
/* VTreeFS must not be mounted as a root file system. */
if (flags & REQ_ISROOT)
return EINVAL;
return EINVAL;
/* Fill in the basic info. */
- buf->st_dev = fs_dev;
buf->st_ino = get_inode_number(node);
buf->st_mode = node->i_stat.mode;
buf->st_nlink = !is_inode_deleted(node);