Lines Matching +full:- +full:- +full:disable +full:- +full:linux +full:- +full:aio
24 #include "qemu/help-texts.h"
27 #include "system/block-backend.h"
31 #include "qemu/main-loop.h"
34 #include "qemu/error-report.h"
35 #include "qemu/config-file.h"
43 #include "io/channel-socket.h"
44 #include "io/net-listener.h"
48 #include "qemu-version.h"
60 #define SOCKET_PATH "/var/lock/qemu-nbd-%s"
90 " or: %s -L [OPTIONS]\n" in usage()
93 " -h, --help display this help and exit\n" in usage()
94 " -V, --version output version information and exit\n" in usage()
97 " -p, --port=PORT port to listen on (default `%d')\n" in usage()
98 " -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n" in usage()
99 " -k, --socket=PATH path to the unix socket\n" in usage()
101 " -e, --shared=NUM device can be shared by NUM clients (default '1')\n" in usage()
102 " -t, --persistent don't exit on the last connection\n" in usage()
103 " -v, --verbose display extra debugging information\n" in usage()
104 " -x, --export-name=NAME expose export by name (default is empty string)\n" in usage()
105 " -D, --description=TEXT export a human-readable description\n" in usage()
106 " --handshake-limit=N limit client's handshake to N seconds (default 10)\n" in usage()
109 " -o, --offset=OFFSET offset into the image\n" in usage()
110 " -A, --allocation-depth expose the allocation depth\n" in usage()
111 " -B, --bitmap=NAME expose a persistent dirty bitmap\n" in usage()
114 " -L, --list list exports available from another NBD server\n" in usage()
115 " --object type,id=ID,... define an object such as 'secret' for providing\n" in usage()
117 " --tls-creds=ID use id of an earlier --object to provide TLS\n" in usage()
118 " --tls-authz=ID use id of an earlier --object to provide\n" in usage()
120 " --tls-hostname=HOSTNAME override hostname used to check x509 certificate\n" in usage()
121 " -T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" in usage()
123 " --fork fork off the server process and exit the parent\n" in usage()
125 " --pid-file=PATH store the server's process ID in the given file\n" in usage()
127 " --selinux-label=LABEL set SELinux process label on listening socket\n" in usage()
132 " -c, --connect=DEV connect FILE to the local NBD device DEV\n" in usage()
133 " -d, --disconnect disconnect the specified device\n" in usage()
137 " -f, --format=FORMAT set image format (raw, qcow2, ...)\n" in usage()
138 " -r, --read-only export read-only\n" in usage()
139 " -s, --snapshot use FILE as an external snapshot, create a temporary\n" in usage()
142 " -l, --load-snapshot=SNAPSHOT_PARAM\n" in usage()
144 " as an read-only device, SNAPSHOT_PARAM format is\n" in usage()
147 " -n, --nocache disable host cache\n" in usage()
148 " --cache=MODE set cache mode used to access the disk image, the\n" in usage()
151 " --aio=MODE set AIO mode (native, io_uring or threads)\n" in usage()
152 " --discard=MODE set discard mode (ignore, unmap)\n" in usage()
153 " --detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)\n" in usage()
154 " --image-opts treat FILE as a full set of image options\n" in usage()
175 * handler ensures that "qemu-nbd -v -c" exits with a nice status code.
225 [NBD_FLAG_SEND_FAST_ZERO_BIT] = "fast-zero", in qemu_nbd_client_list()
226 [NBD_FLAG_BLOCK_STAT_PAYLOAD_BIT] = "block-status-payload", in qemu_nbd_client_list()
245 "64-bit" : "32-bit"); in qemu_nbd_client_list()
273 /* Close stderr so that the qemu-nbd process exits. */ in nbd_client_release_pipe()
280 error_report("Could not release qemu-nbd: %s", strerror(errno)); in nbd_client_release_pipe()
291 /* linux just needs an open() to trigger in show_parts()
310 int fd = -1; in nbd_client_thread()
317 opts->saddr, in nbd_client_thread()
331 fd = open(opts->device, O_RDWR); in nbd_client_thread()
333 /* Linux-only, we can use %m in printf. */ in nbd_client_thread()
334 error_report("Failed to open %s: %m", opts->device); in nbd_client_thread()
344 pthread_create(&show_parts_thread, NULL, show_parts, opts->device); in nbd_client_thread()
346 if (opts->verbose && !opts->fork_process) { in nbd_client_thread()
348 opts->device, opts->srcpath); in nbd_client_thread()
350 nbd_client_release_pipe(opts->old_stderr); in nbd_client_thread()
379 nb_fds--; in nbd_client_closed()
418 saddr->type = SOCKET_ADDRESS_TYPE_UNIX; in nbd_build_socket_address()
419 saddr->u.q_unix.path = g_strdup(sockpath); in nbd_build_socket_address()
422 saddr->type = SOCKET_ADDRESS_TYPE_INET; in nbd_build_socket_address()
423 inet = &saddr->u.inet; in nbd_build_socket_address()
424 inet->host = g_strdup(bindto); in nbd_build_socket_address()
426 inet->port = g_strdup(port); in nbd_build_socket_address()
428 inet->port = g_strdup_printf("%d", NBD_DEFAULT_PORT); in nbd_build_socket_address()
553 { "read-only", no_argument, NULL, 'r' }, in main()
554 { "allocation-depth", no_argument, NULL, 'A' }, in main()
560 { "load-snapshot", required_argument, NULL, 'l' }, in main()
563 { "aio", required_argument, NULL, QEMU_NBD_OPT_AIO }, in main()
565 { "detect-zeroes", required_argument, NULL, in main()
572 { "export-name", required_argument, NULL, 'x' }, in main()
574 { "handshake-limit", required_argument, NULL, in main()
576 { "tls-creds", required_argument, NULL, QEMU_NBD_OPT_TLSCREDS }, in main()
577 { "tls-hostname", required_argument, NULL, QEMU_NBD_OPT_TLSHOSTNAME }, in main()
578 { "tls-authz", required_argument, NULL, QEMU_NBD_OPT_TLSAUTHZ }, in main()
579 { "image-opts", no_argument, NULL, QEMU_NBD_OPT_IMAGE_OPTS }, in main()
582 { "pid-file", required_argument, NULL, QEMU_NBD_OPT_PID_FILE }, in main()
583 { "selinux-label", required_argument, NULL, in main()
636 while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { in main()
646 error_report("-n and --cache can only be specified once"); in main()
650 if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) == -1) { in main()
657 error_report("--aio can only be specified once"); in main()
662 error_report("Invalid aio mode '%s'", optarg); in main()
668 error_report("--discard can only be specified once"); in main()
672 if (bdrv_parse_discard_flags(optarg, &flags) == -1) { in main()
690 error_report("setting detect-zeroes to unmap is not allowed " in main()
790 error_report("Try `%s --help' for more information.", argv[0]); in main()
840 error_report("List mode is incompatible with per-device settings"); in main()
847 } else if ((argc - optind) != 1) { in main()
849 error_printf("Try `%s --help' for more information.\n", argv[0]); in main()
863 /* Using socket activation - check user didn't use -p etc. */ in main()
874 /* qemu-nbd can only listen on a single socket. */ in main()
876 error_report("qemu-nbd does not support socket activation with %s > 1", in main()
902 error_report("--tls-authz is not permitted without --tls-creds"); in main()
906 error_report("--tls-hostname is not permitted without --tls-creds"); in main()
914 error_report("--selinux-label is not permitted without --socket"); in main()
960 err->message); in main()
1049 * if we initialized pre-fork. in main()
1071 if (selinux_label && setsockcreatecon_raw(selinux_label) == -1) { in main()
1085 if (selinux_label && setsockcreatecon_raw(NULL) == -1) { in main()
1117 error_report("--image-opts and -f are mutually exclusive"); in main()
1146 qdict_put_str(raw_opts, "file", bs->node_name); in main()
1172 bs->detect_zeroes = detect_zeroes; in main()
1179 .id = g_strdup("qemu-nbd-export"), in main()