From d9b36a6e562450fd633ea9352f43885b86693838 Mon Sep 17 00:00:00 2001 From: "M. Mohan Kumar" Date: Fri, 14 Oct 2011 12:59:37 +0530 Subject: 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 Signed-off-by: Aneesh Kumar K.V --- fsdev/qemu-fsdev.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'fsdev') diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index ce920d665..5977bcca4 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; } -- cgit v1.2.3