From ea84447ccd5f2f1b36adbdcb77d7f05cf3fb73af Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Wed, 30 Apr 2014 20:37:50 +0200 Subject: [PATCH] Message types for VFS chmod Change-Id: I76e5df4c0a386682e863e640182c59e4ab7e30be --- include/minix/ipc.h | 18 ++++++++++++++++++ lib/libpuffs/protect.c | 6 +++--- lib/libsffs/stat.c | 6 +++--- servers/ext2/protect.c | 6 +++--- servers/mfs/protect.c | 6 +++--- servers/pfs/misc.c | 4 ++-- servers/vfs/request.c | 6 +++--- 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 8c6c93291..36420c9c7 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -146,6 +146,22 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + ino_t inode; + + mode_t mode; + + uint8_t data[44]; +} mess_vfs_fs_chmod; +_ASSERT_MSG_SIZE(mess_vfs_fs_chmod); + +typedef struct { + mode_t mode; + + uint8_t data[52]; +} mess_fs_vfs_chmod; +_ASSERT_MSG_SIZE(mess_fs_vfs_chmod); + typedef struct { ino_t inode; @@ -507,6 +523,8 @@ typedef struct { mess_sigcalls m_sigcalls; mess_vfs_fs_newnode m_vfs_fs_newnode; mess_fs_vfs_newnode m_fs_vfs_newnode; + mess_vfs_fs_chmod m_vfs_fs_chmod; + mess_fs_vfs_chmod m_fs_vfs_chmod; mess_vfs_fs_create m_vfs_fs_create; mess_fs_vfs_create m_fs_vfs_create; mess_vfs_fs_flush m_vfs_fs_flush; diff --git a/lib/libpuffs/protect.c b/lib/libpuffs/protect.c index 6cf79360f..f75fea50d 100644 --- a/lib/libpuffs/protect.c +++ b/lib/libpuffs/protect.c @@ -25,9 +25,9 @@ int fs_chmod(void) if (global_pu->pu_ops.puffs_node_setattr == NULL) return(EINVAL); - mode = (mode_t) fs_m_in.REQ_MODE; + mode = fs_m_in.m_vfs_fs_chmod.mode; - 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_chmod.inode)) == NULL) return(EINVAL); puffs_vattr_null(&va); @@ -39,7 +39,7 @@ int fs_chmod(void) return(EINVAL); /* Return full new mode to caller. */ - fs_m_out.RES_MODE = pn->pn_va.va_mode; + fs_m_out.m_fs_vfs_chmod.mode = pn->pn_va.va_mode; return(OK); } diff --git a/lib/libsffs/stat.c b/lib/libsffs/stat.c index 997027873..f4d5225d0 100644 --- a/lib/libsffs/stat.c +++ b/lib/libsffs/stat.c @@ -110,7 +110,7 @@ int do_chmod(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_chmod.inode)) == NULL) return EINVAL; if ((r = verify_inode(ino, path, NULL)) != OK) @@ -118,7 +118,7 @@ int do_chmod(void) /* Set the new file mode. */ attr.a_mask = SFFS_ATTR_MODE; - attr.a_mode = m_in.REQ_MODE; /* no need to convert in this direction */ + attr.a_mode = m_in.m_vfs_fs_chmod.mode; /* no need to convert in this direction */ if ((r = sffs_table->t_setattr(path, &attr)) != OK) return r; @@ -127,7 +127,7 @@ int do_chmod(void) if ((r = verify_path(path, ino, &attr, NULL)) != OK) return r; - m_out.RES_MODE = get_mode(ino, attr.a_mode); + m_out.m_fs_vfs_chmod.mode = get_mode(ino, attr.a_mode); return OK; } diff --git a/servers/ext2/protect.c b/servers/ext2/protect.c index dc102a61c..436e9d23c 100644 --- a/servers/ext2/protect.c +++ b/servers/ext2/protect.c @@ -20,10 +20,10 @@ int fs_chmod() register struct inode *rip; pmode_t mode; - mode = (pmode_t) fs_m_in.REQ_MODE; + mode = fs_m_in.m_vfs_fs_chmod.mode; /* 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_chmod.inode)) == NULL) return(EINVAL); /* Now make the change. Clear setgid bit if file is not in caller's grp */ @@ -32,7 +32,7 @@ int fs_chmod() rip->i_dirt = IN_DIRTY; /* Return full new mode to caller. */ - fs_m_out.RES_MODE = rip->i_mode; + fs_m_out.m_fs_vfs_chmod.mode = rip->i_mode; put_inode(rip); return(OK); diff --git a/servers/mfs/protect.c b/servers/mfs/protect.c index 9f85b2da5..85826e2d5 100644 --- a/servers/mfs/protect.c +++ b/servers/mfs/protect.c @@ -16,10 +16,10 @@ int fs_chmod() register struct inode *rip; pmode_t mode; - mode = (pmode_t) fs_m_in.REQ_MODE; + mode = fs_m_in.m_vfs_fs_chmod.mode; /* 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_chmod.inode)) == NULL) return(EINVAL); if(rip->i_sp->s_rd_only) { @@ -33,7 +33,7 @@ int fs_chmod() IN_MARKDIRTY(rip); /* Return full new mode to caller. */ - fs_m_out.RES_MODE = rip->i_mode; + fs_m_out.m_fs_vfs_chmod.mode = rip->i_mode; put_inode(rip); return(OK); diff --git a/servers/pfs/misc.c b/servers/pfs/misc.c index 296e46fdb..0ba9b7c06 100644 --- a/servers/pfs/misc.c +++ b/servers/pfs/misc.c @@ -18,9 +18,9 @@ int fs_sync(message *fs_m_in, message *fs_m_out) int fs_chmod(message *fs_m_in, message *fs_m_out) { struct inode *rip; /* target inode */ - mode_t mode = (mode_t) fs_m_in->REQ_MODE; + mode_t mode = fs_m_in->m_vfs_fs_chmod.mode; - if( (rip = find_inode(fs_m_in->REQ_INODE_NR)) == NULL) return(EINVAL); + if( (rip = find_inode(fs_m_in->m_vfs_fs_chmod.inode)) == NULL) return(EINVAL); get_inode(rip->i_dev, rip->i_num); /* mark inode in use */ rip->i_mode = (rip->i_mode & ~ALL_MODES) | (mode & ALL_MODES); put_inode(rip); /* release the inode */ diff --git a/servers/vfs/request.c b/servers/vfs/request.c index f2b350304..81c6b5c04 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -115,14 +115,14 @@ int req_chmod( /* Fill in request message */ m.m_type = REQ_CHMOD; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_MODE = (pmode_t) rmode; + m.m_vfs_fs_chmod.inode = inode_nr; + m.m_vfs_fs_chmod.mode = rmode; /* Send/rec request */ r = fs_sendrec(fs_e, &m); /* Copy back actual mode. */ - *new_modep = (mode_t) m.RES_MODE; + *new_modep = m.m_fs_vfs_chmod.mode; return(r); } -- 2.44.0