Skip to content

Commit

Permalink
net: consolidate NetClientState header files into one
Browse files Browse the repository at this point in the history
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 <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
  • Loading branch information
bonzini authored and stefanhaRH committed Oct 8, 2012
1 parent 9899148 commit a245fc1
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 99 deletions.
11 changes: 4 additions & 7 deletions net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
28 changes: 25 additions & 3 deletions net/socket.h → net/clients.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion net/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/

#include "dump.h"
#include "clients.h"
#include "qemu-common.h"
#include "qemu-error.h"
#include "qemu-log.h"
Expand Down
33 changes: 0 additions & 33 deletions net/dump.h

This file was deleted.

1 change: 1 addition & 0 deletions net/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "monitor.h"
#include "net.h"
#include "clients.h"
#include "hub.h"
#include "iov.h"

Expand Down
2 changes: 0 additions & 2 deletions net/hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion net/slirp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions net/slirp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion net/tap-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion net/tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* THE SOFTWARE.
*/

#include "net/tap.h"
#include "tap.h"

#include "config-host.h"

Expand All @@ -34,6 +34,7 @@
#include <net/if.h>

#include "net.h"
#include "clients.h"
#include "monitor.h"
#include "sysemu.h"
#include "qemu-char.h"
Expand Down
6 changes: 0 additions & 6 deletions net/tap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
3 changes: 1 addition & 2 deletions net/vde.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 0 additions & 37 deletions net/vde.h

This file was deleted.

0 comments on commit a245fc1

Please sign in to comment.