Revision 9ce56db6

b/fsdev/qemu-fsdev.c
34 34
        return -1;
35 35
    }
36 36

  
37
     for (i = 0; i < ARRAY_SIZE(FsTypes); i++) {
37
    for (i = 0; i < ARRAY_SIZE(FsTypes); i++) {
38 38
        if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) {
39 39
            break;
40 40
        }
......
46 46
        return -1;
47 47
    }
48 48

  
49
    if (qemu_opt_get(opts, "security_model") == NULL) {
50
        fprintf(stderr, "fsdev: No security_model specified.\n");
51
        return -1;
52
    }
53

  
49 54
    fsle = qemu_malloc(sizeof(*fsle));
50 55

  
51 56
    fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts));
52 57
    fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path"));
58
    fsle->fse.security_model = qemu_strdup(qemu_opt_get(opts,
59
                "security_model"));
53 60
    fsle->fse.ops = FsTypes[i].ops;
54 61

  
55 62
    QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);
b/fsdev/qemu-fsdev.h
40 40
typedef struct FsTypeEntry {
41 41
    char *fsdev_id;
42 42
    char *path;
43
    char *security_model;
43 44
    FileOperations *ops;
44 45
} FsTypeEntry;
45 46

  
b/hw/virtio-9p.c
2253 2253
        exit(1);
2254 2254
    }
2255 2255

  
2256
    if (!strcmp(fse->security_model, "passthrough") &&
2257
                !strcmp(fse->security_model, "mapped")) {
2258
        /* user haven't specified a correct security option */
2259
        fprintf(stderr, "one of the following must be specified as the"
2260
                "security option:\n\t security_model=passthrough \n\t "
2261
                "security_model=mapped\n");
2262
        return NULL;
2263
    }
2264

  
2256 2265
    if (lstat(fse->path, &stat)) {
2257 2266
        fprintf(stderr, "share path %s does not exist\n", fse->path);
2258 2267
        exit(1);
b/qemu-config.c
163 163
        }, {
164 164
            .name = "path",
165 165
            .type = QEMU_OPT_STRING,
166
        }, {
167
            .name = "security_model",
168
            .type = QEMU_OPT_STRING,
166 169
        },
167 170
        { /*End of list */ }
168 171
    },
......
184 187
        }, {
185 188
            .name = "mount_tag",
186 189
            .type = QEMU_OPT_STRING,
190
        }, {
191
            .name = "security_model",
192
            .type = QEMU_OPT_STRING,
187 193
        },
188 194

  
189 195
        { /*End of list */ }
b/qemu-options.hx
486 486
DEFHEADING(File system options:)
487 487

  
488 488
DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
489
    "-fsdev local,id=id,path=path\n",
489
    "-fsdev local,id=id,path=path,security_model=[mapped|passthrough]\n",
490 490
    QEMU_ARCH_ALL)
491 491

  
492 492
STEXI
......
502 502

  
503 503
Options to each backend are described below.
504 504

  
505
@item -fsdev local ,id=@var{id} ,path=@var{path}
505
@item -fsdev local ,id=@var{id} ,path=@var{path} ,security_model=@var{security_model}
506 506

  
507 507
Create a file-system-"device" for local-filesystem.
508 508

  
......
510 510

  
511 511
@option{path} specifies the path to be exported. @option{path} is required.
512 512

  
513
@option{security_model} specifies the security model to be followed.
514
@option{security_model} is required.
515

  
513 516
@end table
514 517
ETEXI
515 518
#endif
......
518 521
DEFHEADING(Virtual File system pass-through options:)
519 522

  
520 523
DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
521
    "-virtfs local,path=path,mount_tag=tag\n",
524
    "-virtfs local,path=path,mount_tag=tag,security_model=[mapped|passthrough]\n",
522 525
    QEMU_ARCH_ALL)
523 526

  
524 527
STEXI
......
534 537

  
535 538
Options to each backend are described below.
536 539

  
537
@item -virtfs local ,path=@var{path} ,mount_tag=@var{mount_tag}
540
@item -virtfs local ,path=@var{path} ,mount_tag=@var{mount_tag} ,security_model=@var{security_model}
538 541

  
539 542
Create a Virtual file-system-pass through for local-filesystem.
540 543

  
......
542 545

  
543 546
@option{path} specifies the path to be exported. @option{path} is required.
544 547

  
548
@option{security_model} specifies the security model to be followed.
549
@option{security_model} is required.
550

  
551

  
545 552
@option{mount_tag} specifies the tag with which the exported file is mounted.
546 553
@option{mount_tag} is required.
547 554

  
b/vl.c
2300 2300
                    exit(1);
2301 2301
                }
2302 2302

  
2303
                len = strlen(",id=,path=");
2303
                if (qemu_opt_get(opts, "fstype") == NULL ||
2304
                        qemu_opt_get(opts, "mount_tag") == NULL ||
2305
                        qemu_opt_get(opts, "path") == NULL ||
2306
                        qemu_opt_get(opts, "security_model") == NULL) {
2307
                    fprintf(stderr, "Usage: -virtfs fstype,path=/share_path/,"
2308
                            "security_model=[mapped|passthrough],"
2309
                            "mnt_tag=tag.\n");
2310
                    exit(1);
2311
                }
2312

  
2313
                len = strlen(",id=,path=,security_model=");
2304 2314
                len += strlen(qemu_opt_get(opts, "fstype"));
2305 2315
                len += strlen(qemu_opt_get(opts, "mount_tag"));
2306 2316
                len += strlen(qemu_opt_get(opts, "path"));
2317
                len += strlen(qemu_opt_get(opts, "security_model"));
2307 2318
                arg_fsdev = qemu_malloc((len + 1) * sizeof(*arg_fsdev));
2308 2319

  
2309 2320
                if (!arg_fsdev) {
......
2312 2323
                    exit(1);
2313 2324
                }
2314 2325

  
2315
                sprintf(arg_fsdev, "%s,id=%s,path=%s",
2326
                sprintf(arg_fsdev, "%s,id=%s,path=%s,security_model=%s",
2316 2327
                                qemu_opt_get(opts, "fstype"),
2317 2328
                                qemu_opt_get(opts, "mount_tag"),
2318
                                qemu_opt_get(opts, "path"));
2329
                                qemu_opt_get(opts, "path"),
2330
                                qemu_opt_get(opts, "security_model"));
2319 2331

  
2320 2332
                len = strlen("virtio-9p-pci,fsdev=,mount_tag=");
2321 2333
                len += 2*strlen(qemu_opt_get(opts, "mount_tag"));

Also available in: Unified diff