From patchwork Mon Sep 17 16:43:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 184491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 828C22C0086 for ; Tue, 18 Sep 2012 02:44:25 +1000 (EST) Received: from localhost ([::1]:40930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDeQo-0001j0-RG for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2012 12:44:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDeQb-0001hi-Fd for qemu-devel@nongnu.org; Mon, 17 Sep 2012 12:44:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDeQU-0007am-Qs for qemu-devel@nongnu.org; Mon, 17 Sep 2012 12:44:09 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:55417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDeQU-0007aJ-Hu for qemu-devel@nongnu.org; Mon, 17 Sep 2012 12:44:02 -0400 Received: by dadn15 with SMTP id n15so292478dad.4 for ; Mon, 17 Sep 2012 09:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=mL5E/tHYMYoygTgMcn7fQ5SafoyTAlNJZTpy/tqfftk=; b=nAqyAdqsxbNqhFxKo6LfbrZLbv0EM4hTIRpJVL4y1wAoulnsbdHeyrXgSYtfE6HoxM 801HrQRiilQzV+Fp2gD8Up4h7lGo6IsHfOIDmHG2YLRu8sEig1zvGMBsL4QvnGvraCwO jgbmm9ct6+bsYWthI+lCn8AxD/nU6L1PkQbKkrVz4Afe55s7dWNGdYOLfUWek+5gRalz lv+9m2aqVT5qcPdVu2MOQd+7pq+qG2CjBQ7BKxKqgfs2rl0NyHaCBNv3DhLdYRvi+lQG KDlnibNwoi7MjyjS9/tLaKDhKpgetWLUmNAf4yUO3qZq3YWTH4VZuj9zO3h0u0J6wRnA 6Xug== Received: by 10.66.88.40 with SMTP id bd8mr21055906pab.36.1347900241318; Mon, 17 Sep 2012 09:44:01 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id qo8sm7204421pbb.19.2012.09.17.09.43.58 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 09:43:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2012 18:43:51 +0200 Message-Id: <1347900231-24086-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.45 Cc: stefanha@gmail.com Subject: [Qemu-devel] [PATCH] net: consolidate NetClientState header files into one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch doesn't seem much useful alone, I must admit. However, it makes sense as part of the upcoming directory reorganization, where I want to have include/net/tap.h as the net<->hw interface for tap. Then having both net/tap.h and include/net/tap.h does not work. "Fixed" by moving all the init functions to a single header file net/clients.h. The patch also adopts a uniform style for including net/*.h files from net/*.c, without the net/ path. Signed-off-by: Paolo Bonzini --- net.c | 11 ++++------- net/{socket.h => clients.h} | 28 +++++++++++++++++++++++++--- net/dump.c | 2 +- net/dump.h | 33 --------------------------------- net/hub.c | 1 + net/hub.h | 2 -- net/slirp.c | 3 ++- net/slirp.h | 3 --- net/socket.c | 3 +-- net/tap-win32.c | 2 +- net/tap.c | 3 ++- net/tap.h | 6 ------ net/vde.c | 3 +-- net/vde.h | 37 ------------------------------------- 14 file modificati, 38 inserzioni(+), 99 rimozioni(-) rename net/{socket.h => clients.h} (62%) delete mode 100644 net/dump.h delete mode 100644 net/vde.h diff --git a/net.c b/net.c index e5d25d4..6881beb 100644 --- a/net.c +++ b/net.c @@ -21,17 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "net.h" - #include "config-host.h" -#include "net/tap.h" -#include "net/socket.h" -#include "net/dump.h" -#include "net/slirp.h" -#include "net/vde.h" +#include "net.h" +#include "net/clients.h" #include "net/hub.h" +#include "net/slirp.h" #include "net/util.h" + #include "monitor.h" #include "qemu-common.h" #include "qemu_socket.h" diff --git a/net/socket.h b/net/clients.h similarity index 62% rename from net/socket.h rename to net/clients.h index 3f8a092..c58cc60 100644 --- a/net/socket.h +++ b/net/clients.h @@ -21,13 +21,35 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#ifndef QEMU_NET_SOCKET_H -#define QEMU_NET_SOCKET_H +#ifndef QEMU_NET_CLIENTS_H +#define QEMU_NET_CLIENTS_H #include "net.h" #include "qapi-types.h" +int net_init_dump(const NetClientOptions *opts, const char *name, + NetClientState *peer); + +#ifdef CONFIG_SLIRP +int net_init_slirp(const NetClientOptions *opts, const char *name, + NetClientState *peer); +#endif + +int net_init_hubport(const NetClientOptions *opts, const char *name, + NetClientState *peer); + int net_init_socket(const NetClientOptions *opts, const char *name, NetClientState *peer); -#endif /* QEMU_NET_SOCKET_H */ +int net_init_tap(const NetClientOptions *opts, const char *name, + NetClientState *peer); + +int net_init_bridge(const NetClientOptions *opts, const char *name, + NetClientState *peer); + +#ifdef CONFIG_VDE +int net_init_vde(const NetClientOptions *opts, const char *name, + NetClientState *peer); +#endif + +#endif /* QEMU_NET_CLIENTS_H */ diff --git a/net/dump.c b/net/dump.c index 004231d..e0a5d74 100644 --- a/net/dump.c +++ b/net/dump.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include "dump.h" +#include "clients.h" #include "qemu-common.h" #include "qemu-error.h" #include "qemu-log.h" diff --git a/net/dump.h b/net/dump.h deleted file mode 100644 index 33f152b..0000000 --- a/net/dump.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_NET_DUMP_H -#define QEMU_NET_DUMP_H - -#include "net.h" -#include "qapi-types.h" - -int net_init_dump(const NetClientOptions *opts, const char *name, - NetClientState *peer); - -#endif /* QEMU_NET_DUMP_H */ diff --git a/net/hub.c b/net/hub.c index ac157e3..872cf28 100644 --- a/net/hub.c +++ b/net/hub.c @@ -14,6 +14,7 @@ #include "monitor.h" #include "net.h" +#include "clients.h" #include "hub.h" #include "iov.h" diff --git a/net/hub.h b/net/hub.h index 26a1ade..4cbfdb1 100644 --- a/net/hub.h +++ b/net/hub.h @@ -17,8 +17,6 @@ #include "qemu-common.h" -int net_init_hubport(const NetClientOptions *opts, const char *name, - NetClientState *peer); NetClientState *net_hub_add_port(int hub_id, const char *name); NetClientState *net_hub_find_client_by_name(int hub_id, const char *name); void net_hub_info(Monitor *mon); diff --git a/net/slirp.c b/net/slirp.c index 8db66ea..bf86a44 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -30,7 +30,8 @@ #include #endif #include "net.h" -#include "net/hub.h" +#include "clients.h" +#include "hub.h" #include "monitor.h" #include "qemu_socket.h" #include "slirp/libslirp.h" diff --git a/net/slirp.h b/net/slirp.h index 5f685c4..2ca09b6 100644 --- a/net/slirp.h +++ b/net/slirp.h @@ -31,9 +31,6 @@ #ifdef CONFIG_SLIRP -int net_init_slirp(const NetClientOptions *opts, const char *name, - NetClientState *peer); - void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict); void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict); diff --git a/net/socket.c b/net/socket.c index 7c602e4..d424199 100644 --- a/net/socket.c +++ b/net/socket.c @@ -21,11 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "net/socket.h" - #include "config-host.h" #include "net.h" +#include "clients.h" #include "monitor.h" #include "qemu-char.h" #include "qemu-common.h" diff --git a/net/tap-win32.c b/net/tap-win32.c index c0ea954..f1801e2 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -26,7 +26,7 @@ * distribution); if not, see . */ -#include "net/tap.h" +#include "tap.h" #include "qemu-common.h" #include "net.h" diff --git a/net/tap.c b/net/tap.c index a88ae8f..df89caa 100644 --- a/net/tap.c +++ b/net/tap.c @@ -23,7 +23,7 @@ * THE SOFTWARE. */ -#include "net/tap.h" +#include "tap.h" #include "config-host.h" @@ -34,6 +34,7 @@ #include #include "net.h" +#include "clients.h" #include "monitor.h" #include "sysemu.h" #include "qemu-char.h" diff --git a/net/tap.h b/net/tap.h index 0fb018c..d44d83a 100644 --- a/net/tap.h +++ b/net/tap.h @@ -32,9 +32,6 @@ #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" -int net_init_tap(const NetClientOptions *opts, const char *name, - NetClientState *peer); - int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required); ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen); @@ -58,7 +55,4 @@ int tap_get_fd(NetClientState *nc); struct vhost_net; struct vhost_net *tap_get_vhost_net(NetClientState *nc); -int net_init_bridge(const NetClientOptions *opts, const char *name, - NetClientState *peer); - #endif /* QEMU_NET_TAP_H */ diff --git a/net/vde.c b/net/vde.c index b91a6c7..275bda9 100644 --- a/net/vde.c +++ b/net/vde.c @@ -21,13 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "net/vde.h" - #include "config-host.h" #include #include "net.h" +#include "clients.h" #include "qemu-char.h" #include "qemu-common.h" #include "qemu-option.h" diff --git a/net/vde.h b/net/vde.h deleted file mode 100644 index 6ce6698..0000000 --- a/net/vde.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_NET_VDE_H -#define QEMU_NET_VDE_H - -#include "qemu-common.h" -#include "qapi-types.h" - -#ifdef CONFIG_VDE - -int net_init_vde(const NetClientOptions *opts, const char *name, - NetClientState *peer); - -#endif /* CONFIG_VDE */ - -#endif /* QEMU_NET_VDE_H */