virtio-9p: Make infrastructure for the new security model.
This patch adds required infrastructure for the new security model.
- A new configure option for attr/xattr.
- if CONFIG_VIRTFS will be defined if both CONFIG_LINUX and CONFIG_ATTR defined.
- Defines routines related to both security models.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/hw/file-op-9p.h b/hw/file-op-9p.h
index f84767f..307bd1e 100644
--- a/hw/file-op-9p.h
+++ b/hw/file-op-9p.h
@@ -18,13 +18,33 @@
#include <utime.h>
#include <sys/stat.h>
#include <sys/uio.h>
+#include <sys/vfs.h>
+#define SM_LOCAL_MODE_BITS 0600
+#define SM_LOCAL_DIR_MODE_BITS 0700
+
+typedef enum
+{
+ SM_PASSTHROUGH = 1, /* uid/gid set on fileserver files */
+ SM_MAPPED, /* uid/gid part of xattr */
+} SecModel;
+
+typedef struct FsCred
+{
+ uid_t fc_uid;
+ gid_t fc_gid;
+ mode_t fc_mode;
+ dev_t fc_rdev;
+} FsCred;
typedef struct FsContext
{
char *fs_root;
+ SecModel fs_sm;
uid_t uid;
} FsContext;
+extern void cred_init(FsCred *);
+
typedef struct FileOperations
{
int (*lstat)(FsContext *, const char *, struct stat *);