Message type for VFS_{,F}CHOWN

Change-Id: Ieb8cef45bfab1e35ad8854038c72b59a4d7bbaad
This commit is contained in:
Lionel Sambuc 2014-05-12 16:48:10 +02:00
parent c869546226
commit 698d2bd2a1
5 changed files with 24 additions and 19 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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));
}

View file

@ -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));
}

View file

@ -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)