aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2015-01-20 23:55:48 +0000
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:40:11 +0100
commitc6cb7c757339c7f465934dbb81fa01f1659114d5 (patch)
tree2367371fbfbdf7f7e63c8d4bce5b8f8c381f45bc
parentfbb8a81d1a37ac9dc43e61ce975a0b27e58b61db (diff)
downloadkvmtool-c6cb7c757339c7f465934dbb81fa01f1659114d5.tar.gz
kvmtool: 9p: teach kvmtool about kuid_t and kgid_t
The 9p kernel code uses separate types for uid_t and gid_t. To avoid changing too much code needlessly, copy over the kernel definitions from uidgid.h into 9p.h. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--include/linux/9p.h23
-rw-r--r--virtio/9p-pdu.c3
-rw-r--r--virtio/9p.c3
3 files changed, 25 insertions, 4 deletions
diff --git a/include/linux/9p.h b/include/linux/9p.h
index 27dfe857..c7cfd8e1 100644
--- a/include/linux/9p.h
+++ b/include/linux/9p.h
@@ -27,6 +27,29 @@
#ifndef NET_9P_H
#define NET_9P_H
+/* These definitions are from Linux include/linux/uidgid.h */
+typedef struct {
+ uid_t val;
+} kuid_t;
+
+typedef struct {
+ gid_t val;
+} kgid_t;
+
+#define KUIDT_INIT(value) (kuid_t){ value }
+#define KGIDT_INIT(value) (kgid_t){ value }
+
+static inline uid_t __kuid_val(kuid_t uid)
+{
+ return uid.val;
+}
+
+static inline gid_t __kgid_val(kgid_t gid)
+{
+ return gid.val;
+}
+
+
/**
* enum p9_debug_flags - bits for mount time debug parameter
* @P9_DEBUG_ERROR: more verbose error messages including original error string
diff --git a/virtio/9p-pdu.c b/virtio/9p-pdu.c
index cc2e8716..c0b95e06 100644
--- a/virtio/9p-pdu.c
+++ b/virtio/9p-pdu.c
@@ -5,8 +5,7 @@
#include <stdint.h>
#include <linux/compiler.h>
-#include <linux/uidgid.h>
-#include <net/9p/9p.h>
+#include <linux/9p.h>
static void virtio_p9_pdu_read(struct p9_pdu *pdu, void *data, size_t size)
{
diff --git a/virtio/9p.c b/virtio/9p.c
index b24c0f2d..a68a5eb4 100644
--- a/virtio/9p.c
+++ b/virtio/9p.c
@@ -18,8 +18,7 @@
#include <linux/virtio_ring.h>
#include <linux/virtio_9p.h>
-#include <linux/uidgid.h>
-#include <net/9p/9p.h>
+#include <linux/9p.h>
static LIST_HEAD(devs);
static int compat_id = -1;