aboutsummaryrefslogtreecommitdiffstats
path: root/fsdev
diff options
context:
space:
mode:
Diffstat (limited to 'fsdev')
-rw-r--r--fsdev/file-op-9p.h36
-rw-r--r--fsdev/qemu-fsdev.c19
-rw-r--r--fsdev/qemu-fsdev.h1
3 files changed, 34 insertions, 22 deletions
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h
index 272f018ef..908e2a5ed 100644
--- a/fsdev/file-op-9p.h
+++ b/fsdev/file-op-9p.h
@@ -23,23 +23,6 @@
#define SM_LOCAL_MODE_BITS 0600
#define SM_LOCAL_DIR_MODE_BITS 0700
-typedef enum
-{
- /*
- * Server will try to set uid/gid.
- * On failure ignore the error.
- */
- SM_NONE = 0,
- /*
- * uid/gid set on fileserver files
- */
- SM_PASSTHROUGH = 1,
- /*
- * uid/gid part of xattr
- */
- SM_MAPPED,
-} SecModel;
-
typedef struct FsCred
{
uid_t fc_uid;
@@ -60,12 +43,27 @@ typedef struct extended_ops {
/* export flags */
#define V9FS_IMMEDIATE_WRITEOUT 0x00000001
#define V9FS_PATHNAME_FSCONTEXT 0x00000002
+/*
+ * uid/gid set on fileserver files
+ */
+#define V9FS_SM_PASSTHROUGH 0x00000004
+/*
+ * uid/gid part of xattr
+ */
+#define V9FS_SM_MAPPED 0x00000008
+/*
+ * Server will try to set uid/gid.
+ * On failure ignore the error.
+ */
+#define V9FS_SM_NONE 0x00000010
+
+
+#define V9FS_SEC_MASK 0x0000001C
typedef struct FsContext
{
- char *fs_root;
- SecModel fs_sm;
uid_t uid;
+ char *fs_root;
int export_flags;
struct xattr_operations **xops;
struct extended_ops exops;
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
index fcec494cf..ce920d665 100644
--- a/fsdev/qemu-fsdev.c
+++ b/fsdev/qemu-fsdev.c
@@ -72,14 +72,29 @@ int qemu_fsdev_add(QemuOpts *opts)
fsle->fse.fsdev_id = g_strdup(fsdev_id);
fsle->fse.path = g_strdup(path);
- fsle->fse.security_model = g_strdup(sec_model);
fsle->fse.ops = FsDrivers[i].ops;
fsle->fse.export_flags = 0;
if (writeout) {
if (!strcmp(writeout, "immediate")) {
- fsle->fse.export_flags = V9FS_IMMEDIATE_WRITEOUT;
+ fsle->fse.export_flags |= V9FS_IMMEDIATE_WRITEOUT;
}
}
+
+ if (!strcmp(sec_model, "passthrough")) {
+ fsle->fse.export_flags |= V9FS_SM_PASSTHROUGH;
+ } else if (!strcmp(sec_model, "mapped")) {
+ fsle->fse.export_flags |= V9FS_SM_MAPPED;
+ } else if (!strcmp(sec_model, "none")) {
+ fsle->fse.export_flags |= V9FS_SM_NONE;
+ } else {
+ fprintf(stderr, "Default to security_model=none. You may want"
+ " enable advanced security model using "
+ "security option:\n\t security_model=passthrough\n\t "
+ "security_model=mapped\n");
+
+ fsle->fse.export_flags |= V9FS_SM_NONE;
+ }
+
QTAILQ_INSERT_TAIL(&fsdriver_entries, fsle, next);
return 0;
}
diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h
index 69baafc0a..509908572 100644
--- a/fsdev/qemu-fsdev.h
+++ b/fsdev/qemu-fsdev.h
@@ -40,7 +40,6 @@ typedef struct FsDriverTable {
typedef struct FsDriverEntry {
char *fsdev_id;
char *path;
- char *security_model;
int export_flags;
FileOperations *ops;
} FsDriverEntry;