From 698d2bd2a1252bd74befc8f23a3884b64aed827d Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 12 May 2014 16:48:10 +0200 Subject: [PATCH] Message type for VFS_{,F}CHOWN Change-Id: Ieb8cef45bfab1e35ad8854038c72b59a4d7bbaad --- include/minix/callnr.h | 7 ------- include/minix/ipc.h | 12 ++++++++++++ lib/libc/sys-minix/chown.c | 8 ++++---- lib/libc/sys-minix/fchown.c | 6 +++--- servers/vfs/protect.c | 10 +++++----- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 06330767e..b847bf96b 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -232,13 +232,6 @@ #define NR_VFS_CALLS 49 /* highest number from base plus one */ -/* Field names for the chown(2) and fchown(2) calls. */ -#define VFS_CHOWN_NAME m1_p1 /* const char * */ -#define VFS_CHOWN_LEN m1_i1 /* size_t */ -#define VFS_CHOWN_FD m1_i1 /* int */ -#define VFS_CHOWN_OWNER m1_i2 /* uid_t */ -#define VFS_CHOWN_GROUP m1_i3 /* gid_t */ - /* Field names for the fchdir(2) call. */ #define VFS_FCHDIR_FD m1_i1 /* int */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 03225e066..d4ba5793d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -145,6 +145,17 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + vir_bytes name; + size_t len; + int fd; + uid_t owner; + gid_t group; + + uint8_t padding[36]; +} mess_lc_vfs_chown; +_ASSERT_MSG_SIZE(mess_lc_vfs_chown); + typedef struct { vir_bytes name; size_t len; @@ -816,6 +827,7 @@ typedef struct { mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_fs_vfs_readwrite m_fs_vfs_readwrite; + mess_lc_vfs_chown m_lc_vfs_chown; mess_lc_vfs_creat m_lc_vfs_creat; mess_lc_vfs_fcntl m_lc_vfs_fcntl; mess_lc_vfs_fstat m_lc_vfs_fstat; diff --git a/lib/libc/sys-minix/chown.c b/lib/libc/sys-minix/chown.c index b0505971a..fd4c26797 100644 --- a/lib/libc/sys-minix/chown.c +++ b/lib/libc/sys-minix/chown.c @@ -14,9 +14,9 @@ int chown(const char *name, uid_t owner, gid_t grp) message m; memset(&m, 0, sizeof(m)); - m.VFS_CHOWN_LEN = strlen(name) + 1; - m.VFS_CHOWN_OWNER = owner; - m.VFS_CHOWN_GROUP = grp; - m.VFS_CHOWN_NAME = (char *) __UNCONST(name); + m.m_lc_vfs_chown.len = strlen(name) + 1; + m.m_lc_vfs_chown.owner = owner; + m.m_lc_vfs_chown.group = grp; + m.m_lc_vfs_chown.name = (vir_bytes)name; return(_syscall(VFS_PROC_NR, VFS_CHOWN, &m)); } diff --git a/lib/libc/sys-minix/fchown.c b/lib/libc/sys-minix/fchown.c index b49601c85..19db6dd3a 100644 --- a/lib/libc/sys-minix/fchown.c +++ b/lib/libc/sys-minix/fchown.c @@ -14,8 +14,8 @@ int fchown(int fd, uid_t owner, gid_t grp) message m; memset(&m, 0, sizeof(m)); - m.VFS_CHOWN_FD = fd; - m.VFS_CHOWN_OWNER = owner; - m.VFS_CHOWN_GROUP = grp; + m.m_lc_vfs_chown.fd = fd; + m.m_lc_vfs_chown.owner = owner; + m.m_lc_vfs_chown.group = grp; return(_syscall(VFS_PROC_NR, VFS_FCHOWN, &m)); } diff --git a/servers/vfs/protect.c b/servers/vfs/protect.c index 98b20dbf1..7bee28a7f 100644 --- a/servers/vfs/protect.c +++ b/servers/vfs/protect.c @@ -112,12 +112,12 @@ int do_chown(void) size_t vname1_length; flp = NULL; - uid = job_m_in.VFS_CHOWN_OWNER; - gid = job_m_in.VFS_CHOWN_GROUP; + uid = job_m_in.m_lc_vfs_chown.owner; + gid = job_m_in.m_lc_vfs_chown.group; if (job_call_nr == VFS_CHOWN) { - vname1 = (vir_bytes) job_m_in.VFS_CHOWN_NAME; - vname1_length = (size_t) job_m_in.VFS_CHOWN_LEN; + vname1 = job_m_in.m_lc_vfs_chown.name; + vname1_length = job_m_in.m_lc_vfs_chown.len; lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp); resolve.l_vmnt_lock = VMNT_READ; @@ -128,7 +128,7 @@ int do_chown(void) return(err_code); if ((vp = eat_path(&resolve, fp)) == NULL) return(err_code); } else { /* call_nr == VFS_FCHOWN */ - rfd = job_m_in.VFS_CHOWN_FD; + rfd = job_m_in.m_lc_vfs_chown.fd; /* File is already opened; get a pointer to the vnode from filp. */ if ((flp = get_filp(rfd, VNODE_WRITE)) == NULL) -- 2.44.0