[tip:tools/kvm] kvm tools: treat uids and gids in stat structure properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  d43b1daf5c67f82acb02d21b0375db82852dc729
Gitweb:     http://git.kernel.org/tip/d43b1daf5c67f82acb02d21b0375db82852dc729
Author:     Sasha Levin <sasha.levin@xxxxxxxxxx>
AuthorDate: Wed, 19 Mar 2014 12:04:18 -0400
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Fri, 11 Apr 2014 10:38:27 +0300

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@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sasha.levin@xxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/virtio/9p-pdu.c |  4 +++-
 tools/kvm/virtio/9p.c     | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/kvm/virtio/9p-pdu.c b/tools/kvm/virtio/9p-pdu.c
index 9e95f3b..cc2e871 100644
--- a/tools/kvm/virtio/9p-pdu.c
+++ b/tools/kvm/virtio/9p-pdu.c
@@ -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,
diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index 25cdd8c..847eddb 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -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;
 	}
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux