UML - slirp and slip driver cleanups and fixes
PATCH 4/4 UML - slirp and slip driver cleanups and fixes
This patch merges a lot of duplicated code in the slip and slirp drivers, abstracts out the slip protocol, and makes the slip driver work in 2.6.
arch/um/drivers/Makefile +3 -3
@@ -22,8 +22,8 @@ obj-y := stdio_console.o fd.o chan_kern. obj-$(CONFIG_SSL) += ssl.o obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o -obj-$(CONFIG_UML_NET_SLIP) += slip.o -obj-$(CONFIG_UML_NET_SLIRP) += slirp.o +obj-$(CONFIG_UML_NET_SLIP) += slip.o slip_common.o +obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o obj-$(CONFIG_UML_NET_DAEMON) += daemon.o obj-$(CONFIG_UML_NET_MCAST) += mcast.o #obj-$(CONFIG_UML_NET_PCAP) += pcap.o $(PCAP)
@@ -41,6 +41,6 @@ obj-$(CONFIG_UML_WATCHDOG) += harddog.o obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o obj-$(CONFIG_UML_RANDOM) += random.o -USER_OBJS := fd.o null.o pty.o tty.o xterm.o +USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o include arch/um/scripts/Makefile.rules
arch/um/drivers/slip.h +2 -21
@@ -1,10 +1,7 @@ #ifndef __UM_SLIP_H #define __UM_SLIP_H -#define BUF_SIZE 1500 - /* two bytes each for a (pathological) max packet of escaped chars + * - * terminating END char + initial END char */ -#define ENC_BUF_SIZE (2 * BUF_SIZE + 2) +#include "slip_common.h" struct slip_data { void *dev;
@@ -12,28 +9,12 @@ struct slip_data {char *addr;char *gate_addr;int slave; -unsigned char ibuf[ENC_BUF_SIZE ]; -unsigned char obuf[ENC_BUF_SIZE ]; -int more;/* more data: do not read fd until ibuf has been drained */ -int pos; - int esc; + struct slip_proto slip; };extern struct net_user_info slip_user_info; -extern int set_umn_addr (int fd,char *addr,char *ptp_addr);extern int slip_user_read (int fd,void *buf,int len,struct slip_data *pri);extern int slip_user_write (int fd,void *buf,int len,struct slip_data *pri);#endif - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/drivers/slip_common.c +54 -0
54 lines not on this page · raw message
arch/um/drivers/slip_common.h +104 -0
104 lines not on this page · raw message
arch/um/drivers/slip_kern.c +6 -6
@@ -26,16 +26,16 @@ void slip_init(struct net_device *dev, v .addr = NULL, .gate_addr = init->gate_addr, .slave = -1, - .ibuf = { '\0' }, - .obuf = { '\0' }, - .pos = 0, - .esc = 0, + .slip = SLIP_PROTO_INIT, .dev = dev }); dev->init =NULL ; + dev->header_cache_update =NULL ; + dev->hard_header_cache =NULL ; + dev->hard_header =NULL ; dev->hard_header_len =0 ; - dev->addr_len =4 ; - dev->type =ARPHRD_ETHER ; + dev->addr_len =0 ; + dev->type =ARPHRD_SLIP ; dev->tx_queue_len =256 ; dev->flags =IFF_NOARP ;printk ("SLIP backend - SLIP IP = %s\n" , spri->gate_addr);
arch/um/drivers/slip_proto.h +0 -94
94 lines not on this page · raw message
arch/um/drivers/slip_user.c +64 -90
217 lines not on this page · raw message
arch/um/drivers/slirp.h +4 -22
@@ -1,10 +1,7 @@#ifndef __UM_SLIRP_H#define __UM_SLIRP_H -#define BUF_SIZE 1500 -/* two bytes each for a (pathological) max packet of escaped chars + * -* terminating END char + initial END char */ -#define ENC_BUF_SIZE (2 * BUF_SIZE + 2) +#include "slip_common.h" #define SLIRP_MAX_ARGS 100/*
@@ -24,28 +21,13 @@ struct slirp_data {struct arg_list_dummy_wrapper argw;int pid;int slave; -unsigned char ibuf[ENC_BUF_SIZE ]; -unsigned char obuf[ENC_BUF_SIZE ]; -int more;/* more data: do not read fd until ibuf has been drained */ -int pos; - int esc; + struct slip_proto slip; };extern struct net_user_info slirp_user_info; -extern int set_umn_addr (int fd,char *addr,char *ptp_addr);extern int slirp_user_read (int fd,void *buf,int len,struct slirp_data *pri); -extern int slirp_user_write (int fd,void *buf,int len,struct slirp_data *pri); +extern int slirp_user_write (int fd,void *buf,int len, +struct slirp_data *pri);#endif - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/drivers/slirp_kern.c +1 -4
@@ -25,10 +25,7 @@ void slirp_init(struct net_device *dev, { .argw = init->argw, .pid = -1, .slave = -1, - .ibuf = { '\0' }, - .obuf = { '\0' }, - .pos = 0, - .esc = 0, + .slip = SLIP_PROTO_INIT, .dev = dev }); dev->init =NULL ;
arch/um/drivers/slirp_user.c +20 -82
136 lines not on this page · raw message
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel