mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-06-16 02:15:47 +00:00
kvm tools: treat uids and gids in stat structure properly
Upstream commit "9p: Modify the stat structures to use kuid_t and kgid_t" has modified the type of uid and gid in the stat structure, which breaks build for us. This is a rather trivial conversion from u32 to kuid_t and kgid_t. Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
+3
-1
@@ -129,7 +129,9 @@ static int virtio_p9_decode(struct p9_pdu *pdu, const char *fmt, va_list ap)
|
||||
{
|
||||
struct p9_wstat *stbuf = va_arg(ap, struct p9_wstat *);
|
||||
memset(stbuf, 0, sizeof(struct p9_wstat));
|
||||
stbuf->n_uid = stbuf->n_gid = stbuf->n_muid = -1;
|
||||
stbuf->n_uid = KUIDT_INIT(-1);
|
||||
stbuf->n_gid = KGIDT_INIT(-1);
|
||||
stbuf->n_muid = KUIDT_INIT(-1);
|
||||
retval = virtio_p9_pdu_readf(pdu, "wwdQdddqssss",
|
||||
&stbuf->size, &stbuf->type,
|
||||
&stbuf->dev, &stbuf->qid,
|
||||
|
||||
+6
-5
@@ -441,8 +441,8 @@ static void virtio_p9_fill_stat(struct p9_dev *p9dev,
|
||||
memset(statl, 0, sizeof(*statl));
|
||||
statl->st_mode = st->st_mode;
|
||||
statl->st_nlink = st->st_nlink;
|
||||
statl->st_uid = st->st_uid;
|
||||
statl->st_gid = st->st_gid;
|
||||
statl->st_uid = KUIDT_INIT(st->st_uid);
|
||||
statl->st_gid = KGIDT_INIT(st->st_gid);
|
||||
statl->st_rdev = st->st_rdev;
|
||||
statl->st_size = st->st_size;
|
||||
statl->st_blksize = st->st_blksize;
|
||||
@@ -668,12 +668,13 @@ static void virtio_p9_setattr(struct p9_dev *p9dev,
|
||||
((p9attr.valid & ATTR_CTIME)
|
||||
&& !((p9attr.valid & ATTR_MASK) & ~ATTR_CTIME))) {
|
||||
if (!(p9attr.valid & ATTR_UID))
|
||||
p9attr.uid = -1;
|
||||
p9attr.uid = KUIDT_INIT(-1);
|
||||
|
||||
if (!(p9attr.valid & ATTR_GID))
|
||||
p9attr.gid = -1;
|
||||
p9attr.gid = KGIDT_INIT(-1);
|
||||
|
||||
ret = lchown(fid->abs_path, p9attr.uid, p9attr.gid);
|
||||
ret = lchown(fid->abs_path, __kuid_val(p9attr.uid),
|
||||
__kgid_val(p9attr.gid));
|
||||
if (ret < 0)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user