From: Lionel Sambuc Date: Thu, 1 May 2014 09:40:33 +0000 (+0200) Subject: Message types for VFS chown X-Git-Tag: v3.3.0~329 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mdoc.3.txt?a=commitdiff_plain;h=a65bf37e3bbfefb73d4ce624b69eafb6f42c36f0;p=minix.git Message types for VFS chown Change-Id: I1dc50772fd28b0c698d85922ad0ad3b41dde006c --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index f892cc647..f0715624d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -162,6 +162,23 @@ typedef struct { } mess_fs_vfs_chmod; _ASSERT_MSG_SIZE(mess_fs_vfs_chmod); +typedef struct { + ino_t inode; + + uid_t uid; + gid_t gid; + + uint8_t data[40]; +} mess_vfs_fs_chown; +_ASSERT_MSG_SIZE(mess_vfs_fs_chown); + +typedef struct { + mode_t mode; + + uint8_t data[52]; +} mess_fs_vfs_chown; +_ASSERT_MSG_SIZE(mess_fs_vfs_chown); + typedef struct { ino_t inode; @@ -532,6 +549,8 @@ typedef struct { 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_chown m_vfs_fs_chown; + mess_fs_vfs_chown m_fs_vfs_chown; 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 f75fea50d..6a127f513 100644 --- a/lib/libpuffs/protect.c +++ b/lib/libpuffs/protect.c @@ -54,14 +54,14 @@ int fs_chown(void) struct vattr va; 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_chown.inode)) == NULL) return(EINVAL); /* Not permitted to change the owner of a file on a read-only file sys. */ if (!is_readonly_fs) { puffs_vattr_null(&va); - va.va_uid = fs_m_in.REQ_UID; - va.va_gid = fs_m_in.REQ_GID; + va.va_uid = fs_m_in.m_vfs_fs_chown.uid; + va.va_gid = fs_m_in.m_vfs_fs_chown.gid; va.va_mode = pn->pn_va.va_mode & ~(I_SET_UID_BIT | I_SET_GID_BIT); va.va_ctime = clock_timespec(); @@ -70,7 +70,7 @@ int fs_chown(void) } /* Update caller on current mode, as it may have changed. */ - fs_m_out.RES_MODE = pn->pn_va.va_mode; + fs_m_out.m_fs_vfs_chown.mode = pn->pn_va.va_mode; return(OK); } diff --git a/servers/ext2/protect.c b/servers/ext2/protect.c index 436e9d23c..d3e6315b0 100644 --- a/servers/ext2/protect.c +++ b/servers/ext2/protect.c @@ -48,21 +48,21 @@ int fs_chown() register int r; /* 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_chown.inode)) == NULL) return(EINVAL); /* Not permitted to change the owner of a file on a read-only file sys. */ r = read_only(rip); if (r == OK) { - rip->i_uid = fs_m_in.REQ_UID; - rip->i_gid = fs_m_in.REQ_GID; + rip->i_uid = fs_m_in.m_vfs_fs_chown.uid; + rip->i_gid = fs_m_in.m_vfs_fs_chown.gid; rip->i_mode &= ~(I_SET_UID_BIT | I_SET_GID_BIT); rip->i_update |= CTIME; rip->i_dirt = IN_DIRTY; } /* Update caller on current mode, as it may have changed. */ - fs_m_out.RES_MODE = rip->i_mode; + fs_m_out.m_fs_vfs_chown.mode = rip->i_mode; put_inode(rip); return(r); diff --git a/servers/mfs/protect.c b/servers/mfs/protect.c index 85826e2d5..c17712852 100644 --- a/servers/mfs/protect.c +++ b/servers/mfs/protect.c @@ -49,21 +49,21 @@ int fs_chown() register int r; /* 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_chown.inode)) == NULL) return(EINVAL); /* Not permitted to change the owner of a file on a read-only file sys. */ r = read_only(rip); if (r == OK) { - rip->i_uid = (uid_t) fs_m_in.REQ_UID; - rip->i_gid = (gid_t) fs_m_in.REQ_GID; + rip->i_uid = fs_m_in.m_vfs_fs_chown.uid; + rip->i_gid = fs_m_in.m_vfs_fs_chown.gid; rip->i_mode &= ~(I_SET_UID_BIT | I_SET_GID_BIT); rip->i_update |= CTIME; IN_MARKDIRTY(rip); } /* Update caller on current mode, as it may have changed. */ - fs_m_out.RES_MODE = rip->i_mode; + fs_m_out.m_fs_vfs_chown.mode = rip->i_mode; put_inode(rip); return(r); diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 4c028f743..c93795b63 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -144,15 +144,15 @@ int req_chown( /* Fill in request message */ m.m_type = REQ_CHOWN; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_UID = (puid_t) newuid; - m.REQ_GID = (pgid_t) newgid; + m.m_vfs_fs_chown.inode = inode_nr; + m.m_vfs_fs_chown.uid = newuid; + m.m_vfs_fs_chown.gid = newgid; /* Send/rec request */ r = fs_sendrec(fs_e, &m); /* Return new mode to caller. */ - *new_modep = (mode_t) m.RES_MODE; + *new_modep = m.m_fs_vfs_chown.mode; return(r); }