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>
This commit is contained in:
M. Mohan Kumar 2011-10-14 12:59:37 +05:30 committed by Aneesh Kumar K.V
parent b97400caef
commit d9b36a6e56
3 changed files with 27 additions and 17 deletions

View file

@ -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;
}