From: Lionel Sambuc Date: Wed, 30 Apr 2014 18:00:29 +0000 (+0200) Subject: Message types for VFS mknod X-Git-Tag: v3.3.0~332 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doxygen.png?a=commitdiff_plain;h=f90ed467fc51ead100fd870d88e9b2f1de0d1f7a;p=minix.git Message types for VFS mknod Change-Id: I41772ffe0efc520b3cd204857c33c8c76d81a5a8 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 8555f149a..8c6c93291 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -271,6 +271,20 @@ typedef struct { } mess_vfs_fs_mkdir; _ASSERT_MSG_SIZE(mess_vfs_fs_mkdir); +typedef struct { + dev_t device; + ino_t inode; + + mode_t mode; + uid_t uid; + gid_t gid; + cp_grant_id_t grant; + size_t path_len; + + uint8_t data[20]; +} mess_vfs_fs_mknod; +_ASSERT_MSG_SIZE(mess_vfs_fs_mknod); + typedef struct { ino_t inode; @@ -504,6 +518,7 @@ typedef struct { mess_vfs_fs_lookup m_vfs_fs_lookup; mess_fs_vfs_lookup m_fs_vfs_lookup; mess_vfs_fs_mkdir m_vfs_fs_mkdir; + mess_vfs_fs_mknod m_vfs_fs_mknod; mess_vfs_fs_mountpoint m_vfs_fs_mountpoint; mess_vfs_fs_new_driver m_vfs_fs_new_driver; mess_vfs_fs_putnode m_vfs_fs_putnode; diff --git a/lib/libpuffs/open.c b/lib/libpuffs/open.c index 2ea5ee56f..e516dfcb7 100644 --- a/lib/libpuffs/open.c +++ b/lib/libpuffs/open.c @@ -133,22 +133,22 @@ int fs_mknod(void) } /* Copy the last component and set up caller's user and group id */ - len = fs_m_in.REQ_PATH_LEN; + len = fs_m_in.m_vfs_fs_mknod.path_len; pcn.pcn_namelen = len - 1; if (pcn.pcn_namelen > NAME_MAX) return(ENAMETOOLONG); - err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + err_code = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_mknod.grant, (vir_bytes) 0, (vir_bytes) pcn.pcn_name, (size_t) len); if (err_code != OK) return(err_code); NUL(pcn.pcn_name, len, sizeof(pcn.pcn_name)); - 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_mknod.uid; + caller_gid = fs_m_in.m_vfs_fs_mknod.gid; /* Get last directory pnode */ - if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_INODE_NR)) == NULL) + if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_mknod.inode)) == NULL) return(ENOENT); memset(&pni, 0, sizeof(pni)); @@ -158,10 +158,10 @@ int fs_mknod(void) memset(&va, 0, sizeof(va)); va.va_type = VDIR; - va.va_mode = (mode_t) fs_m_in.REQ_MODE; + va.va_mode = fs_m_in.m_vfs_fs_mknod.mode; va.va_uid = caller_uid; va.va_gid = caller_gid; - va.va_rdev = fs_m_in.REQ_DEV; + va.va_rdev = fs_m_in.m_vfs_fs_mknod.device; va.va_atime = va.va_mtime = va.va_ctime = cur_time; if (buildpath) { diff --git a/servers/ext2/open.c b/servers/ext2/open.c index 01f942ca8..6597eddb6 100644 --- a/servers/ext2/open.c +++ b/servers/ext2/open.c @@ -86,25 +86,25 @@ int fs_mknod() phys_bytes len; /* Copy the last component and set up caller's user and group id */ - len = fs_m_in.REQ_PATH_LEN; /* including trailing '\0' */ + len = fs_m_in.m_vfs_fs_mknod.path_len; /* including trailing '\0' */ if (len > NAME_MAX + 1 || len > EXT2_NAME_MAX + 1) return(ENAMETOOLONG); - err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + err_code = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_mknod.grant, (vir_bytes) 0, (vir_bytes) lastc, (size_t) len); if (err_code != OK) return err_code; NUL(lastc, len, sizeof(lastc)); - 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_mknod.uid; + caller_gid = fs_m_in.m_vfs_fs_mknod.gid; /* Get last directory inode */ - if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL) + if((ldirp = get_inode(fs_dev, fs_m_in.m_vfs_fs_mknod.inode)) == NULL) return(ENOENT); /* Try to create the new node */ - ip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE, - (block_t) fs_m_in.REQ_DEV); + ip = new_node(ldirp, lastc, fs_m_in.m_vfs_fs_mknod.mode, + (block_t) fs_m_in.m_vfs_fs_mknod.device); put_inode(ip); put_inode(ldirp); diff --git a/servers/mfs/open.c b/servers/mfs/open.c index 70fc05d30..0af6366d0 100644 --- a/servers/mfs/open.c +++ b/servers/mfs/open.c @@ -77,22 +77,22 @@ int fs_mknod() phys_bytes len; /* Copy the last component and set up caller's user and group id */ - len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(lastc)); - err_code = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + len = min(fs_m_in.m_vfs_fs_mknod.path_len, sizeof(lastc)); + err_code = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_mknod.grant, (vir_bytes) 0, (vir_bytes) lastc, (size_t) len); if (err_code != OK) return err_code; NUL(lastc, len, sizeof(lastc)); - 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_mknod.uid; + caller_gid = fs_m_in.m_vfs_fs_mknod.gid; /* Get last directory inode */ - if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL) + if((ldirp = get_inode(fs_dev, fs_m_in.m_vfs_fs_mknod.inode)) == NULL) return(ENOENT); /* Try to create the new node */ - ip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE, - (zone_t) fs_m_in.REQ_DEV); + ip = new_node(ldirp, lastc, fs_m_in.m_vfs_fs_mknod.mode, + (zone_t) fs_m_in.m_vfs_fs_mknod.device); put_inode(ip); put_inode(ldirp); diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 0a6c97af9..f2b350304 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -582,13 +582,13 @@ int req_mknod( /* Fill in request message */ m.m_type = REQ_MKNOD; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_MODE = (pmode_t) dmode; - m.REQ_DEV = dev; - m.REQ_UID = (puid_t) uid; - m.REQ_GID = (pgid_t) gid; - m.REQ_GRANT = grant_id; - m.REQ_PATH_LEN = len; + m.m_vfs_fs_mknod.inode = inode_nr; + m.m_vfs_fs_mknod.mode = dmode; + m.m_vfs_fs_mknod.device = dev; + m.m_vfs_fs_mknod.uid = uid; + m.m_vfs_fs_mknod.gid = gid; + m.m_vfs_fs_mknod.grant = grant_id; + m.m_vfs_fs_mknod.path_len = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m);