From 02dc6498da7e46e133d9da9f40041eec17fd5ff3 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 28 Apr 2014 17:45:52 +0200 Subject: [PATCH] Message types for VFS lookup Change-Id: Ic4d2a616ebc986c4b405b6b9ee0bd7c3b59e81d2 --- include/minix/ipc.h | 35 +++++++++++++++++++++++++++++ lib/libpuffs/path.c | 44 ++++++++++++++++++------------------ lib/libsffs/lookup.c | 40 ++++++++++++++++----------------- lib/libvtreefs/path.c | 48 +++++++++++++++++++++------------------- servers/ext2/path.c | 43 ++++++++++++++++++----------------- servers/iso9660fs/path.c | 35 ++++++++++++++--------------- servers/mfs/path.c | 44 ++++++++++++++++++------------------ servers/vfs/request.c | 48 ++++++++++++++++++++-------------------- 8 files changed, 186 insertions(+), 151 deletions(-) diff --git a/include/minix/ipc.h b/include/minix/ipc.h index f0989f95c..84a52817e 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -146,6 +146,39 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + ino_t dir_ino; + ino_t root_ino; + + uint32_t flags; + size_t path_len; + size_t path_size; + size_t ucred_size; + cp_grant_id_t grant_path; + cp_grant_id_t grant_ucred; + uid_t uid; + gid_t gid; + + uint8_t data[8]; +} mess_vfs_fs_lookup; +_ASSERT_MSG_SIZE(mess_vfs_fs_lookup); + +typedef struct { + off_t offset; + off_t file_size; + dev_t device; + ino_t inode; + + mode_t mode; + uid_t uid; + gid_t gid; + + uint16_t symloop; + + uint8_t data[10]; +} mess_fs_vfs_lookup; +_ASSERT_MSG_SIZE(mess_fs_vfs_lookup); + typedef struct { dev_t device; @@ -242,6 +275,8 @@ typedef struct { mess_mmap m_mmap; mess_notify m_notify; mess_sigcalls m_sigcalls; + mess_vfs_fs_lookup m_vfs_fs_lookup; + mess_fs_vfs_lookup m_fs_vfs_lookup; mess_vfs_fs_readsuper m_vfs_fs_readsuper; mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_vfs_utimens m_vfs_utimens; diff --git a/lib/libpuffs/path.c b/lib/libpuffs/path.c index 40030a6b1..be93ab235 100644 --- a/lib/libpuffs/path.c +++ b/lib/libpuffs/path.c @@ -41,15 +41,15 @@ int fs_lookup(void) int r, r1, flags, symlinks; unsigned int len; size_t offset = 0, path_size; - pino_t dir_ino, root_ino; + ino_t dir_ino, root_ino; struct puffs_node *pn; - grant = (cp_grant_id_t) fs_m_in.REQ_GRANT; - path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */ - len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */ - dir_ino = (pino_t) fs_m_in.REQ_DIR_INO; - root_ino = (pino_t) fs_m_in.REQ_ROOT_INO; - flags = (int) fs_m_in.REQ_FLAGS; + grant = fs_m_in.m_vfs_fs_lookup.grant_path; + path_size = fs_m_in.m_vfs_fs_lookup.path_size; /* Size of the buffer */ + len = fs_m_in.m_vfs_fs_lookup.path_len; /* including terminating nul */ + dir_ino = fs_m_in.m_vfs_fs_lookup.dir_ino; + root_ino = fs_m_in.m_vfs_fs_lookup.root_ino; + flags = fs_m_in.m_vfs_fs_lookup.flags; /* Check length. */ if (len > sizeof(user_path)) return(E2BIG); /* too big for buffer */ @@ -65,13 +65,13 @@ int fs_lookup(void) memset(&credentials, 0, sizeof(credentials)); if(!(flags & PATH_GET_UCRED)) { /* Do we have to copy uid/gid credentials? */ - caller_uid = (uid_t) fs_m_in.REQ_UID; - caller_gid = (gid_t) fs_m_in.REQ_GID; + caller_uid = fs_m_in.m_vfs_fs_lookup.uid; + caller_gid = fs_m_in.m_vfs_fs_lookup.gid; } else { if((r=fs_lookup_credentials(&credentials, &caller_uid, &caller_gid, - (cp_grant_id_t) fs_m_in.REQ_GRANT2, - (size_t) fs_m_in.REQ_UCRED_SIZE)) != OK) + fs_m_in.m_vfs_fs_lookup.grant_ucred, + fs_m_in.m_vfs_fs_lookup.ucred_size)) != OK) return r; } @@ -91,8 +91,8 @@ int fs_lookup(void) if (r == ELEAVEMOUNT || r == ESYMLINK) { /* Report offset and the error */ - fs_m_out.RES_OFFSET = offset; - fs_m_out.RES_SYMLOOP = symlinks; + fs_m_out.m_fs_vfs_lookup.offset = offset; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; return(r); } @@ -106,19 +106,19 @@ int fs_lookup(void) pn->pn_count++; } - fs_m_out.RES_INODE_NR = pn->pn_va.va_fileid; - fs_m_out.RES_MODE = pn->pn_va.va_mode; - fs_m_out.RES_FILE_SIZE = pn->pn_va.va_size; - fs_m_out.RES_SYMLOOP = symlinks; - fs_m_out.RES_UID = pn->pn_va.va_uid; - fs_m_out.RES_GID = pn->pn_va.va_gid; + fs_m_out.m_fs_vfs_lookup.inode = pn->pn_va.va_fileid; + fs_m_out.m_fs_vfs_lookup.mode = pn->pn_va.va_mode; + fs_m_out.m_fs_vfs_lookup.file_size = pn->pn_va.va_size; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; + fs_m_out.m_fs_vfs_lookup.uid = pn->pn_va.va_uid; + fs_m_out.m_fs_vfs_lookup.gid = pn->pn_va.va_gid; /* This is only valid for block and character specials. But it doesn't - * cause any harm to set RES_DEV always. */ - fs_m_out.RES_DEV = pn->pn_va.va_rdev; + * cause any harm to always set the device field. */ + fs_m_out.m_fs_vfs_lookup.device = pn->pn_va.va_rdev; if (r == EENTERMOUNT) { - fs_m_out.RES_OFFSET = offset; + fs_m_out.m_fs_vfs_lookup.offset = offset; } return(r); diff --git a/lib/libsffs/lookup.c b/lib/libsffs/lookup.c index 9c27436db..ca484649b 100644 --- a/lib/libsffs/lookup.c +++ b/lib/libsffs/lookup.c @@ -203,7 +203,7 @@ int do_lookup(void) { /* Resolve a path string to an inode. */ - pino_t dir_ino_nr, root_ino_nr; + ino_t dir_ino_nr, root_ino_nr; struct inode *cur_ino, *root_ino; struct inode *next_ino = NULL; struct sffs_attr attr; @@ -211,19 +211,19 @@ int do_lookup(void) char name[NAME_MAX+1]; char *ptr, *last; vfs_ucred_t ucred; - pmode_t mask; + mode_t mask; size_t len; int r; - dir_ino_nr = m_in.REQ_DIR_INO; - root_ino_nr = m_in.REQ_ROOT_INO; - len = m_in.REQ_PATH_LEN; + dir_ino_nr = m_in.m_vfs_fs_lookup.dir_ino; + root_ino_nr = m_in.m_vfs_fs_lookup.root_ino; + len = m_in.m_vfs_fs_lookup.path_len; /* Fetch the path name. */ if (len < 1 || len > PATH_MAX) return EINVAL; - r = sys_safecopyfrom(m_in.m_source, m_in.REQ_GRANT, 0, + r = sys_safecopyfrom(m_in.m_source, m_in.m_vfs_fs_lookup.grant_path, 0, (vir_bytes) buf, len); if (r != OK) @@ -238,22 +238,22 @@ int do_lookup(void) /* Fetch the credentials, and generate a search access mask to test against * directory modes. */ - if (m_in.REQ_FLAGS & PATH_GET_UCRED) { - if (m_in.REQ_UCRED_SIZE != sizeof(ucred)) { + if (m_in.m_vfs_fs_lookup.flags & PATH_GET_UCRED) { + if (m_in.m_vfs_fs_lookup.ucred_size != sizeof(ucred)) { printf("%s: bad credential structure size\n", sffs_name); return EINVAL; } - r = sys_safecopyfrom(m_in.m_source, m_in.REQ_GRANT2, 0, - (vir_bytes) &ucred, m_in.REQ_UCRED_SIZE); + r = sys_safecopyfrom(m_in.m_source, m_in.m_vfs_fs_lookup.grant_ucred, 0, + (vir_bytes) &ucred, m_in.m_vfs_fs_lookup.ucred_size); if (r != OK) return r; } else { - ucred.vu_uid = m_in.REQ_UID; - ucred.vu_gid = m_in.REQ_GID; + ucred.vu_uid = m_in.m_vfs_fs_lookup.uid; + ucred.vu_gid = m_in.m_vfs_fs_lookup.gid; ucred.vu_ngroups = 0; } @@ -322,19 +322,19 @@ int do_lookup(void) assert(r != EENTERMOUNT && r != ESYMLINK); if (r == ELEAVEMOUNT) { - m_out.RES_OFFSET = (int) (last - buf); - m_out.RES_SYMLOOP = 0; + m_out.m_fs_vfs_lookup.offset = (last - buf); + m_out.m_fs_vfs_lookup.symloop = 0; } return r; } - m_out.RES_INODE_NR = INODE_NR(cur_ino); - m_out.RES_MODE = get_mode(cur_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.m_fs_vfs_lookup.inode = INODE_NR(cur_ino); + m_out.m_fs_vfs_lookup.mode = get_mode(cur_ino, attr.a_mode); + m_out.m_fs_vfs_lookup.file_size = attr.a_size; + m_out.m_fs_vfs_lookup.uid = sffs_params->p_uid; + m_out.m_fs_vfs_lookup.gid = sffs_params->p_gid; + m_out.m_fs_vfs_lookup.device = NO_DEV; return OK; } diff --git a/lib/libvtreefs/path.c b/lib/libvtreefs/path.c index 9360ed78d..18bf37260 100644 --- a/lib/libvtreefs/path.c +++ b/lib/libvtreefs/path.c @@ -149,7 +149,7 @@ int fs_lookup(void) { /* Resolve a path string to an inode. */ - pino_t dir_ino_nr, root_ino_nr; + ino_t dir_ino_nr, root_ino_nr; struct inode *cur_ino, *next_ino, *root_ino; char path[PATH_MAX], name[PNAME_MAX+1]; char *ptr, *last; @@ -157,33 +157,35 @@ int fs_lookup(void) size_t len; int r, r2, symloop; - dir_ino_nr = fs_m_in.REQ_DIR_INO; - root_ino_nr = fs_m_in.REQ_ROOT_INO; - len = fs_m_in.REQ_PATH_LEN; + dir_ino_nr = fs_m_in.m_vfs_fs_lookup.dir_ino; + root_ino_nr = fs_m_in.m_vfs_fs_lookup.root_ino; + len = fs_m_in.m_vfs_fs_lookup.path_len; /* Fetch the path name. */ if (len < 1 || len > PATH_MAX) return EINVAL; - r = sys_safecopyfrom(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, - (vir_bytes) path, (phys_bytes) len); + r = sys_safecopyfrom(fs_m_in.m_source, + fs_m_in.m_vfs_fs_lookup.grant_path, 0, (vir_bytes) path, + (phys_bytes) len); if (r != OK) return r; if (path[len-1] != 0) return EINVAL; /* Fetch the caller's credentials. */ - if (fs_m_in.REQ_FLAGS & PATH_GET_UCRED) { - assert(fs_m_in.REQ_UCRED_SIZE == sizeof(ucred)); + if (fs_m_in.m_vfs_fs_lookup.flags & PATH_GET_UCRED) { + assert(fs_m_in.m_vfs_fs_lookup.ucred_size == sizeof(ucred)); - r = sys_safecopyfrom(fs_m_in.m_source, fs_m_in.REQ_GRANT2, 0, - (vir_bytes) &ucred, fs_m_in.REQ_UCRED_SIZE); + r = sys_safecopyfrom(fs_m_in.m_source, + fs_m_in.m_vfs_fs_lookup.grant_ucred, 0, + (vir_bytes) &ucred, fs_m_in.m_vfs_fs_lookup.ucred_size); if (r != OK) return r; } else { - ucred.vu_uid = fs_m_in.REQ_UID; - ucred.vu_gid = fs_m_in.REQ_GID; + ucred.vu_uid = fs_m_in.m_vfs_fs_lookup.uid; + ucred.vu_gid = fs_m_in.m_vfs_fs_lookup.gid; ucred.vu_ngroups = 0; } @@ -228,7 +230,7 @@ int fs_lookup(void) /* Perform symlink resolution if we have to. */ if (r == OK && S_ISLNK(next_ino->i_stat.mode) && (ptr[0] != '\0' || - !(fs_m_in.REQ_FLAGS & PATH_RET_SYMLINK))) { + !(fs_m_in.m_vfs_fs_lookup.flags & PATH_RET_SYMLINK))) { if (++symloop == _POSIX_SYMLOOP_MAX) { put_inode(next_ino); @@ -285,28 +287,28 @@ int fs_lookup(void) /* Copy back the path if we resolved at least one symlink. */ if (symloop > 0 && (r == ELEAVEMOUNT || r == ESYMLINK)) { r2 = sys_safecopyto(fs_m_in.m_source, - fs_m_in.REQ_GRANT, 0, (vir_bytes) path, - strlen(path) + 1); + fs_m_in.m_vfs_fs_lookup.grant_path, 0, + (vir_bytes) path, strlen(path) + 1); if (r2 != OK) r = r2; } if (r == ELEAVEMOUNT || r == ESYMLINK) { - fs_m_out.RES_OFFSET = (int) (last - path); - fs_m_out.RES_SYMLOOP = symloop; + fs_m_out.m_fs_vfs_lookup.offset = (int) (last - path); + fs_m_out.m_fs_vfs_lookup.symloop = symloop; } return r; } /* On success, leave the resulting file open and return its details. */ - fs_m_out.RES_INODE_NR = get_inode_number(cur_ino); - fs_m_out.RES_MODE = cur_ino->i_stat.mode; - fs_m_out.RES_FILE_SIZE = cur_ino->i_stat.size; - fs_m_out.RES_UID = cur_ino->i_stat.uid; - fs_m_out.RES_GID = cur_ino->i_stat.gid; - fs_m_out.RES_DEV = cur_ino->i_stat.dev; + fs_m_out.m_fs_vfs_lookup.inode = get_inode_number(cur_ino); + fs_m_out.m_fs_vfs_lookup.mode = cur_ino->i_stat.mode; + fs_m_out.m_fs_vfs_lookup.file_size = cur_ino->i_stat.size; + fs_m_out.m_fs_vfs_lookup.uid = cur_ino->i_stat.uid; + fs_m_out.m_fs_vfs_lookup.gid = cur_ino->i_stat.gid; + fs_m_out.m_fs_vfs_lookup.device = cur_ino->i_stat.dev; return OK; } diff --git a/servers/ext2/path.c b/servers/ext2/path.c index 82c467e79..444094f5f 100644 --- a/servers/ext2/path.c +++ b/servers/ext2/path.c @@ -44,12 +44,12 @@ int fs_lookup() pino_t dir_ino, root_ino; struct inode *rip; - grant = (cp_grant_id_t) fs_m_in.REQ_GRANT; - path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */ - len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */ - dir_ino = (pino_t) fs_m_in.REQ_DIR_INO; - root_ino = (pino_t) fs_m_in.REQ_ROOT_INO; - flags = (int) fs_m_in.REQ_FLAGS; + grant = fs_m_in.m_vfs_fs_lookup.grant_path; + path_size = fs_m_in.m_vfs_fs_lookup.path_size; /* Size of the buffer */ + len = fs_m_in.m_vfs_fs_lookup.path_len; /* including terminating nul */ + dir_ino = fs_m_in.m_vfs_fs_lookup.dir_ino; + root_ino = fs_m_in.m_vfs_fs_lookup.root_ino; + flags = fs_m_in.m_vfs_fs_lookup.flags; /* Check length. */ if(len > sizeof(user_path)) return(E2BIG); /* too big for buffer */ @@ -65,13 +65,12 @@ int fs_lookup() memset(&credentials, 0, sizeof(credentials)); if(!(flags & PATH_GET_UCRED)) { /* Do we have to copy uid/gid credentials? */ - caller_uid = (uid_t) fs_m_in.REQ_UID; - caller_gid = (gid_t) fs_m_in.REQ_GID; + caller_uid = fs_m_in.m_vfs_fs_lookup.uid; + caller_gid = fs_m_in.m_vfs_fs_lookup.gid; } else { if((r=fs_lookup_credentials(&credentials, - &caller_uid, &caller_gid, - (cp_grant_id_t) fs_m_in.REQ_GRANT2, - (size_t) fs_m_in.REQ_UCRED_SIZE)) != OK) + &caller_uid, &caller_gid, fs_m_in.m_vfs_fs_lookup.grant_ucred, + fs_m_in.m_vfs_fs_lookup.ucred_size)) != OK) return r; } @@ -90,27 +89,27 @@ int fs_lookup() if(r == ELEAVEMOUNT || r == ESYMLINK) { /* Report offset and the error */ - fs_m_out.RES_OFFSET = offset; - fs_m_out.RES_SYMLOOP = symlinks; + fs_m_out.m_fs_vfs_lookup.offset = offset; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; return(r); } if (r != OK && r != EENTERMOUNT) return(r); - fs_m_out.RES_INODE_NR = rip->i_num; - fs_m_out.RES_MODE = rip->i_mode; - fs_m_out.RES_FILE_SIZE = rip->i_size; - fs_m_out.RES_SYMLOOP = symlinks; - fs_m_out.RES_UID = rip->i_uid; - fs_m_out.RES_GID = rip->i_gid; + fs_m_out.m_fs_vfs_lookup.inode = rip->i_num; + fs_m_out.m_fs_vfs_lookup.mode = rip->i_mode; + fs_m_out.m_fs_vfs_lookup.file_size = rip->i_size; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; + fs_m_out.m_fs_vfs_lookup.uid = rip->i_uid; + fs_m_out.m_fs_vfs_lookup.gid = rip->i_gid; /* This is only valid for block and character specials. But it doesn't - * cause any harm to set RES_DEV always. */ - fs_m_out.RES_DEV = (dev_t) rip->i_block[0]; + * cause any harm to always set the device field. */ + fs_m_out.m_fs_vfs_lookup.device = (dev_t) rip->i_block[0]; if(r == EENTERMOUNT) { - fs_m_out.RES_OFFSET = offset; + fs_m_out.m_fs_vfs_lookup.offset = offset; put_inode(rip); /* Only return a reference to the final object */ } diff --git a/servers/iso9660fs/path.c b/servers/iso9660fs/path.c index 8ccc78c72..fd7a5daf5 100644 --- a/servers/iso9660fs/path.c +++ b/servers/iso9660fs/path.c @@ -17,16 +17,16 @@ int fs_lookup() { cp_grant_id_t grant; int r, len, flags; size_t offset; - pino_t dir_ino, root_ino; + ino_t dir_ino, root_ino; struct dir_record *dir; - grant = fs_m_in.REQ_GRANT; - len = fs_m_in.REQ_PATH_LEN; /* including terminating nul */ - dir_ino = (pino_t) fs_m_in.REQ_DIR_INO; - root_ino = (pino_t) fs_m_in.REQ_ROOT_INO; - flags = fs_m_in.REQ_FLAGS; - caller_uid = (uid_t) fs_m_in.REQ_UID; - caller_gid = (gid_t) fs_m_in.REQ_GID; + grant = fs_m_in.m_vfs_fs_lookup.grant_path; + len = fs_m_in.m_vfs_fs_lookup.path_len; /* including terminating nul */ + dir_ino = fs_m_in.m_vfs_fs_lookup.dir_ino; + root_ino = fs_m_in.m_vfs_fs_lookup.root_ino; + flags = fs_m_in.m_vfs_fs_lookup.flags; + caller_uid = fs_m_in.m_vfs_fs_lookup.uid; + caller_gid = fs_m_in.m_vfs_fs_lookup.gid; /* Check length. */ if(len > sizeof(user_path)) return(E2BIG); /* too big for buffer */ @@ -51,23 +51,22 @@ int fs_lookup() { if (r == ELEAVEMOUNT) { /* Report offset and the error */ - fs_m_out.RES_OFFSET = offset; - fs_m_out.RES_SYMLOOP = 0; + fs_m_out.m_fs_vfs_lookup.offset = offset; + fs_m_out.m_fs_vfs_lookup.symloop = 0; return(r); } if (r != OK && r != EENTERMOUNT) return(r); - fs_m_out.RES_INODE_NR = ID_DIR_RECORD(dir); - fs_m_out.RES_MODE = dir->d_mode; - fs_m_out.RES_FILE_SIZE = dir->d_file_size; - fs_m_out.RES_SYMLOOP = 0; - fs_m_out.RES_UID = SYS_UID; /* root */ - fs_m_out.RES_GID = SYS_GID; /* operator */ - + fs_m_out.m_fs_vfs_lookup.inode = ID_DIR_RECORD(dir); + fs_m_out.m_fs_vfs_lookup.mode = dir->d_mode; + fs_m_out.m_fs_vfs_lookup.file_size = dir->d_file_size; + fs_m_out.m_fs_vfs_lookup.symloop = 0; + fs_m_out.m_fs_vfs_lookup.uid = SYS_UID; /* root */ + fs_m_out.m_fs_vfs_lookup.gid = SYS_GID; /* operator */ if (r == EENTERMOUNT) { - fs_m_out.RES_OFFSET = offset; + fs_m_out.m_fs_vfs_lookup.offset = offset; release_dir_record(dir); } diff --git a/servers/mfs/path.c b/servers/mfs/path.c index 7c69f2a26..33e687d29 100644 --- a/servers/mfs/path.c +++ b/servers/mfs/path.c @@ -40,15 +40,15 @@ int fs_lookup() int r, r1, flags, symlinks; unsigned int len; size_t offset = 0, path_size; - pino_t dir_ino, root_ino; + ino_t dir_ino, root_ino; struct inode *rip; - grant = (cp_grant_id_t) fs_m_in.REQ_GRANT; - path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */ - len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */ - dir_ino = (pino_t) fs_m_in.REQ_DIR_INO; - root_ino = (pino_t) fs_m_in.REQ_ROOT_INO; - flags = (int) fs_m_in.REQ_FLAGS; + grant = fs_m_in.m_vfs_fs_lookup.grant_path; + path_size = fs_m_in.m_vfs_fs_lookup.path_size; /* Size of the buffer */ + len = fs_m_in.m_vfs_fs_lookup.path_len; /* including terminating nul */ + dir_ino = fs_m_in.m_vfs_fs_lookup.dir_ino; + root_ino = fs_m_in.m_vfs_fs_lookup.root_ino; + flags = fs_m_in.m_vfs_fs_lookup.flags; /* Check length. */ if(len > sizeof(user_path)) return(E2BIG); /* too big for buffer */ @@ -64,13 +64,13 @@ int fs_lookup() memset(&credentials, 0, sizeof(credentials)); if(!(flags & PATH_GET_UCRED)) { /* Do we have to copy uid/gid credentials? */ - caller_uid = (uid_t) fs_m_in.REQ_UID; - caller_gid = (gid_t) fs_m_in.REQ_GID; + caller_uid = fs_m_in.m_vfs_fs_lookup.uid; + caller_gid = fs_m_in.m_vfs_fs_lookup.gid; } else { if((r=fs_lookup_credentials(&credentials, &caller_uid, &caller_gid, - (cp_grant_id_t) fs_m_in.REQ_GRANT2, - (size_t) fs_m_in.REQ_UCRED_SIZE)) != OK) + fs_m_in.m_vfs_fs_lookup.grant_ucred, + fs_m_in.m_vfs_fs_lookup.ucred_size)) != OK) return r; } @@ -89,27 +89,27 @@ int fs_lookup() if(r == ELEAVEMOUNT || r == ESYMLINK) { /* Report offset and the error */ - fs_m_out.RES_OFFSET = offset; - fs_m_out.RES_SYMLOOP = symlinks; + fs_m_out.m_fs_vfs_lookup.offset = offset; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; return(r); } if (r != OK && r != EENTERMOUNT) return(r); - fs_m_out.RES_INODE_NR = rip->i_num; - fs_m_out.RES_MODE = rip->i_mode; - fs_m_out.RES_FILE_SIZE = rip->i_size; - fs_m_out.RES_SYMLOOP = symlinks; - fs_m_out.RES_UID = rip->i_uid; - fs_m_out.RES_GID = rip->i_gid; + fs_m_out.m_fs_vfs_lookup.inode = rip->i_num; + fs_m_out.m_fs_vfs_lookup.mode = rip->i_mode; + fs_m_out.m_fs_vfs_lookup.file_size = rip->i_size; + fs_m_out.m_fs_vfs_lookup.symloop = symlinks; + fs_m_out.m_fs_vfs_lookup.uid = rip->i_uid; + fs_m_out.m_fs_vfs_lookup.gid = rip->i_gid; /* This is only valid for block and character specials. But it doesn't - * cause any harm to set RES_DEV always. */ - fs_m_out.RES_DEV = (dev_t) rip->i_zone[0]; + * cause any harm to always set the device field. */ + fs_m_out.m_fs_vfs_lookup.device = (dev_t) rip->i_zone[0]; if(r == EENTERMOUNT) { - fs_m_out.RES_OFFSET = offset; + fs_m_out.m_fs_vfs_lookup.offset = offset; put_inode(rip); /* Only return a reference to the final object */ } diff --git a/servers/vfs/request.c b/servers/vfs/request.c index a94f304c6..6cd1d714c 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -445,12 +445,12 @@ int req_lookup( flags = resolve->l_flags; len = strlen(resolve->l_path) + 1; - m.m_type = REQ_LOOKUP; - m.REQ_GRANT = grant_id; - m.REQ_PATH_LEN = len; - m.REQ_PATH_SIZE = PATH_MAX + 1; - m.REQ_DIR_INO = (pino_t) dir_ino; - m.REQ_ROOT_INO = (pino_t) root_ino; + m.m_type = REQ_LOOKUP; + m.m_vfs_fs_lookup.grant_path = grant_id; + m.m_vfs_fs_lookup.path_len = len; + m.m_vfs_fs_lookup.path_size = PATH_MAX + 1; + m.m_vfs_fs_lookup.dir_ino = dir_ino; + m.m_vfs_fs_lookup.root_ino = root_ino; if(rfp->fp_ngroups > 0) { /* Is the process member of multiple groups? */ /* In that case the FS has to copy the uid/gid credentials */ @@ -468,17 +468,17 @@ int req_lookup( if(grant_id2 == -1) panic("req_lookup: cpf_grant_direct failed"); - m.REQ_GRANT2 = grant_id2; - m.REQ_UCRED_SIZE= sizeof(credentials); + m.m_vfs_fs_lookup.grant_ucred = grant_id2; + m.m_vfs_fs_lookup.ucred_size = sizeof(credentials); flags |= PATH_GET_UCRED; } else { /* When there's only one gid, we can send it directly */ - m.REQ_UID = (pgid_t) uid; - m.REQ_GID = (pgid_t) gid; + m.m_vfs_fs_lookup.uid = uid; + m.m_vfs_fs_lookup.gid = gid; flags &= ~PATH_GET_UCRED; } - m.REQ_FLAGS = flags; + m.m_vfs_fs_lookup.flags = flags; /* Send/rec request */ r = fs_sendrec(fs_e, &m); @@ -490,25 +490,25 @@ int req_lookup( switch (r) { case OK: - res->inode_nr = (ino_t) m.RES_INODE_NR; - res->fmode = (mode_t) m.RES_MODE; - res->fsize = m.RES_FILE_SIZE; - res->dev = m.RES_DEV; - res->uid = (uid_t) m.RES_UID; - res->gid = (gid_t) m.RES_GID; + res->inode_nr = m.m_fs_vfs_lookup.inode; + res->fmode = m.m_fs_vfs_lookup.mode; + res->fsize = m.m_fs_vfs_lookup.file_size; + res->dev = m.m_fs_vfs_lookup.device; + res->uid = m.m_fs_vfs_lookup.uid; + res->gid = m.m_fs_vfs_lookup.gid; break; case EENTERMOUNT: - res->inode_nr = (ino_t) m.RES_INODE_NR; - res->char_processed = m.RES_OFFSET; - res->symloop = m.RES_SYMLOOP; + res->inode_nr = m.m_fs_vfs_lookup.inode; + res->char_processed = m.m_fs_vfs_lookup.offset; + res->symloop = m.m_fs_vfs_lookup.symloop; break; case ELEAVEMOUNT: - res->char_processed = m.RES_OFFSET; - res->symloop = m.RES_SYMLOOP; + res->char_processed = m.m_fs_vfs_lookup.offset; + res->symloop = m.m_fs_vfs_lookup.symloop; break; case ESYMLINK: - res->char_processed = m.RES_OFFSET; - res->symloop = m.RES_SYMLOOP; + res->char_processed = m.m_fs_vfs_lookup.offset; + res->symloop = m.m_fs_vfs_lookup.symloop; break; default: break;