From: Lionel Sambuc Date: Wed, 30 Apr 2014 08:20:16 +0000 (+0200) Subject: Message types for VFS rdlink X-Git-Tag: v3.3.0~339 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mdoc.3.txt?a=commitdiff_plain;h=111969b62391e4b95cebf9358d20c629b26e92a4;p=minix.git Message types for VFS rdlink Change-Id: Ic077e99fb140a3a1de849f7f761fdfd90961f5d8 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c67d1bda0..c108c0978 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -281,6 +281,23 @@ typedef struct { } mess_fs_vfs_newnode; _ASSERT_MSG_SIZE(mess_fs_vfs_newnode); +typedef struct { + ino_t inode; + + cp_grant_id_t grant; + size_t mem_size; + + uint8_t data[40]; +} mess_vfs_fs_rdlink; +_ASSERT_MSG_SIZE(mess_vfs_fs_rdlink); + +typedef struct { + size_t nbytes; + + uint8_t data[52]; +} mess_fs_vfs_rdlink; +_ASSERT_MSG_SIZE(mess_fs_vfs_rdlink); + typedef struct { dev_t device; @@ -428,6 +445,8 @@ typedef struct { mess_fs_vfs_lookup m_fs_vfs_lookup; mess_vfs_fs_mountpoint m_vfs_fs_mountpoint; mess_vfs_fs_new_driver m_vfs_fs_new_driver; + mess_vfs_fs_rdlink m_vfs_fs_rdlink; + mess_fs_vfs_rdlink m_fs_vfs_rdlink; mess_vfs_fs_readsuper m_vfs_fs_readsuper; mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_vfs_fs_rename m_vfs_fs_rename; diff --git a/lib/libpuffs/link.c b/lib/libpuffs/link.c index f40c26562..6ec60cb98 100644 --- a/lib/libpuffs/link.c +++ b/lib/libpuffs/link.c @@ -160,12 +160,12 @@ int fs_rdlink(void) char path[PATH_MAX]; PUFFS_MAKECRED(pcr, &global_kcred); - copylen = (size_t) fs_m_in.REQ_MEM_SIZE < UMAX_FILE_POS ? - (size_t) fs_m_in.REQ_MEM_SIZE : UMAX_FILE_POS; + copylen = fs_m_in.m_vfs_fs_rdlink.mem_size < UMAX_FILE_POS ? + fs_m_in.m_vfs_fs_rdlink.mem_size : UMAX_FILE_POS; assert(copylen <= PATH_MAX); - 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_rdlink.inode)) == NULL) return(EINVAL); if (!S_ISLNK(pn->pn_va.va_mode)) @@ -181,10 +181,10 @@ int fs_rdlink(void) return(r); } - r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + r = sys_safecopyto(VFS_PROC_NR, fs_m_in.m_vfs_fs_rdlink.grant, (vir_bytes) 0, (vir_bytes) path, (size_t) copylen); if (r == OK) - fs_m_out.RES_NBYTES = copylen; + fs_m_out.m_fs_vfs_rdlink.nbytes = copylen; return(r); } diff --git a/lib/libvtreefs/link.c b/lib/libvtreefs/link.c index 5835eb0f9..a1d4d9908 100644 --- a/lib/libvtreefs/link.c +++ b/lib/libvtreefs/link.c @@ -14,7 +14,7 @@ int fs_rdlink(void) size_t len; int r; - if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) + if ((node = find_inode(fs_m_in.m_vfs_fs_rdlink.inode)) == NULL) return EINVAL; /* Call the rdlink hook. */ @@ -28,14 +28,14 @@ int fs_rdlink(void) len = strlen(path); assert(len > 0 && len < sizeof(path)); - if (len > fs_m_in.REQ_MEM_SIZE) - len = fs_m_in.REQ_MEM_SIZE; + if (len > fs_m_in.m_vfs_fs_rdlink.mem_size) + len = fs_m_in.m_vfs_fs_rdlink.mem_size; /* Copy out the result. */ - r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0, + r = sys_safecopyto(fs_m_in.m_source, fs_m_in.m_vfs_fs_rdlink.grant, 0, (vir_bytes) path, len); if (r != OK) return r; - fs_m_out.RES_NBYTES = len; + fs_m_out.m_fs_vfs_rdlink.nbytes = len; return OK; } diff --git a/servers/ext2/link.c b/servers/ext2/link.c index b61613e9a..51b04e98b 100644 --- a/servers/ext2/link.c +++ b/servers/ext2/link.c @@ -188,10 +188,10 @@ int fs_rdlink() register int r; /* return value */ size_t copylen; - copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS); + copylen = min(fs_m_in.m_vfs_fs_rdlink.mem_size, UMAX_FILE_POS); /* 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_rdlink.inode)) == NULL) return(EINVAL); if (rip->i_size >= MAX_FAST_SYMLINK_LENGTH) { @@ -212,12 +212,12 @@ int fs_rdlink() /* We can safely cast to unsigned, because copylen is guaranteed to be below max file size */ copylen = min( copylen, (unsigned) rip->i_size); - r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + r = sys_safecopyto(VFS_PROC_NR, fs_m_in.m_vfs_fs_rdlink.grant, (vir_bytes) 0, (vir_bytes) link_text, (size_t) copylen); put_block(bp, DIRECTORY_BLOCK); if (r == OK) - fs_m_out.RES_NBYTES = copylen; + fs_m_out.m_fs_vfs_rdlink.nbytes = copylen; } put_inode(rip); diff --git a/servers/mfs/link.c b/servers/mfs/link.c index 9c2559285..6d420f3c8 100644 --- a/servers/mfs/link.c +++ b/servers/mfs/link.c @@ -178,10 +178,10 @@ int fs_rdlink() register int r; /* return value */ size_t copylen; - copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS); + copylen = min(fs_m_in.m_vfs_fs_rdlink.mem_size, UMAX_FILE_POS); /* 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_rdlink.inode)) == NULL) return(EINVAL); if(!S_ISLNK(rip->i_mode)) @@ -193,12 +193,12 @@ int fs_rdlink() /* We can safely cast to unsigned, because copylen is guaranteed to be below max file size */ copylen = min( copylen, (unsigned) rip->i_size); - r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, + r = sys_safecopyto(VFS_PROC_NR, fs_m_in.m_vfs_fs_rdlink.grant, (vir_bytes) 0, (vir_bytes) b_data(bp), (size_t) copylen); put_block(bp, DIRECTORY_BLOCK); if (r == OK) - fs_m_out.RES_NBYTES = copylen; + fs_m_out.m_fs_vfs_rdlink.nbytes = copylen; } put_inode(rip); diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 019a7fa40..01f7819b8 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -731,15 +731,15 @@ static int req_rdlink_actual(endpoint_t fs_e, ino_t inode_nr, /* Fill in request message */ m.m_type = REQ_RDLINK; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_GRANT = grant_id; - m.REQ_MEM_SIZE = len; + m.m_vfs_fs_rdlink.inode = inode_nr; + m.m_vfs_fs_rdlink.grant = grant_id; + m.m_vfs_fs_rdlink.mem_size = len; /* Send/rec request */ r = fs_sendrec(fs_e, &m); cpf_revoke(grant_id); - if (r == OK) r = m.RES_NBYTES; + if (r == OK) r = m.m_fs_vfs_rdlink.nbytes; return(r); }