From: Philip Homburg Date: Fri, 10 Aug 2007 13:02:39 +0000 (+0000) Subject: cleanup X-Git-Tag: v3.1.4~331 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-coverage.html?a=commitdiff_plain;h=90fde6e97ddb180e09afcfb95b6064084e4c260e;p=minix.git cleanup --- diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 5b894ba79..4a7de7242 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -102,24 +102,12 @@ mode_t *new_modep; r = fs_sendrec(fs_e, &m); /* Copy back actual mode. */ - if (r == OK) - *new_modep = m.RES_MODE; + *new_modep = m.RES_MODE; return r; } -/* Structure for REQ_CHOWN request */ -typedef struct chown_req { - int fs_e; - ino_t inode_nr; - uid_t uid; - gid_t gid; - uid_t newuid; - gid_t newgid; -} chown_req_t; - - /*===========================================================================* * req_chown * *===========================================================================*/ @@ -471,50 +459,42 @@ mode_t dmode; } -/* Structure for REQ_MKNOD request */ -typedef struct mknod_req { - int fs_e; - ino_t inode_nr; - uid_t uid; - gid_t gid; - mode_t rmode; - dev_t dev; - char *lastc; -} mknod_req_t; - - - /*===========================================================================* - * req_newnode * + * req_mknod * *===========================================================================*/ -PUBLIC int req_newnode(fs_e, uid, gid, dmode, dev, res) +PUBLIC int req_mknod(fs_e, inode_nr, lastc, uid, gid, dmode, dev) endpoint_t fs_e; +ino_t inode_nr; +char *lastc; uid_t uid; gid_t gid; mode_t dmode; dev_t dev; -struct node_details *res; { int r; + size_t len; + cp_grant_id_t grant_id; message m; + len= strlen(lastc) + 1; + grant_id= cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); + if (gid == -1) + panic(__FILE__, "req_mknod: cpf_grant_direct failed", NO_NUM); + /* Fill in request message */ - m.m_type = REQ_NEWNODE; + m.m_type = REQ_MKNOD_S; + m.REQ_INODE_NR = inode_nr; m.REQ_MODE = dmode; m.REQ_DEVx = dev; m.REQ_UID = uid; m.REQ_GID = gid; + m.REQ_GRANT = grant_id; + m.REQ_PATH_LEN = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m); - res->fs_e = m.m_source; - res->inode_nr = m.RES_INODE_NR; - res->fmode = m.RES_MODE; - res->fsize = m.RES_FILE_SIZE; - res->dev = m.RES_DEV; - res->uid= m.RES_UID; - res->gid= m.RES_GID; + cpf_revoke(grant_id); return r; } @@ -540,46 +520,73 @@ ino_t inode_nr; /*===========================================================================* - * req_mknod * + * req_newnode * *===========================================================================*/ -PUBLIC int req_mknod(fs_e, inode_nr, lastc, uid, gid, dmode, dev) +PUBLIC int req_newnode(fs_e, uid, gid, dmode, dev, res) endpoint_t fs_e; -ino_t inode_nr; -char *lastc; uid_t uid; gid_t gid; mode_t dmode; dev_t dev; +struct node_details *res; { int r; - size_t len; - cp_grant_id_t grant_id; message m; - len= strlen(lastc) + 1; - grant_id= cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); - if (gid == -1) - panic(__FILE__, "req_mknod: cpf_grant_direct failed", NO_NUM); - /* Fill in request message */ - m.m_type = REQ_MKNOD_S; - m.REQ_INODE_NR = inode_nr; + m.m_type = REQ_NEWNODE; m.REQ_MODE = dmode; m.REQ_DEVx = dev; m.REQ_UID = uid; m.REQ_GID = gid; - m.REQ_GRANT = grant_id; - m.REQ_PATH_LEN = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m); - cpf_revoke(grant_id); + res->fs_e = m.m_source; + res->inode_nr = m.RES_INODE_NR; + res->fmode = m.RES_MODE; + res->fsize = m.RES_FILE_SIZE; + res->dev = m.RES_DEV; + res->uid= m.RES_UID; + res->gid= m.RES_GID; return r; } +/*===========================================================================* + * req_newdriver * + *===========================================================================*/ +PUBLIC int req_newdriver(fs_e, dev, driver_e) +endpoint_t fs_e; +Dev_t dev; +endpoint_t driver_e; +{ +/* Note: this is the only request function that doesn't use the + * fs_sendrec internal routine, since we want to avoid the dead + * driver recovery mechanism here. This function is actually called + * during the recovery. + */ + message m; + int r; + + /* Fill in request message */ + m.m_type = REQ_NEW_DRIVER; + m.REQ_DEV = dev; + m.REQ_DRIVER_E = driver_e; + + /* Issue request */ + if ((r = sendrec(fs_e, &m)) != OK) { + printf("VFSreq_newdriver: error sending message to %d: %d\n", fs_e, r); + return r; + } + + return OK; +} + + + /*===========================================================================* * req_putnode * *===========================================================================*/ @@ -676,19 +683,6 @@ struct node_details *res_nodep; return OK; } -/* Structure for REQ_READ and REQ_WRITE request */ -typedef struct readwrite_req { - int rw_flag; - endpoint_t fs_e; - endpoint_t user_e; - ino_t inode_nr; - unsigned short inode_index; - int seg; - u64_t pos; - unsigned int num_of_bytes; - char *user_addr; -} readwrite_req_t; - /*===========================================================================* * req_readwrite * @@ -936,16 +930,6 @@ endpoint_t fs_e; return fs_sendrec(fs_e, &m); } -/* Structure for REQ_UNLINK request */ -typedef struct unlink_req { - int fs_e; - ino_t d_inode_nr; - uid_t uid; - gid_t gid; - char *lastc; -} unlink_req_t; - - /*===========================================================================* * req_unlink * @@ -1018,38 +1002,6 @@ time_t modtime; } -/*===========================================================================* - * req_newdriver * - *===========================================================================*/ -PUBLIC int req_newdriver(fs_e, dev, driver_e) -endpoint_t fs_e; -Dev_t dev; -endpoint_t driver_e; -{ -/* Note: this is the only request function that doesn't use the - * fs_sendrec internal routine, since we want to avoid the dead - * driver recovery mechanism here. This function is actually called - * during the recovery. - */ - message m; - int r; - - /* Fill in request message */ - m.m_type = REQ_NEW_DRIVER; - m.REQ_DEV = dev; - m.REQ_DRIVER_E = driver_e; - - /* Issue request */ - if ((r = sendrec(fs_e, &m)) != OK) { - printf("VFSreq_newdriver: error sending message to %d: %d\n", fs_e, r); - return r; - } - - return OK; -} - - - /*===========================================================================* diff --git a/servers/vfs/request.h b/servers/vfs/request.h index 087b8032b..787e9c888 100644 --- a/servers/vfs/request.h +++ b/servers/vfs/request.h @@ -6,7 +6,6 @@ #include - /* Structure for response that contains inode details */ typedef struct node_details { endpoint_t fs_e; @@ -23,64 +22,6 @@ typedef struct node_details { dev_t dev; } node_details_t; - -/* Structure for REQ_OPEN request */ -typedef struct open_req { - endpoint_t fs_e; - ino_t inode_nr; - char *lastc; - int oflags; - mode_t omode; - uid_t uid; - gid_t gid; -} open_req_t; - - -/* Structure for REQ_CLONE_OPCL request */ -typedef struct clone_opcl_req { - int fs_e; - dev_t dev; -} clone_opcl_req_t; - - -/* Structure for REQ_READSUPER request */ -typedef struct readsuper_req { - endpoint_t fs_e; - time_t boottime; - endpoint_t driver_e; - dev_t dev; - char *slink_storage; - char isroot; - char readonly; -} readsuper_req_t; - -/* Structure for response of READSUPER request */ -typedef struct readsuper_res { - endpoint_t fs_e; - ino_t inode_nr; - mode_t fmode; - off_t fsize; - int blocksize; - off_t maxsize; -} readsuper_res_t; - - -/* Structure for REQ_LOOKUP request */ -typedef struct lookup_req { - /* Fields filled in by the caller */ - char *path; - char *lastc; - int flags; - /* Fields filled in by the path name traversal method */ - endpoint_t fs_e; - ino_t start_dir; - ino_t root_dir; /* process' root directory */ - uid_t uid; - gid_t gid; - unsigned char symloop; -} lookup_req_t; - - /* Structure for a lookup response */ typedef struct lookup_res { endpoint_t fs_e; diff --git a/servers/vfs/stadir.c b/servers/vfs/stadir.c index 5d0954e58..90a66e678 100644 --- a/servers/vfs/stadir.c +++ b/servers/vfs/stadir.c @@ -242,17 +242,11 @@ PUBLIC int do_fstatfs() PUBLIC int do_lstat() { /* Perform the lstat(name, buf) system call. */ - struct lookup_req lookup_req; struct vnode *vp; int r; if (fetch_name(m_in.name1, m_in.name1_length, M1) != OK) return(err_code); - /* Fill in lookup request fields */ - lookup_req.path = user_fullpath; - lookup_req.lastc = NULL; - lookup_req.flags = EAT_PATH_OPAQUE; - /* Request lookup */ if ((r = lookup_vp(PATH_RET_SYMLINK, 0 /*!use_realuid*/, &vp)) != OK) return r;