summary refs log tree commit diff stats
path: root/fsdev/qemu-fsdev.c
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2011-10-14 12:59:37 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-10-15 15:30:27 +0530
commitd9b36a6e562450fd633ea9352f43885b86693838 (patch)
treeca89e85a47fc9e3b5cd28b61ba4966410b554b0c /fsdev/qemu-fsdev.c
parentb97400caef60ccfb0bc81c59f8bd824c43a0d6c8 (diff)
downloadfocaccia-qemu-d9b36a6e562450fd633ea9352f43885b86693838.tar.gz
focaccia-qemu-d9b36a6e562450fd633ea9352f43885b86693838.zip
hw/9pfs: Handle Security model parsing
Except local fs driver all other fs drivers (handle, synth) don't need
security model. Update fsdev parameter parsing accordingly.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'fsdev/qemu-fsdev.c')
-rw-r--r--fsdev/qemu-fsdev.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
index ce920d665a..5977bcca4c 100644
--- a/fsdev/qemu-fsdev.c
+++ b/fsdev/qemu-fsdev.c
@@ -58,8 +58,15 @@ int qemu_fsdev_add(QemuOpts *opts)
         return -1;
     }
 
-    if (!sec_model) {
-        fprintf(stderr, "fsdev: No security_model specified.\n");
+    if (!strcmp(fsdriver, "local") && !sec_model) {
+        fprintf(stderr, "security model not specified, "
+                "local fs needs security model\nvalid options are:"
+                "\tsecurity_model=[passthrough|mapped|none]\n");
+        return -1;
+    }
+
+    if (strcmp(fsdriver, "local") && sec_model) {
+        fprintf(stderr, "only local fs driver needs security model\n");
         return -1;
     }
 
@@ -80,6 +87,10 @@ int qemu_fsdev_add(QemuOpts *opts)
         }
     }
 
+    if (strcmp(fsdriver, "local")) {
+        goto done;
+    }
+
     if (!strcmp(sec_model, "passthrough")) {
         fsle->fse.export_flags |= V9FS_SM_PASSTHROUGH;
     } else if (!strcmp(sec_model, "mapped")) {
@@ -87,14 +98,11 @@ int qemu_fsdev_add(QemuOpts *opts)
     } 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;
+        fprintf(stderr, "Invalid security model %s specified, valid options are"
+                "\n\t [passthrough|mapped|none]\n", sec_model);
+        return -1;
     }
-
+done:
     QTAILQ_INSERT_TAIL(&fsdriver_entries, fsle, next);
     return 0;
 }