From patchwork Tue Sep 21 15:21:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 65322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 68F22B70CB for ; Wed, 22 Sep 2010 01:41:18 +1000 (EST) Received: from localhost ([127.0.0.1]:40937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy4wn-0008EQ-A7 for incoming@patchwork.ozlabs.org; Tue, 21 Sep 2010 11:39:57 -0400 Received: from [140.186.70.92] (port=49512 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy4fR-0008Qr-Pk for qemu-devel@nongnu.org; Tue, 21 Sep 2010 11:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy4fL-0005qb-2Z for qemu-devel@nongnu.org; Tue, 21 Sep 2010 11:21:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1027) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy4fK-0005qS-MT for qemu-devel@nongnu.org; Tue, 21 Sep 2010 11:21:55 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8LFLqcS023407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Sep 2010 11:21:53 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8LFLZnj016774; Tue, 21 Sep 2010 11:21:45 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Tue, 21 Sep 2010 17:21:49 +0200 Message-Id: <1285082522-24407-8-git-send-email-kwolf@redhat.com> In-Reply-To: <1285082522-24407-1-git-send-email-kwolf@redhat.com> References: <1285082522-24407-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 07/20] nbd: correctly manage default port X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laurent Vivier block/nbd.c: use default port number when none is specified qemu-nbd.c: use IANA-assigned port number: 10809 Signed-off-by: Laurent Vivier Signed-off-by: Kevin Wolf --- block/nbd.c | 2 -- qemu-nbd.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index 5e9d6cb..c8dc763 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -95,8 +95,6 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags) if (r == p) { goto out; } - } else if (name == NULL) { - goto out; } sock = tcp_socket_outgoing(hostname, port); diff --git a/qemu-nbd.c b/qemu-nbd.c index 923a3bf..99f1d22 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -44,7 +44,7 @@ static void usage(const char *name) "Usage: %s [OPTIONS] FILE\n" "QEMU Disk Network Block Device Server\n" "\n" -" -p, --port=PORT port to listen on (default `1024')\n" +" -p, --port=PORT port to listen on (default `%d')\n" " -o, --offset=OFFSET offset into the image\n" " -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n" " -k, --socket=PATH path to the unix socket\n" @@ -62,7 +62,7 @@ static void usage(const char *name) " -V, --version output version information and exit\n" "\n" "Report bugs to \n" - , name, "DEVICE"); + , name, NBD_DEFAULT_PORT, "DEVICE"); } static void version(const char *name) @@ -188,7 +188,7 @@ int main(int argc, char **argv) bool readonly = false; bool disconnect = false; const char *bindto = "0.0.0.0"; - int port = 1024; + int port = NBD_DEFAULT_PORT; struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); off_t fd_size;