Revision 3d54abc7
b/qemu-config.c | ||
---|---|---|
169 | 169 |
}; |
170 | 170 |
#endif |
171 | 171 |
|
172 |
#ifdef CONFIG_LINUX |
|
173 |
QemuOptsList qemu_virtfs_opts = { |
|
174 |
.name = "virtfs", |
|
175 |
.implied_opt_name = "fstype", |
|
176 |
.head = QTAILQ_HEAD_INITIALIZER(qemu_virtfs_opts.head), |
|
177 |
.desc = { |
|
178 |
{ |
|
179 |
.name = "fstype", |
|
180 |
.type = QEMU_OPT_STRING, |
|
181 |
}, { |
|
182 |
.name = "path", |
|
183 |
.type = QEMU_OPT_STRING, |
|
184 |
}, { |
|
185 |
.name = "mount_tag", |
|
186 |
.type = QEMU_OPT_STRING, |
|
187 |
}, |
|
188 |
|
|
189 |
{ /*End of list */ } |
|
190 |
}, |
|
191 |
}; |
|
192 |
#endif |
|
193 |
|
|
172 | 194 |
QemuOptsList qemu_device_opts = { |
173 | 195 |
.name = "device", |
174 | 196 |
.implied_opt_name = "driver", |
b/qemu-config.h | ||
---|---|---|
5 | 5 |
extern QemuOptsList qemu_chardev_opts; |
6 | 6 |
#ifdef CONFIG_LINUX |
7 | 7 |
extern QemuOptsList qemu_fsdev_opts; |
8 |
extern QemuOptsList qemu_virtfs_opts; |
|
8 | 9 |
#endif |
9 | 10 |
extern QemuOptsList qemu_device_opts; |
10 | 11 |
extern QemuOptsList qemu_netdev_opts; |
b/qemu-options.hx | ||
---|---|---|
510 | 510 |
ETEXI |
511 | 511 |
#endif |
512 | 512 |
|
513 |
#ifdef CONFIG_LINUX |
|
514 |
DEFHEADING(Virtual File system pass-through options:) |
|
515 |
|
|
516 |
DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs, |
|
517 |
"-virtfs local,path=path,mount_tag=tag\n", |
|
518 |
QEMU_ARCH_ALL) |
|
519 |
|
|
520 |
STEXI |
|
521 |
|
|
522 |
The general form of a Virtual File system pass-through option is: |
|
523 |
@table @option |
|
524 |
|
|
525 |
@item -virtfs @var{fstype} [,@var{options}] |
|
526 |
@findex -virtfs |
|
527 |
Fstype is one of: |
|
528 |
@option{local}, |
|
529 |
The specific Fstype will determine the applicable options. |
|
530 |
|
|
531 |
Options to each backend are described below. |
|
532 |
|
|
533 |
@item -virtfs local ,path=@var{path} ,mount_tag=@var{mount_tag} |
|
534 |
|
|
535 |
Create a Virtual file-system-pass through for local-filesystem. |
|
536 |
|
|
537 |
@option{local} is only available on Linux. |
|
538 |
|
|
539 |
@option{path} specifies the path to be exported. @option{path} is required. |
|
540 |
|
|
541 |
@option{mount_tag} specifies the tag with which the exported file is mounted. |
|
542 |
@option{mount_tag} is required. |
|
543 |
|
|
544 |
@end table |
|
545 |
ETEXI |
|
546 |
#endif |
|
547 |
|
|
513 | 548 |
DEFHEADING() |
514 | 549 |
|
515 | 550 |
DEF("name", HAS_ARG, QEMU_OPTION_name, |
b/vl.c | ||
---|---|---|
3102 | 3102 |
exit(1); |
3103 | 3103 |
} |
3104 | 3104 |
break; |
3105 |
case QEMU_OPTION_virtfs: { |
|
3106 |
char *arg_fsdev = NULL; |
|
3107 |
char *arg_9p = NULL; |
|
3108 |
int len = 0; |
|
3109 |
|
|
3110 |
opts = qemu_opts_parse(&qemu_virtfs_opts, optarg, 1); |
|
3111 |
if (!opts) { |
|
3112 |
fprintf(stderr, "parse error: %s\n", optarg); |
|
3113 |
exit(1); |
|
3114 |
} |
|
3115 |
|
|
3116 |
len = strlen(",id=,path="); |
|
3117 |
len += strlen(qemu_opt_get(opts, "fstype")); |
|
3118 |
len += strlen(qemu_opt_get(opts, "mount_tag")); |
|
3119 |
len += strlen(qemu_opt_get(opts, "path")); |
|
3120 |
arg_fsdev = qemu_malloc((len + 1) * sizeof(*arg_fsdev)); |
|
3121 |
|
|
3122 |
if (!arg_fsdev) { |
|
3123 |
fprintf(stderr, "No memory to parse -fsdev for %s\n", |
|
3124 |
optarg); |
|
3125 |
exit(1); |
|
3126 |
} |
|
3127 |
|
|
3128 |
sprintf(arg_fsdev, "%s,id=%s,path=%s", |
|
3129 |
qemu_opt_get(opts, "fstype"), |
|
3130 |
qemu_opt_get(opts, "mount_tag"), |
|
3131 |
qemu_opt_get(opts, "path")); |
|
3132 |
|
|
3133 |
len = strlen("virtio-9p-pci,fsdev=,mount_tag="); |
|
3134 |
len += 2*strlen(qemu_opt_get(opts, "mount_tag")); |
|
3135 |
arg_9p = qemu_malloc((len + 1) * sizeof(*arg_9p)); |
|
3136 |
|
|
3137 |
if (!arg_9p) { |
|
3138 |
fprintf(stderr, "No memory to parse -device for %s\n", |
|
3139 |
optarg); |
|
3140 |
exit(1); |
|
3141 |
} |
|
3142 |
|
|
3143 |
sprintf(arg_9p, "virtio-9p-pci,fsdev=%s,mount_tag=%s", |
|
3144 |
qemu_opt_get(opts, "mount_tag"), |
|
3145 |
qemu_opt_get(opts, "mount_tag")); |
|
3146 |
|
|
3147 |
if (!qemu_opts_parse(&qemu_fsdev_opts, arg_fsdev, 1)) { |
|
3148 |
fprintf(stderr, "parse error [fsdev]: %s\n", optarg); |
|
3149 |
exit(1); |
|
3150 |
} |
|
3151 |
|
|
3152 |
if (!qemu_opts_parse(&qemu_device_opts, arg_9p, 1)) { |
|
3153 |
fprintf(stderr, "parse error [device]: %s\n", optarg); |
|
3154 |
exit(1); |
|
3155 |
} |
|
3156 |
|
|
3157 |
qemu_free(arg_fsdev); |
|
3158 |
qemu_free(arg_9p); |
|
3159 |
break; |
|
3160 |
} |
|
3105 | 3161 |
#endif |
3106 | 3162 |
case QEMU_OPTION_serial: |
3107 | 3163 |
add_device_config(DEV_SERIAL, optarg); |
Also available in: Unified diff