From: Lionel Sambuc Date: Mon, 28 Apr 2014 14:45:11 +0000 (+0200) Subject: Message types for VFS readsuper X-Git-Tag: v3.3.0~351 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=398af818dfe46a01a45f7a57d8db177da93e53b5;p=minix.git Message types for VFS readsuper Change-Id: I7aea85d9842459ea454420bb1687d9b8eb597914 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index a7aca06f1..f0989f95c 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -146,6 +146,33 @@ typedef struct { } 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 { time_t atime; time_t mtime; @@ -215,6 +242,8 @@ typedef struct { mess_mmap m_mmap; mess_notify m_notify; 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_vm_vfs_mmap m_vm_vfs_mmap; mess_vmmcp m_vmmcp; diff --git a/lib/libpuffs/mount.c b/lib/libpuffs/mount.c index 7b7da1cff..8707d7de5 100644 --- a/lib/libpuffs/mount.c +++ b/lib/libpuffs/mount.c @@ -19,21 +19,21 @@ int fs_readsuper(void) { struct vattr *root_va; - fs_dev = fs_m_in.REQ_DEV; - is_readonly_fs = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0; - is_root_fs = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0; + fs_dev = fs_m_in.m_vfs_fs_readsuper.device; + is_readonly_fs = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0; + is_root_fs = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0; /* Open root pnode */ global_pu->pu_pn_root->pn_count = 1; /* Root pnode properties */ root_va = &global_pu->pu_pn_root->pn_va; - fs_m_out.RES_INODE_NR = root_va->va_fileid; - fs_m_out.RES_MODE = root_va->va_mode; - fs_m_out.RES_FILE_SIZE = root_va->va_size; - fs_m_out.RES_UID = root_va->va_uid; - fs_m_out.RES_GID = root_va->va_gid; - fs_m_out.RES_FLAGS = RES_NOFLAGS; + fs_m_out.m_fs_vfs_readsuper.inode = root_va->va_fileid; + fs_m_out.m_fs_vfs_readsuper.mode = root_va->va_mode; + fs_m_out.m_fs_vfs_readsuper.file_size = root_va->va_size; + fs_m_out.m_fs_vfs_readsuper.uid = root_va->va_uid; + fs_m_out.m_fs_vfs_readsuper.gid = root_va->va_gid; + fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS; return(OK); } diff --git a/lib/libsffs/mount.c b/lib/libsffs/mount.c index 0d3c15afa..f4cfc2b75 100644 --- a/lib/libsffs/mount.c +++ b/lib/libsffs/mount.c @@ -23,16 +23,16 @@ int do_readsuper(void) int r; 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); return EINVAL; } - state.s_read_only = !!(m_in.REQ_FLAGS & REQ_RDONLY); - state.s_dev = m_in.REQ_DEV; + state.s_read_only = !!(m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY); + state.s_dev = m_in.m_vfs_fs_readsuper.device; init_dentry(); ino = init_inode(); @@ -55,13 +55,13 @@ int do_readsuper(void) return r; } - m_out.RES_INODE_NR = INODE_NR(ino); - m_out.RES_MODE = get_mode(ino, attr.a_mode); - m_out.RES_FILE_SIZE = attr.a_size; - m_out.RES_UID = sffs_params->p_uid; - m_out.RES_GID = sffs_params->p_gid; - m_out.RES_DEV = NO_DEV; - m_out.RES_FLAGS = RES_64BIT; + m_out.m_fs_vfs_readsuper.inode = INODE_NR(ino); + m_out.m_fs_vfs_readsuper.mode = get_mode(ino, attr.a_mode); + m_out.m_fs_vfs_readsuper.file_size = attr.a_size; + m_out.m_fs_vfs_readsuper.uid = sffs_params->p_uid; + m_out.m_fs_vfs_readsuper.gid = sffs_params->p_gid; + m_out.m_fs_vfs_readsuper.device = NO_DEV; + m_out.m_fs_vfs_readsuper.flags = RES_64BIT; state.s_mounted = TRUE; diff --git a/lib/libvtreefs/mount.c b/lib/libvtreefs/mount.c index f961e5e7d..ee18941f0 100644 --- a/lib/libvtreefs/mount.c +++ b/lib/libvtreefs/mount.c @@ -12,10 +12,10 @@ int fs_readsuper(void) struct inode *root; /* 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. */ - if (fs_m_in.REQ_FLAGS & REQ_ISROOT) + if (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) return EINVAL; /* Get the root inode and increase its reference count. */ @@ -27,13 +27,13 @@ int fs_readsuper(void) 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 = 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_m_out.m_fs_vfs_readsuper.inode = get_inode_number(root); + fs_m_out.m_fs_vfs_readsuper.mode = root->i_stat.mode; + fs_m_out.m_fs_vfs_readsuper.file_size = root->i_stat.size; + fs_m_out.m_fs_vfs_readsuper.uid = root->i_stat.uid; + fs_m_out.m_fs_vfs_readsuper.gid = root->i_stat.gid; + fs_m_out.m_fs_vfs_readsuper.device = NO_DEV; + fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS; fs_mounted = TRUE; diff --git a/servers/ext2/mount.c b/servers/ext2/mount.c index f9c13827f..da8cd1994 100644 --- a/servers/ext2/mount.c +++ b/servers/ext2/mount.c @@ -33,11 +33,11 @@ int fs_readsuper() int readonly, isroot; u32_t mask; - fs_dev = fs_m_in.REQ_DEV; - label_gid = fs_m_in.REQ_GRANT; - label_len = fs_m_in.REQ_PATH_LEN; - readonly = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0; - isroot = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0; + fs_dev = fs_m_in.m_vfs_fs_readsuper.device; + label_gid = fs_m_in.m_vfs_fs_readsuper.grant; + label_len = fs_m_in.m_vfs_fs_readsuper.path_len; + readonly = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0; + isroot = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0; if (label_len > sizeof(fs_dev_label)) return(EINVAL); @@ -153,12 +153,12 @@ int fs_readsuper() } /* Root inode properties */ - fs_m_out.RES_INODE_NR = root_ip->i_num; - fs_m_out.RES_MODE = root_ip->i_mode; - fs_m_out.RES_FILE_SIZE = root_ip->i_size; - fs_m_out.RES_UID = root_ip->i_uid; - fs_m_out.RES_GID = root_ip->i_gid; - fs_m_out.RES_FLAGS = RES_HASPEEK; + fs_m_out.m_fs_vfs_readsuper.inode = root_ip->i_num; + fs_m_out.m_fs_vfs_readsuper.mode = root_ip->i_mode; + fs_m_out.m_fs_vfs_readsuper.file_size = root_ip->i_size; + fs_m_out.m_fs_vfs_readsuper.uid = root_ip->i_uid; + fs_m_out.m_fs_vfs_readsuper.gid = root_ip->i_gid; + fs_m_out.m_fs_vfs_readsuper.flags = RES_HASPEEK; return(r); } diff --git a/servers/iso9660fs/mount.c b/servers/iso9660fs/mount.c index 0de63297b..579db2d6d 100644 --- a/servers/iso9660fs/mount.c +++ b/servers/iso9660fs/mount.c @@ -14,9 +14,9 @@ int fs_readsuper() { size_t label_len; int r = OK; - fs_dev = fs_m_in.REQ_DEV; - label_gid = fs_m_in.REQ_GRANT; - label_len = fs_m_in.REQ_PATH_LEN; + fs_dev = fs_m_in.m_vfs_fs_readsuper.device; + label_gid = fs_m_in.m_vfs_fs_readsuper.grant; + label_len = fs_m_in.m_vfs_fs_readsuper.path_len; if (label_len > sizeof(fs_dev_label)) return(EINVAL); @@ -46,12 +46,12 @@ int fs_readsuper() { lmfs_set_blocksize(v_pri.logical_block_size_l, major(fs_dev)); /* Return some root inode properties */ - fs_m_out.RES_INODE_NR = ID_DIR_RECORD(v_pri.dir_rec_root); - fs_m_out.RES_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.RES_UID = SYS_UID; /* Always root */ - fs_m_out.RES_GID = SYS_GID; /* operator */ - fs_m_out.RES_FLAGS = RES_NOFLAGS; + fs_m_out.m_fs_vfs_readsuper.inode = ID_DIR_RECORD(v_pri.dir_rec_root); + fs_m_out.m_fs_vfs_readsuper.mode = v_pri.dir_rec_root->d_mode; + fs_m_out.m_fs_vfs_readsuper.file_size = v_pri.dir_rec_root->d_file_size; + fs_m_out.m_fs_vfs_readsuper.uid = SYS_UID; /* Always root */ + fs_m_out.m_fs_vfs_readsuper.gid = SYS_GID; /* operator */ + fs_m_out.m_fs_vfs_readsuper.flags = RES_NOFLAGS; return(r); } diff --git a/servers/mfs/mount.c b/servers/mfs/mount.c index 14f7aac94..902da7e5d 100644 --- a/servers/mfs/mount.c +++ b/servers/mfs/mount.c @@ -24,11 +24,11 @@ int fs_readsuper() int r; int readonly, isroot; - fs_dev = fs_m_in.REQ_DEV; - label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - label_len = (size_t) fs_m_in.REQ_PATH_LEN; - readonly = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0; - isroot = (fs_m_in.REQ_FLAGS & REQ_ISROOT) ? 1 : 0; + fs_dev = fs_m_in.m_vfs_fs_readsuper.device; + label_gid = fs_m_in.m_vfs_fs_readsuper.grant; + label_len = fs_m_in.m_vfs_fs_readsuper.path_len; + readonly = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_RDONLY) ? 1 : 0; + isroot = (fs_m_in.m_vfs_fs_readsuper.flags & REQ_ISROOT) ? 1 : 0; if (label_len > sizeof(fs_dev_label)) return(EINVAL); @@ -101,12 +101,12 @@ int fs_readsuper() superblock.s_is_root = isroot; /* Root inode properties */ - fs_m_out.RES_INODE_NR = root_ip->i_num; - fs_m_out.RES_MODE = root_ip->i_mode; - fs_m_out.RES_FILE_SIZE = root_ip->i_size; - fs_m_out.RES_UID = root_ip->i_uid; - fs_m_out.RES_GID = root_ip->i_gid; - fs_m_out.RES_FLAGS = RES_HASPEEK; + fs_m_out.m_fs_vfs_readsuper.inode = root_ip->i_num; + fs_m_out.m_fs_vfs_readsuper.mode = root_ip->i_mode; + fs_m_out.m_fs_vfs_readsuper.file_size = root_ip->i_size; + fs_m_out.m_fs_vfs_readsuper.uid = root_ip->i_uid; + fs_m_out.m_fs_vfs_readsuper.gid = root_ip->i_gid; + fs_m_out.m_fs_vfs_readsuper.flags = RES_HASPEEK; /* Mark it dirty */ if(!superblock.s_rd_only) { diff --git a/servers/vfs/request.c b/servers/vfs/request.c index a68d2eea9..a94f304c6 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -797,12 +797,12 @@ int req_readsuper( /* Fill in request message */ m.m_type = REQ_READSUPER; - m.REQ_FLAGS = 0; - if(readonly) m.REQ_FLAGS |= REQ_RDONLY; - if(isroot) m.REQ_FLAGS |= REQ_ISROOT; - m.REQ_GRANT = grant_id; - m.REQ_DEV = dev; - m.REQ_PATH_LEN = len; + m.m_vfs_fs_readsuper.flags = 0; + if(readonly) m.m_vfs_fs_readsuper.flags |= REQ_RDONLY; + if(isroot) m.m_vfs_fs_readsuper.flags |= REQ_ISROOT; + m.m_vfs_fs_readsuper.grant = grant_id; + m.m_vfs_fs_readsuper.device = dev; + m.m_vfs_fs_readsuper.path_len = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m); @@ -811,12 +811,12 @@ int req_readsuper( if(r == OK) { /* Fill in response structure */ res->fs_e = m.m_source; - res->inode_nr = (ino_t) m.RES_INODE_NR; - res->fmode = (mode_t) m.RES_MODE; - res->fsize = m.RES_FILE_SIZE; - res->uid = (uid_t) m.RES_UID; - res->gid = (gid_t) m.RES_GID; - *fs_flags = m.RES_FLAGS; + res->inode_nr = m.m_fs_vfs_readsuper.inode; + res->fmode = m.m_fs_vfs_readsuper.mode; + res->fsize = m.m_fs_vfs_readsuper.file_size; + res->uid = m.m_fs_vfs_readsuper.uid; + res->gid = m.m_fs_vfs_readsuper.gid; + *fs_flags = m.m_fs_vfs_readsuper.flags; } return(r);