aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/slirp_kern.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/slirp_kern.c')
-rw-r--r--arch/um/drivers/slirp_kern.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index 0a0324a6d290..b208d5e4a405 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -1,11 +1,14 @@
1#include "linux/kernel.h" 1/*
2#include "linux/stddef.h" 2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL.
4 */
5
6#include <linux/if_arp.h>
3#include "linux/init.h" 7#include "linux/init.h"
4#include "linux/netdevice.h" 8#include <linux/netdevice.h>
5#include "linux/if_arp.h" 9#include <linux/string.h>
6#include "net_kern.h" 10#include "net_kern.h"
7#include "net_user.h" 11#include "net_user.h"
8#include "kern.h"
9#include "slirp.h" 12#include "slirp.h"
10 13
11struct slirp_init { 14struct slirp_init {
@@ -39,29 +42,28 @@ void slirp_init(struct net_device *dev, void *data)
39 dev->tx_queue_len = 256; 42 dev->tx_queue_len = 256;
40 dev->flags = IFF_NOARP; 43 dev->flags = IFF_NOARP;
41 printk("SLIRP backend - command line:"); 44 printk("SLIRP backend - command line:");
42 for(i=0;spri->argw.argv[i]!=NULL;i++) { 45 for (i = 0; spri->argw.argv[i] != NULL; i++)
43 printk(" '%s'",spri->argw.argv[i]); 46 printk(" '%s'",spri->argw.argv[i]);
44 }
45 printk("\n"); 47 printk("\n");
46} 48}
47 49
48static unsigned short slirp_protocol(struct sk_buff *skbuff) 50static unsigned short slirp_protocol(struct sk_buff *skbuff)
49{ 51{
50 return(htons(ETH_P_IP)); 52 return htons(ETH_P_IP);
51} 53}
52 54
53static int slirp_read(int fd, struct sk_buff **skb, 55static int slirp_read(int fd, struct sk_buff **skb,
54 struct uml_net_private *lp) 56 struct uml_net_private *lp)
55{ 57{
56 return(slirp_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu, 58 return slirp_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu,
57 (struct slirp_data *) &lp->user)); 59 (struct slirp_data *) &lp->user);
58} 60}
59 61
60static int slirp_write(int fd, struct sk_buff **skb, 62static int slirp_write(int fd, struct sk_buff **skb,
61 struct uml_net_private *lp) 63 struct uml_net_private *lp)
62{ 64{
63 return(slirp_user_write(fd, (*skb)->data, (*skb)->len, 65 return slirp_user_write(fd, (*skb)->data, (*skb)->len,
64 (struct slirp_data *) &lp->user)); 66 (struct slirp_data *) &lp->user);
65} 67}
66 68
67const struct net_kern_info slirp_kern_info = { 69const struct net_kern_info slirp_kern_info = {
@@ -76,31 +78,32 @@ static int slirp_setup(char *str, char **mac_out, void *data)
76 struct slirp_init *init = data; 78 struct slirp_init *init = data;
77 int i=0; 79 int i=0;
78 80
79 *init = ((struct slirp_init) 81 *init = ((struct slirp_init) { .argw = { { "slirp", NULL } } });
80 { .argw = { { "slirp", NULL } } });
81 82
82 str = split_if_spec(str, mac_out, NULL); 83 str = split_if_spec(str, mac_out, NULL);
83 84
84 if(str == NULL) { /* no command line given after MAC addr */ 85 if (str == NULL) /* no command line given after MAC addr */
85 return(1); 86 return 1;
86 }
87 87
88 do { 88 do {
89 if(i>=SLIRP_MAX_ARGS-1) { 89 if (i >= SLIRP_MAX_ARGS - 1) {
90 printk("slirp_setup: truncating slirp arguments\n"); 90 printk(KERN_WARNING "slirp_setup: truncating slirp "
91 "arguments\n");
91 break; 92 break;
92 } 93 }
93 init->argw.argv[i++] = str; 94 init->argw.argv[i++] = str;
94 while(*str && *str!=',') { 95 while(*str && *str!=',') {
95 if(*str=='_') *str=' '; 96 if (*str == '_')
97 *str=' ';
96 str++; 98 str++;
97 } 99 }
98 if(*str!=',') 100 if (*str != ',')
99 break; 101 break;
100 *str++='\0'; 102 *str++ = '\0';
101 } while(1); 103 } while (1);
102 init->argw.argv[i]=NULL; 104
103 return(1); 105 init->argw.argv[i] = NULL;
106 return 1;
104} 107}
105 108
106static struct transport slirp_transport = { 109static struct transport slirp_transport = {