+ optarg = (char *) "none";
+ /* fallthrough */
+ case QEMU_NBD_OPT_CACHE:
+ if (seen_cache) {
+ errx(EXIT_FAILURE, "-n and --cache can only be specified once");
+ }
+ seen_cache = true;
+ if (bdrv_parse_cache_flags(optarg, &flags) == -1) {
+ errx(EXIT_FAILURE, "Invalid cache mode `%s'", optarg);
+ }
+ break;
+#ifdef CONFIG_LINUX_AIO
+ case QEMU_NBD_OPT_AIO:
+ if (seen_aio) {
+ errx(EXIT_FAILURE, "--aio can only be specified once");
+ }
+ seen_aio = true;
+ if (!strcmp(optarg, "native")) {
+ flags |= BDRV_O_NATIVE_AIO;
+ } else if (!strcmp(optarg, "threads")) {
+ /* this is the default */
+ } else {
+ errx(EXIT_FAILURE, "invalid aio mode `%s'", optarg);
+ }
+ break;
+#endif
+ case QEMU_NBD_OPT_DISCARD:
+ if (seen_discard) {
+ errx(EXIT_FAILURE, "--discard can only be specified once");
+ }
+ seen_discard = true;
+ if (bdrv_parse_discard_flags(optarg, &flags) == -1) {
+ errx(EXIT_FAILURE, "Invalid discard mode `%s'", optarg);
+ }