qemu-nbd: use no_argument/required_argument constants

When declaring the 'struct option' array, use the standard
constants no_argument/required_argument, instead of magic
values 0 and 1.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Daniel P. Berrange 2016-02-17 10:10:22 +00:00 committed by Kevin Wolf
parent fa8b7ce2c6
commit aa6e546c5a

View File

@ -463,31 +463,32 @@ int main(int argc, char **argv)
const char *sn_id_or_name = NULL; const char *sn_id_or_name = NULL;
const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:"; const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:";
struct option lopt[] = { struct option lopt[] = {
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{ "bind", 1, NULL, 'b' }, { "bind", required_argument, NULL, 'b' },
{ "port", 1, NULL, 'p' }, { "port", required_argument, NULL, 'p' },
{ "socket", 1, NULL, 'k' }, { "socket", required_argument, NULL, 'k' },
{ "offset", 1, NULL, 'o' }, { "offset", required_argument, NULL, 'o' },
{ "read-only", 0, NULL, 'r' }, { "read-only", no_argument, NULL, 'r' },
{ "partition", 1, NULL, 'P' }, { "partition", required_argument, NULL, 'P' },
{ "connect", 1, NULL, 'c' }, { "connect", required_argument, NULL, 'c' },
{ "disconnect", 0, NULL, 'd' }, { "disconnect", no_argument, NULL, 'd' },
{ "snapshot", 0, NULL, 's' }, { "snapshot", no_argument, NULL, 's' },
{ "load-snapshot", 1, NULL, 'l' }, { "load-snapshot", required_argument, NULL, 'l' },
{ "nocache", 0, NULL, 'n' }, { "nocache", no_argument, NULL, 'n' },
{ "cache", 1, NULL, QEMU_NBD_OPT_CACHE }, { "cache", required_argument, NULL, QEMU_NBD_OPT_CACHE },
{ "aio", 1, NULL, QEMU_NBD_OPT_AIO }, { "aio", required_argument, NULL, QEMU_NBD_OPT_AIO },
{ "discard", 1, NULL, QEMU_NBD_OPT_DISCARD }, { "discard", required_argument, NULL, QEMU_NBD_OPT_DISCARD },
{ "detect-zeroes", 1, NULL, QEMU_NBD_OPT_DETECT_ZEROES }, { "detect-zeroes", required_argument, NULL,
{ "shared", 1, NULL, 'e' }, QEMU_NBD_OPT_DETECT_ZEROES },
{ "format", 1, NULL, 'f' }, { "shared", required_argument, NULL, 'e' },
{ "persistent", 0, NULL, 't' }, { "format", required_argument, NULL, 'f' },
{ "verbose", 0, NULL, 'v' }, { "persistent", no_argument, NULL, 't' },
{ "object", 1, NULL, QEMU_NBD_OPT_OBJECT }, { "verbose", no_argument, NULL, 'v' },
{ "export-name", 1, NULL, 'x' }, { "object", required_argument, NULL, QEMU_NBD_OPT_OBJECT },
{ "tls-creds", 1, NULL, QEMU_NBD_OPT_TLSCREDS }, { "export-name", required_argument, NULL, 'x' },
{ "image-opts", 0, NULL, QEMU_NBD_OPT_IMAGE_OPTS }, { "tls-creds", required_argument, NULL, QEMU_NBD_OPT_TLSCREDS },
{ "image-opts", no_argument, NULL, QEMU_NBD_OPT_IMAGE_OPTS },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
int ch; int ch;