net: consolidate NetClientState header files into one
Subsystems (2)
PATCH 1/1 net: consolidate NetClientState header files into one
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.
---
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.hnet.c +4 -7
@@ -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"
net/clients.h renamed from net/socket.h +25 -3
@@ -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 */
net/dump.c +1 -1
@@ -22,7 +22,7 @@* THE SOFTWARE. */ -#include "dump.h" +#include "clients.h" #include "qemu-common.h" #include "qemu-error.h" #include "qemu-log.h"
net/dump.h deleted +0 -33
@@ -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 */
net/hub.c +1 -0
@@ -14,6 +14,7 @@#include "monitor.h" #include "net.h" +#include "clients.h" #include "hub.h" #include "iov.h"
net/hub.h +0 -2
@@ -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);
net/slirp.c +2 -1
@@ -30,7 +30,8 @@#include <sys/wait.h> #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"
net/slirp.h +0 -3
@@ -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);
net/socket.c +1 -2
@@ -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"
net/tap-win32.c +1 -1
@@ -26,7 +26,7 @@* distribution); if not, see <http://www.gnu.org/licenses/>. */ -#include "net/tap.h" +#include "tap.h" #include "qemu-common.h" #include "net.h"
net/tap.c +2 -1
@@ -23,7 +23,7 @@* THE SOFTWARE. */ -#include "net/tap.h" +#include "tap.h" #include "config-host.h"
@@ -34,6 +34,7 @@#include <net/if.h> #include "net.h" +#include "clients.h" #include "monitor.h" #include "sysemu.h" #include "qemu-char.h"
net/tap.h +0 -6
@@ -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 */
net/vde.c +1 -2
@@ -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 <libvdeplug.h> #include "net.h" +#include "clients.h" #include "qemu-char.h" #include "qemu-common.h" #include "qemu-option.h"
net/vde.h deleted +0 -37
@@ -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 */
Signature · 1 line
1.7.12
Il 17/09/2012 18:43, Paolo Bonzini ha scritto:
Quoted 11 lines
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.has the net<->hw interface for tap. Then having bothnet/tap.handinclude/net/tap.hdoes not work. "Fixed" by moving all the init functions to a single header filenet/clients.h.The patch also adopts a uniform style for including
net/*.hfiles fromnet/*.c, without thenet/path.Signed-off-by Paolo Bonzini <[email protected]>
Ping.
Paolo
Quoted 333 lines
--- 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.hnet.c +4
-7@@ -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" net/clients.h renamed from net/socket.h +25
-3@@ -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 */ net/dump.c +1
-1@@ -22,7 +22,7 @@* THE SOFTWARE. */ -#include "dump.h" +#include "clients.h" #include "qemu-common.h" #include "qemu-error.h" #include "qemu-log.h" net/dump.h deleted +0
-33@@ -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 */ net/hub.c +1
-0@@ -14,6 +14,7 @@#include "monitor.h" #include "net.h" +#include "clients.h" #include "hub.h" #include "iov.h" net/hub.h +0
-2@@ -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);net/slirp.c +2
-1@@ -30,7 +30,8 @@#include <sys/wait.h> #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" net/slirp.h +0
-3@@ -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);net/socket.c +1
-2@@ -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" net/tap-win32.c +1
-1@@ -26,7 +26,7 @@* distribution); if not, see <http://www.gnu.org/licenses/>. */ -#include "net/tap.h" +#include "tap.h" #include "qemu-common.h" #include "net.h" net/tap.c +2
-1@@ -23,7 +23,7 @@* THE SOFTWARE. */ -#include "net/tap.h" +#include "tap.h" #include "config-host.h" @@ -34,6 +34,7 @@#include <net/if.h> #include "net.h" +#include "clients.h" #include "monitor.h" #include "sysemu.h" #include "qemu-char.h" net/tap.h +0
-6@@ -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 */ net/vde.c +1
-2@@ -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 <libvdeplug.h> #include "net.h" +#include "clients.h" #include "qemu-char.h" #include "qemu-common.h" #include "qemu-option.h" net/vde.h deleted +0
-37@@ -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 */
Stefan Hajnoczi
AppliedQuoted 22 lines · Paolo Bonzini
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.has the net<->hw interface for tap. Then having bothnet/tap.handinclude/net/tap.hdoes not work. "Fixed" by moving all the init functions to a single header filenet/clients.h.The patch also adopts a uniform style for including
net/*.hfiles fromnet/*.c, without thenet/path.Signed-off-by Paolo Bonzini <[email protected]>--- 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 +-
Quoted 8 lines
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.hThanks, applied!
http://github.com/stefanha/qemu/commits/net
Stefan