From 3c1fa35d74aabe9c3ab642d2591b087e53d7a616 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 15 Dec 2018 07:53:08 -0600 Subject: qemu-nbd: Fail earlier for -c/-d on non-linux Connecting to a /dev/nbdN device is a Linux-specific action. We were already masking -c and -d from 'qemu-nbd --help' on non-linux. However, while -d fails with a sensible error message, it took hunting through a couple of files to prove that. What's more, the code for -c doesn't fail until after it has created a pthread and tried to open a device - possibly even printing an error message with %m on a non-Linux platform in spite of the comment that %m is glibc-specific. Make the failure happen sooner, then get rid of stubs that are no longer needed because of the early exits. While at it: tweak the blank newlines in --help output to be consistent, whether or not built on Linux. Signed-off-by: Eric Blake Message-Id: <20181215135324.152629-7-eblake@redhat.com> Reviewed-by: Richard W.M. Jones Reviewed-by: Vladimir Sementsov-Ogievskiy --- nbd/client.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'nbd') diff --git a/nbd/client.c b/nbd/client.c index e77414711b..5a03a84418 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -1031,23 +1031,7 @@ int nbd_disconnect(int fd) return 0; } -#else -int nbd_init(int fd, QIOChannelSocket *ioc, NBDExportInfo *info, - Error **errp) -{ - error_setg(errp, "nbd_init is only supported on Linux"); - return -ENOTSUP; -} - -int nbd_client(int fd) -{ - return -ENOTSUP; -} -int nbd_disconnect(int fd) -{ - return -ENOTSUP; -} -#endif +#endif /* __linux__ */ int nbd_send_request(QIOChannel *ioc, NBDRequest *request) { -- cgit v1.2.3-70-g09d2