From: Lionel Sambuc Date: Tue, 29 Apr 2014 17:33:47 +0000 (+0200) Subject: Message types for VFS ftrunc X-Git-Tag: v3.3.0~344 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/weatherstation.js?a=commitdiff_plain;h=135346dfc38e3e0de539d8ec32259c561592bafc;p=minix.git Message types for VFS ftrunc Change-Id: I593a4d91b1d974f632f6cb4eb23aabee5b65df7b --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 7bc5cc293..95dcea1b1 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -178,6 +178,15 @@ typedef struct { } mess_vfs_fs_flush; _ASSERT_MSG_SIZE(mess_vfs_fs_flush); +typedef struct { + ino_t inode; + off_t trc_start; + off_t trc_end; + + uint8_t data[32]; +} mess_vfs_fs_ftrunc; +_ASSERT_MSG_SIZE(mess_vfs_fs_ftrunc); + typedef struct { ino_t dir_ino; ino_t root_ino; @@ -356,6 +365,7 @@ typedef struct { mess_vfs_fs_create m_vfs_fs_create; mess_fs_vfs_create m_fs_vfs_create; mess_vfs_fs_flush m_vfs_fs_flush; + mess_vfs_fs_ftrunc m_vfs_fs_ftrunc; 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 19ee0242a..f40c26562 100644 --- a/lib/libpuffs/link.c +++ b/lib/libpuffs/link.c @@ -19,11 +19,11 @@ int fs_ftrunc(void) off_t start, end; PUFFS_MAKECRED(pcr, &global_kcred); - 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_ftrunc.inode)) == NULL) return(EINVAL); - start = fs_m_in.REQ_TRC_START; - end = fs_m_in.REQ_TRC_END; + start = fs_m_in.m_vfs_fs_ftrunc.trc_start; + end = fs_m_in.m_vfs_fs_ftrunc.trc_end; if (end == 0) { struct vattr va; diff --git a/lib/libsffs/write.c b/lib/libsffs/write.c index 4d852ea99..22cbfa7d2 100644 --- a/lib/libsffs/write.c +++ b/lib/libsffs/write.c @@ -126,13 +126,13 @@ int do_ftrunc(void) if (state.s_read_only) return EROFS; - if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL) + if ((ino = find_inode(m_in.m_vfs_fs_ftrunc.inode)) == NULL) return EINVAL; if (IS_DIR(ino)) return EISDIR; - start = m_in.REQ_TRC_START; - end = m_in.REQ_TRC_END; + start = m_in.m_vfs_fs_ftrunc.trc_start; + end = m_in.m_vfs_fs_ftrunc.trc_end; if (end == 0) { /* Truncate or expand the file. */ diff --git a/servers/ext2/link.c b/servers/ext2/link.c index b32fabd83..b61613e9a 100644 --- a/servers/ext2/link.c +++ b/servers/ext2/link.c @@ -520,11 +520,11 @@ int fs_ftrunc(void) off_t start, end; int r; - if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL) + if( (rip = find_inode(fs_dev, fs_m_in.m_vfs_fs_ftrunc.inode)) == NULL) return(EINVAL); - start = fs_m_in.REQ_TRC_START; - end = fs_m_in.REQ_TRC_END; + start = fs_m_in.m_vfs_fs_ftrunc.trc_start; + end = fs_m_in.m_vfs_fs_ftrunc.trc_end; if (end == 0) r = truncate_inode(rip, start); diff --git a/servers/mfs/link.c b/servers/mfs/link.c index dd99e11ee..9c2559285 100644 --- a/servers/mfs/link.c +++ b/servers/mfs/link.c @@ -492,14 +492,14 @@ int fs_ftrunc(void) off_t start, end; int r; - if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL) + if( (rip = find_inode(fs_dev, fs_m_in.m_vfs_fs_ftrunc.inode)) == NULL) return(EINVAL); if(rip->i_sp->s_rd_only) { r = EROFS; } else { - start = fs_m_in.REQ_TRC_START; - end = fs_m_in.REQ_TRC_END; + start = fs_m_in.m_vfs_fs_ftrunc.trc_start; + end = fs_m_in.m_vfs_fs_ftrunc.trc_end; if (end == 0) r = truncate_inode(rip, start); diff --git a/servers/pfs/link.c b/servers/pfs/link.c index 3648c4e04..7b1286d51 100644 --- a/servers/pfs/link.c +++ b/servers/pfs/link.c @@ -10,13 +10,13 @@ int fs_ftrunc(message *fs_m_in, message *fs_m_out) { struct inode *rip; off_t start; - pino_t inumb; + ino_t inumb; - inumb = (pino_t) fs_m_in->REQ_INODE_NR; + inumb = fs_m_in->m_vfs_fs_ftrunc.inode; if( (rip = find_inode(inumb)) == NULL) return(EINVAL); - start = fs_m_in->REQ_TRC_START; + start = fs_m_in->m_vfs_fs_ftrunc.trc_start; return truncate_inode(rip, start); } diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 14cc3cf7d..23350b9c9 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -265,9 +265,9 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end) /* Fill in request message */ m.m_type = REQ_FTRUNC; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_TRC_START = start; - m.REQ_TRC_END = end; + m.m_vfs_fs_ftrunc.inode = inode_nr; + m.m_vfs_fs_ftrunc.trc_start = start; + m.m_vfs_fs_ftrunc.trc_end = end; if (!(vmp->m_fs_flags & RES_64BIT) && ((start > INT_MAX) || (end > INT_MAX))) {