From: Lionel Sambuc Date: Wed, 30 Apr 2014 13:33:48 +0000 (+0200) Subject: Message types for VFS link X-Git-Tag: v3.3.0~338 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mdoc.3.txt?a=commitdiff_plain;h=afcde4d2088e9e1a9bbad99d629b7716fa8a2521;p=minix.git Message types for VFS link Change-Id: Ibe03e7c9fded7f3764ecbe3e35b92df3662e54a4 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c108c0978..7450ac3f0 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -207,6 +207,17 @@ typedef struct { } mess_fs_vfs_getdents; _ASSERT_MSG_SIZE(mess_fs_vfs_getdents); +typedef struct { + ino_t inode; + ino_t dir_ino; + + cp_grant_id_t grant; + size_t path_len; + + uint8_t data[32]; +} mess_vfs_fs_link; +_ASSERT_MSG_SIZE(mess_vfs_fs_link); + typedef struct { ino_t dir_ino; ino_t root_ino; @@ -441,6 +452,7 @@ typedef struct { mess_vfs_fs_ftrunc m_vfs_fs_ftrunc; mess_vfs_fs_getdents m_vfs_fs_getdents; mess_fs_vfs_getdents m_fs_vfs_getdents; + 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_mountpoint m_vfs_fs_mountpoint; diff --git a/lib/libpuffs/link.c b/lib/libpuffs/link.c index 6ec60cb98..595cc1089 100644 --- a/lib/libpuffs/link.c +++ b/lib/libpuffs/link.c @@ -85,16 +85,16 @@ int fs_link(void) return(OK); /* Copy the link name's last component */ - len = fs_m_in.REQ_PATH_LEN; + len = fs_m_in.m_vfs_fs_link.path_len; if (len > NAME_MAX + 1) return(ENAMETOOLONG); - r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0, + r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant, 0, (vir_bytes) string, (size_t) len); if (r != OK) return(r); NUL(string, len, sizeof(string)); - if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_INODE_NR)) == NULL) + if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_link.inode)) == NULL) return(EINVAL); /* Check to see if the file has maximum number of links already. */ @@ -105,7 +105,7 @@ int fs_link(void) if ((pn->pn_va.va_mode & I_TYPE) == I_DIRECTORY && caller_uid != SU_UID) return(EPERM); - if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_DIR_INO)) == NULL) + if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_link.dir_ino)) == NULL) return(EINVAL); if (pn_dir->pn_va.va_nlink == NO_LINK) { diff --git a/servers/ext2/link.c b/servers/ext2/link.c index 51b04e98b..51371c2de 100644 --- a/servers/ext2/link.c +++ b/servers/ext2/link.c @@ -42,17 +42,17 @@ int fs_link() phys_bytes len; /* Copy the link name's last component */ - len = fs_m_in.REQ_PATH_LEN; /* including trailing '\0' */ + len = fs_m_in.m_vfs_fs_link.path_len; /* including trailing '\0' */ if (len > NAME_MAX + 1 || len > EXT2_NAME_MAX + 1) return(ENAMETOOLONG); - r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0, + r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant, 0, (vir_bytes) string, (size_t) len); if (r != OK) return r; NUL(string, len, sizeof(string)); /* Temporarily open the file. */ - if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NULL) + if( (rip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.inode)) == NULL) return(EINVAL); /* Check to see if the file has maximum number of links already. */ @@ -74,7 +74,7 @@ int fs_link() } /* Temporarily open the last dir */ - if( (ip = get_inode(fs_dev, fs_m_in.REQ_DIR_INO)) == NULL) { + if( (ip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.dir_ino)) == NULL) { put_inode(rip); return(EINVAL); } diff --git a/servers/mfs/link.c b/servers/mfs/link.c index 6d420f3c8..524196c68 100644 --- a/servers/mfs/link.c +++ b/servers/mfs/link.c @@ -39,15 +39,15 @@ int fs_link() struct inode *new_ip; phys_bytes len; - len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(string)); + len = min(fs_m_in.m_vfs_fs_link.path_len, sizeof(string)); /* Copy the link name's last component */ - r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant, (vir_bytes) 0, (vir_bytes) string, (size_t) len); if (r != OK) return r; NUL(string, len, sizeof(string)); /* Temporarily open the file. */ - if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL) + if( (rip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.inode)) == NULL) return(EINVAL); /* Check to see if the file has maximum number of links already. */ @@ -67,7 +67,7 @@ int fs_link() } /* Temporarily open the last dir */ - if( (ip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_DIR_INO)) == NULL) { + if( (ip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.dir_ino)) == NULL) { put_inode(rip); return(EINVAL); } diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 01f7819b8..99264760a 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -401,10 +401,10 @@ int req_link( /* Fill in request message */ m.m_type = REQ_LINK; - m.REQ_INODE_NR = (pino_t) linked_file; - m.REQ_DIR_INO = (pino_t) link_parent; - m.REQ_GRANT = grant_id; - m.REQ_PATH_LEN = len; + m.m_vfs_fs_link.inode = linked_file; + m.m_vfs_fs_link.dir_ino = link_parent; + m.m_vfs_fs_link.grant = grant_id; + m.m_vfs_fs_link.path_len = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m);