Move net code from vl.c to net.c
PATCH 1/1 Move net code from vl.c to net.c
I noticed a big chunk of vl.c is simply dealing with networking so this patch moves that code into its own file, net.c. This reduces the size of vl.c from about 9k to 8k LOCs. It's mostly straight copy/paste. A few functions had to be exported. If you look at the diffs for sysemu.h and net.h, you'll see which functions are being exported.
Signed-off-by Anthony Liguori <[email protected]>
Makefile.target +1 -1
@@ -481,7 +481,7 @@ endif #CONFIG_DARWIN_USER # System emulator target ifndef CONFIG_USER_ONLY -OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o +OBJS=vl.o net.o osdep.o monitor.o pci.o loader.o isa_mmio.o ifdef CONFIG_WIN32 OBJS+=block-raw-win32.o else
net.c new file +1342 -0
1,342 lines not on this page · raw message
net.h +19 -0
@@ -1,6 +1,11 @@#ifndef QEMU_NET_H #define QEMU_NET_H +#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" +#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" + +#include "qemu_socket.h" +/* VLANs support */ typedef struct VLANClientState VLANClientState ;
@@ -47,4 +52,18 @@ struct NICInfo {extern int nb_nics;extern NICInfo nd_table[MAX_NICS ]; +int net_client_init (const char *str); + +#ifdef CONFIG_SLIRP +extern int slirp_inited; +#endif + +void net_slirp_smb (const char *exported_dir); +void net_slirp_redir (const char *redir_str); + +int parse_host_port (struct sockaddr_in *saddr,const char *str); + +void check_vlans (void ); +void close_vlans (void ); +#endif
sysemu.h +6 -0
@@ -108,6 +108,10 @@ extern const char *prom_envs[MAX_PROM_ENVS];extern unsigned int nb_prom_envs;#endif +int get_param_value (char *buf,int buf_size,const char *tag,const char *str); +int check_params (char *buf,int buf_size,char **params,const char *str); +int get_str_sep (char *buf,int buf_size,const char **pp,int sep); +/* XXX: make it dynamic */ #define MAX_BIOS_SIZE (4 * 1024 * 1024)#if defined (TARGET_PPC )
@@ -180,4 +184,6 @@ void do_usb_add(const char *devname);void do_usb_del (const char *devname);void usb_info (void ); +int send_all (int fd,const uint8_t *buf,int len1); +#endif
vl.c +8 -1248
1,334 lines not on this page · raw message