Message types for VFS readsuper
Change-Id: I7aea85d9842459ea454420bb1687d9b8eb597914
This commit is contained in:
parent
20211dd1b0
commit
398af818df
8 changed files with 101 additions and 72 deletions
|
@ -146,6 +146,33 @@ typedef struct {
|
||||||
} mess_sigcalls;
|
} mess_sigcalls;
|
||||||
_ASSERT_MSG_SIZE(mess_sigcalls);
|
_ASSERT_MSG_SIZE(mess_sigcalls);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
dev_t device;
|
||||||
|
|
||||||
|
uint32_t flags;
|
||||||
|
size_t path_len;
|
||||||
|
cp_grant_id_t grant;
|
||||||
|
|
||||||
|
uint8_t data[36];
|
||||||
|
} mess_vfs_fs_readsuper;
|
||||||
|
_ASSERT_MSG_SIZE(mess_vfs_fs_readsuper);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
off_t file_size;
|
||||||
|
dev_t device;
|
||||||
|
ino_t inode;
|
||||||
|
|
||||||
|
uint32_t flags;
|
||||||
|
mode_t mode;
|
||||||
|
uid_t uid;
|
||||||
|
gid_t gid;
|
||||||
|
|
||||||
|
uint16_t con_reqs;
|
||||||
|
|
||||||
|
uint8_t data[14];
|
||||||
|
} mess_fs_vfs_readsuper;
|
||||||
|
_ASSERT_MSG_SIZE(mess_fs_vfs_readsuper);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
time_t atime;
|
time_t atime;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
|
@ -215,6 +242,8 @@ typedef struct {
|
||||||
mess_mmap m_mmap;
|
mess_mmap m_mmap;
|
||||||
mess_notify m_notify;
|
mess_notify m_notify;
|
||||||
mess_sigcalls m_sigcalls;
|
mess_sigcalls m_sigcalls;
|
||||||
|
mess_vfs_fs_readsuper m_vfs_fs_readsuper;
|
||||||
|
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
||||||
mess_vfs_utimens m_vfs_utimens;
|
mess_vfs_utimens m_vfs_utimens;
|
||||||
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
||||||
mess_vmmcp m_vmmcp;
|
mess_vmmcp m_vmmcp;
|
||||||
|
|
|
@ -19,21 +19,21 @@ int fs_readsuper(void)
|
||||||
{
|
{
|
||||||
struct vattr *root_va;
|
struct vattr *root_va;
|
||||||
|
|
||||||
fs_dev = fs_m_in.REQ_DEV;
|
fs_dev = fs_m_in.m_vfs_fs_readsuper.device;
|
||||||
is_readonly_fs = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0;
|
is_readonly_fs = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0;
|
||||||
is_root_fs = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0;
|
is_root_fs = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0;
|
||||||
|
|
||||||
/* Open root pnode */
|
/* Open root pnode */
|
||||||
global_pu->pu_pn_root->pn_count = 1;
|
global_pu->pu_pn_root->pn_count = 1;
|
||||||
|
|
||||||
/* Root pnode properties */
|
/* Root pnode properties */
|
||||||
root_va = &global_pu->pu_pn_root->pn_va;
|
root_va = &global_pu->pu_pn_root->pn_va;
|
||||||
fs_m_out.RES_INODE_NR = root_va->va_fileid;
|
fs_m_out.m_fs_vfs_readsuper.inode = root_va->va_fileid;
|
||||||
fs_m_out.RES_MODE = root_va->va_mode;
|
fs_m_out.m_fs_vfs_readsuper.mode = root_va->va_mode;
|
||||||
fs_m_out.RES_FILE_SIZE = root_va->va_size;
|
fs_m_out.m_fs_vfs_readsuper.file_size = root_va->va_size;
|
||||||
fs_m_out.RES_UID = root_va->va_uid;
|
fs_m_out.m_fs_vfs_readsuper.uid = root_va->va_uid;
|
||||||
fs_m_out.RES_GID = root_va->va_gid;
|
fs_m_out.m_fs_vfs_readsuper.gid = root_va->va_gid;
|
||||||
fs_m_out.RES_FLAGS = RES_NOFLAGS;
|
fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS;
|
||||||
|
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,16 @@ int do_readsuper(void)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
dprintf(("%s: readsuper (dev %x, flags %x)\n",
|
dprintf(("%s: readsuper (dev %x, flags %x)\n",
|
||||||
sffs_name, m_in.REQ_DEV, m_in.REQ_FLAGS));
|
sffs_name, m_in.m_vfs_fs_readsuper.device, m_in.vfs_fs_readsuper.flags));
|
||||||
|
|
||||||
if (m_in.REQ_FLAGS & REQ_ISROOT) {
|
if (m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) {
|
||||||
printf("%s: attempt to mount as root device\n", sffs_name);
|
printf("%s: attempt to mount as root device\n", sffs_name);
|
||||||
|
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.s_read_only = !!(m_in.REQ_FLAGS & REQ_RDONLY);
|
state.s_read_only = !!(m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY);
|
||||||
state.s_dev = m_in.REQ_DEV;
|
state.s_dev = m_in.m_vfs_fs_readsuper.device;
|
||||||
|
|
||||||
init_dentry();
|
init_dentry();
|
||||||
ino = init_inode();
|
ino = init_inode();
|
||||||
|
@ -55,13 +55,13 @@ int do_readsuper(void)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_out.RES_INODE_NR = INODE_NR(ino);
|
m_out.m_fs_vfs_readsuper.inode = INODE_NR(ino);
|
||||||
m_out.RES_MODE = get_mode(ino, attr.a_mode);
|
m_out.m_fs_vfs_readsuper.mode = get_mode(ino, attr.a_mode);
|
||||||
m_out.RES_FILE_SIZE = attr.a_size;
|
m_out.m_fs_vfs_readsuper.file_size = attr.a_size;
|
||||||
m_out.RES_UID = sffs_params->p_uid;
|
m_out.m_fs_vfs_readsuper.uid = sffs_params->p_uid;
|
||||||
m_out.RES_GID = sffs_params->p_gid;
|
m_out.m_fs_vfs_readsuper.gid = sffs_params->p_gid;
|
||||||
m_out.RES_DEV = NO_DEV;
|
m_out.m_fs_vfs_readsuper.device = NO_DEV;
|
||||||
m_out.RES_FLAGS = RES_64BIT;
|
m_out.m_fs_vfs_readsuper.flags = RES_64BIT;
|
||||||
|
|
||||||
state.s_mounted = TRUE;
|
state.s_mounted = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ int fs_readsuper(void)
|
||||||
struct inode *root;
|
struct inode *root;
|
||||||
|
|
||||||
/* Get the device number, for stat requests. */
|
/* Get the device number, for stat requests. */
|
||||||
fs_dev = fs_m_in.REQ_DEV;
|
fs_dev = fs_m_in.m_vfs_fs_readsuper.device;
|
||||||
|
|
||||||
/* The VTreeFS must not be mounted as a root file system. */
|
/* The VTreeFS must not be mounted as a root file system. */
|
||||||
if (fs_m_in.REQ_FLAGS & REQ_ISROOT)
|
if (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
/* Get the root inode and increase its reference count. */
|
/* Get the root inode and increase its reference count. */
|
||||||
|
@ -27,13 +27,13 @@ int fs_readsuper(void)
|
||||||
vtreefs_hooks->init_hook();
|
vtreefs_hooks->init_hook();
|
||||||
|
|
||||||
/* Return the root inode's properties. */
|
/* Return the root inode's properties. */
|
||||||
fs_m_out.RES_INODE_NR = get_inode_number(root);
|
fs_m_out.m_fs_vfs_readsuper.inode = get_inode_number(root);
|
||||||
fs_m_out.RES_MODE = root->i_stat.mode;
|
fs_m_out.m_fs_vfs_readsuper.mode = root->i_stat.mode;
|
||||||
fs_m_out.RES_FILE_SIZE = root->i_stat.size;
|
fs_m_out.m_fs_vfs_readsuper.file_size = root->i_stat.size;
|
||||||
fs_m_out.RES_UID = root->i_stat.uid;
|
fs_m_out.m_fs_vfs_readsuper.uid = root->i_stat.uid;
|
||||||
fs_m_out.RES_GID = root->i_stat.gid;
|
fs_m_out.m_fs_vfs_readsuper.gid = root->i_stat.gid;
|
||||||
fs_m_out.RES_DEV = NO_DEV;
|
fs_m_out.m_fs_vfs_readsuper.device = NO_DEV;
|
||||||
fs_m_out.RES_FLAGS = RES_NOFLAGS;
|
fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS;
|
||||||
|
|
||||||
fs_mounted = TRUE;
|
fs_mounted = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,11 @@ int fs_readsuper()
|
||||||
int readonly, isroot;
|
int readonly, isroot;
|
||||||
u32_t mask;
|
u32_t mask;
|
||||||
|
|
||||||
fs_dev = fs_m_in.REQ_DEV;
|
fs_dev = fs_m_in.m_vfs_fs_readsuper.device;
|
||||||
label_gid = fs_m_in.REQ_GRANT;
|
label_gid = fs_m_in.m_vfs_fs_readsuper.grant;
|
||||||
label_len = fs_m_in.REQ_PATH_LEN;
|
label_len = fs_m_in.m_vfs_fs_readsuper.path_len;
|
||||||
readonly = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0;
|
readonly = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0;
|
||||||
isroot = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0;
|
isroot = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0;
|
||||||
|
|
||||||
if (label_len > sizeof(fs_dev_label))
|
if (label_len > sizeof(fs_dev_label))
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
@ -153,12 +153,12 @@ int fs_readsuper()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Root inode properties */
|
/* Root inode properties */
|
||||||
fs_m_out.RES_INODE_NR = root_ip->i_num;
|
fs_m_out.m_fs_vfs_readsuper.inode = root_ip->i_num;
|
||||||
fs_m_out.RES_MODE = root_ip->i_mode;
|
fs_m_out.m_fs_vfs_readsuper.mode = root_ip->i_mode;
|
||||||
fs_m_out.RES_FILE_SIZE = root_ip->i_size;
|
fs_m_out.m_fs_vfs_readsuper.file_size = root_ip->i_size;
|
||||||
fs_m_out.RES_UID = root_ip->i_uid;
|
fs_m_out.m_fs_vfs_readsuper.uid = root_ip->i_uid;
|
||||||
fs_m_out.RES_GID = root_ip->i_gid;
|
fs_m_out.m_fs_vfs_readsuper.gid = root_ip->i_gid;
|
||||||
fs_m_out.RES_FLAGS = RES_HASPEEK;
|
fs_m_out.m_fs_vfs_readsuper.flags = RES_HASPEEK;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ int fs_readsuper() {
|
||||||
size_t label_len;
|
size_t label_len;
|
||||||
int r = OK;
|
int r = OK;
|
||||||
|
|
||||||
fs_dev = fs_m_in.REQ_DEV;
|
fs_dev = fs_m_in.m_vfs_fs_readsuper.device;
|
||||||
label_gid = fs_m_in.REQ_GRANT;
|
label_gid = fs_m_in.m_vfs_fs_readsuper.grant;
|
||||||
label_len = fs_m_in.REQ_PATH_LEN;
|
label_len = fs_m_in.m_vfs_fs_readsuper.path_len;
|
||||||
|
|
||||||
if (label_len > sizeof(fs_dev_label))
|
if (label_len > sizeof(fs_dev_label))
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
@ -46,12 +46,12 @@ int fs_readsuper() {
|
||||||
lmfs_set_blocksize(v_pri.logical_block_size_l, major(fs_dev));
|
lmfs_set_blocksize(v_pri.logical_block_size_l, major(fs_dev));
|
||||||
|
|
||||||
/* Return some root inode properties */
|
/* Return some root inode properties */
|
||||||
fs_m_out.RES_INODE_NR = ID_DIR_RECORD(v_pri.dir_rec_root);
|
fs_m_out.m_fs_vfs_readsuper.inode = ID_DIR_RECORD(v_pri.dir_rec_root);
|
||||||
fs_m_out.RES_MODE = v_pri.dir_rec_root->d_mode;
|
fs_m_out.m_fs_vfs_readsuper.mode = v_pri.dir_rec_root->d_mode;
|
||||||
fs_m_out.RES_FILE_SIZE = v_pri.dir_rec_root->d_file_size;
|
fs_m_out.m_fs_vfs_readsuper.file_size = v_pri.dir_rec_root->d_file_size;
|
||||||
fs_m_out.RES_UID = SYS_UID; /* Always root */
|
fs_m_out.m_fs_vfs_readsuper.uid = SYS_UID; /* Always root */
|
||||||
fs_m_out.RES_GID = SYS_GID; /* operator */
|
fs_m_out.m_fs_vfs_readsuper.gid = SYS_GID; /* operator */
|
||||||
fs_m_out.RES_FLAGS = RES_NOFLAGS;
|
fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ int fs_readsuper()
|
||||||
int r;
|
int r;
|
||||||
int readonly, isroot;
|
int readonly, isroot;
|
||||||
|
|
||||||
fs_dev = fs_m_in.REQ_DEV;
|
fs_dev = fs_m_in.m_vfs_fs_readsuper.device;
|
||||||
label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
label_gid = fs_m_in.m_vfs_fs_readsuper.grant;
|
||||||
label_len = (size_t) fs_m_in.REQ_PATH_LEN;
|
label_len = fs_m_in.m_vfs_fs_readsuper.path_len;
|
||||||
readonly = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0;
|
readonly = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0;
|
||||||
isroot = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0;
|
isroot = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0;
|
||||||
|
|
||||||
if (label_len > sizeof(fs_dev_label))
|
if (label_len > sizeof(fs_dev_label))
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
@ -101,12 +101,12 @@ int fs_readsuper()
|
||||||
superblock.s_is_root = isroot;
|
superblock.s_is_root = isroot;
|
||||||
|
|
||||||
/* Root inode properties */
|
/* Root inode properties */
|
||||||
fs_m_out.RES_INODE_NR = root_ip->i_num;
|
fs_m_out.m_fs_vfs_readsuper.inode = root_ip->i_num;
|
||||||
fs_m_out.RES_MODE = root_ip->i_mode;
|
fs_m_out.m_fs_vfs_readsuper.mode = root_ip->i_mode;
|
||||||
fs_m_out.RES_FILE_SIZE = root_ip->i_size;
|
fs_m_out.m_fs_vfs_readsuper.file_size = root_ip->i_size;
|
||||||
fs_m_out.RES_UID = root_ip->i_uid;
|
fs_m_out.m_fs_vfs_readsuper.uid = root_ip->i_uid;
|
||||||
fs_m_out.RES_GID = root_ip->i_gid;
|
fs_m_out.m_fs_vfs_readsuper.gid = root_ip->i_gid;
|
||||||
fs_m_out.RES_FLAGS = RES_HASPEEK;
|
fs_m_out.m_fs_vfs_readsuper.flags = RES_HASPEEK;
|
||||||
|
|
||||||
/* Mark it dirty */
|
/* Mark it dirty */
|
||||||
if(!superblock.s_rd_only) {
|
if(!superblock.s_rd_only) {
|
||||||
|
|
|
@ -797,12 +797,12 @@ int req_readsuper(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_READSUPER;
|
m.m_type = REQ_READSUPER;
|
||||||
m.REQ_FLAGS = 0;
|
m.m_vfs_fs_readsuper.flags = 0;
|
||||||
if(readonly) m.REQ_FLAGS |= REQ_RDONLY;
|
if(readonly) m.m_vfs_fs_readsuper.flags |= REQ_RDONLY;
|
||||||
if(isroot) m.REQ_FLAGS |= REQ_ISROOT;
|
if(isroot) m.m_vfs_fs_readsuper.flags |= REQ_ISROOT;
|
||||||
m.REQ_GRANT = grant_id;
|
m.m_vfs_fs_readsuper.grant = grant_id;
|
||||||
m.REQ_DEV = dev;
|
m.m_vfs_fs_readsuper.device = dev;
|
||||||
m.REQ_PATH_LEN = len;
|
m.m_vfs_fs_readsuper.path_len = len;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
|
@ -811,12 +811,12 @@ int req_readsuper(
|
||||||
if(r == OK) {
|
if(r == OK) {
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
res->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
res->inode_nr = m.m_fs_vfs_readsuper.inode;
|
||||||
res->fmode = (mode_t) m.RES_MODE;
|
res->fmode = m.m_fs_vfs_readsuper.mode;
|
||||||
res->fsize = m.RES_FILE_SIZE;
|
res->fsize = m.m_fs_vfs_readsuper.file_size;
|
||||||
res->uid = (uid_t) m.RES_UID;
|
res->uid = m.m_fs_vfs_readsuper.uid;
|
||||||
res->gid = (gid_t) m.RES_GID;
|
res->gid = m.m_fs_vfs_readsuper.gid;
|
||||||
*fs_flags = m.RES_FLAGS;
|
*fs_flags = m.m_fs_vfs_readsuper.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|
Loading…
Reference in a new issue