From: Lionel Sambuc Date: Wed, 30 Apr 2014 17:44:48 +0000 (+0200) Subject: Message types for VFS mkdir X-Git-Tag: v3.3.0~333 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mdoc.3.txt?a=commitdiff_plain;h=2dc27154adc483cbf3614c9e8f0642fad485bb97;p=minix.git Message types for VFS mkdir Change-Id: I05ea5b5e14e28afdfab6edcabc1dc761389f2638 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 609525f05..8555f149a 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -258,6 +258,19 @@ typedef struct { } mess_fs_vfs_lookup; _ASSERT_MSG_SIZE(mess_fs_vfs_lookup); +typedef struct { + ino_t inode; + + mode_t mode; + uid_t uid; + gid_t gid; + cp_grant_id_t grant; + size_t path_len; + + uint8_t data[28]; +} mess_vfs_fs_mkdir; +_ASSERT_MSG_SIZE(mess_vfs_fs_mkdir); + typedef struct { ino_t inode; @@ -490,6 +503,7 @@ typedef struct { mess_vfs_fs_link m_vfs_fs_link; 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_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 5406fe838..2ea5ee56f 100644 --- a/lib/libpuffs/open.c +++ b/lib/libpuffs/open.c @@ -216,22 +216,22 @@ int fs_mkdir(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_mkdir.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_mkdir.grant, (vir_bytes) 0, (vir_bytes) pcn.pcn_name, (phys_bytes) 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_mkdir.uid; + caller_gid = fs_m_in.m_vfs_fs_mkdir.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_mkdir.inode)) == NULL) return(ENOENT); cur_time = clock_timespec(); @@ -241,7 +241,7 @@ int fs_mkdir(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_mkdir.mode; va.va_uid = caller_uid; va.va_gid = caller_gid; va.va_atime = va.va_mtime = va.va_ctime = cur_time; diff --git a/lib/libsffs/link.c b/lib/libsffs/link.c index d5d63b32f..11d89accd 100644 --- a/lib/libsffs/link.c +++ b/lib/libsffs/link.c @@ -140,19 +140,19 @@ int do_mkdir(void) return EROFS; /* Get the path string and possibly an inode for the given path. */ - if ((r = get_name(m_in.REQ_GRANT, m_in.REQ_PATH_LEN, name)) != OK) + if ((r = get_name(m_in.m_vfs_fs_mkdir.grant, m_in.m_vfs_fs_mkdir.path_len, name)) != OK) return r; if (!strcmp(name, ".") || !strcmp(name, "..")) return EEXIST; - if ((parent = find_inode(m_in.REQ_INODE_NR)) == NULL) + if ((parent = find_inode(m_in.m_vfs_fs_mkdir.inode)) == NULL) return EINVAL; if ((r = verify_dentry(parent, name, path, &ino)) != OK) return r; /* Perform the actual mkdir call. */ - r = sffs_table->t_mkdir(path, m_in.REQ_MODE); + r = sffs_table->t_mkdir(path, m_in.m_vfs_fs_mkdir.mode); if (r != OK) { if (ino != NULL) diff --git a/servers/ext2/open.c b/servers/ext2/open.c index 2435f5355..01f942ca8 100644 --- a/servers/ext2/open.c +++ b/servers/ext2/open.c @@ -124,24 +124,24 @@ int fs_mkdir() 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_mkdir.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_mkdir.grant, (vir_bytes) 0, (vir_bytes) lastc, (phys_bytes) 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_mkdir.uid; + caller_gid = fs_m_in.m_vfs_fs_mkdir.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_mkdir.inode)) == NULL) return(ENOENT); /* Next make the inode. If that fails, return error code. */ - rip = new_node(ldirp, lastc, (pino_t) fs_m_in.REQ_MODE, (block_t) 0); + rip = new_node(ldirp, lastc, fs_m_in.m_vfs_fs_mkdir.mode, (block_t) 0); if(rip == NULL || err_code == EEXIST) { put_inode(rip); /* can't make dir: it already exists */ @@ -155,7 +155,7 @@ int fs_mkdir() /* Now make dir entries for . and .. unless the disk is completely full. */ /* Use dot1 and dot2, so the mode of the directory isn't important. */ - rip->i_mode = (pmode_t) fs_m_in.REQ_MODE; /* set mode */ + rip->i_mode = fs_m_in.m_vfs_fs_mkdir.mode; /* set mode */ /* enter . in the new dir*/ r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM, I_DIRECTORY); /* enter .. in the new dir */ diff --git a/servers/mfs/open.c b/servers/mfs/open.c index 3f780cf48..70fc05d30 100644 --- a/servers/mfs/open.c +++ b/servers/mfs/open.c @@ -112,21 +112,21 @@ int fs_mkdir() 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_mkdir.path_len, sizeof(lastc)); + err_code = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_mkdir.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_mkdir.uid; + caller_gid = fs_m_in.m_vfs_fs_mkdir.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_mkdir.inode)) == NULL) return(ENOENT); /* Next make the inode. If that fails, return error code. */ - rip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE, (zone_t) 0); + rip = new_node(ldirp, lastc, fs_m_in.m_vfs_fs_mkdir.mode, (zone_t) 0); if(rip == NULL || err_code == EEXIST) { put_inode(rip); /* can't make dir: it already exists */ @@ -140,7 +140,7 @@ int fs_mkdir() /* Now make dir entries for . and .. unless the disk is completely full. */ /* Use dot1 and dot2, so the mode of the directory isn't important. */ - rip->i_mode = (pmode_t) fs_m_in.REQ_MODE; /* set mode */ + rip->i_mode = fs_m_in.m_vfs_fs_mkdir.mode; /* set mode */ r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM);/* enter . in the new dir*/ r2 = search_dir(rip, dot2, &dotdot, ENTER, IGN_PERM); /* enter .. in the new dir */ diff --git a/servers/vfs/request.c b/servers/vfs/request.c index b209e2f52..0a6c97af9 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -542,12 +542,12 @@ int req_mkdir( /* Fill in request message */ m.m_type = REQ_MKDIR; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_MODE = (pmode_t) dmode; - 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_mkdir.inode = inode_nr; + m.m_vfs_fs_mkdir.mode = dmode; + m.m_vfs_fs_mkdir.uid = uid; + m.m_vfs_fs_mkdir.gid = gid; + m.m_vfs_fs_mkdir.grant = grant_id; + m.m_vfs_fs_mkdir.path_len = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m);