aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/slip_kern.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/drivers/slip_kern.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/drivers/slip_kern.c')
-rw-r--r--arch/um/drivers/slip_kern.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c
new file mode 100644
index 000000000000..0886eedba213
--- /dev/null
+++ b/arch/um/drivers/slip_kern.c
@@ -0,0 +1,109 @@
1#include "linux/config.h"
2#include "linux/kernel.h"
3#include "linux/stddef.h"
4#include "linux/init.h"
5#include "linux/netdevice.h"
6#include "linux/if_arp.h"
7#include "net_kern.h"
8#include "net_user.h"
9#include "kern.h"
10#include "slip.h"
11
12struct slip_init {
13 char *gate_addr;
14};
15
16void slip_init(struct net_device *dev, void *data)
17{
18 struct uml_net_private *private;
19 struct slip_data *spri;
20 struct slip_init *init = data;
21
22 private = dev->priv;
23 spri = (struct slip_data *) private->user;
24 *spri = ((struct slip_data)
25 { .name = { '\0' },
26 .addr = NULL,
27 .gate_addr = init->gate_addr,
28 .slave = -1,
29 .ibuf = { '\0' },
30 .obuf = { '\0' },
31 .pos = 0,
32 .esc = 0,
33 .dev = dev });
34
35 dev->init = NULL;
36 dev->hard_header_len = 0;
37 dev->addr_len = 4;
38 dev->type = ARPHRD_ETHER;
39 dev->tx_queue_len = 256;
40 dev->flags = IFF_NOARP;
41 printk("SLIP backend - SLIP IP = %s\n", spri->gate_addr);
42}
43
44static unsigned short slip_protocol(struct sk_buff *skbuff)
45{
46 return(htons(ETH_P_IP));
47}
48
49static int slip_read(int fd, struct sk_buff **skb,
50 struct uml_net_private *lp)
51{
52 return(slip_user_read(fd, (*skb)->mac.raw, (*skb)->dev->mtu,
53 (struct slip_data *) &lp->user));
54}
55
56static int slip_write(int fd, struct sk_buff **skb,
57 struct uml_net_private *lp)
58{
59 return(slip_user_write(fd, (*skb)->data, (*skb)->len,
60 (struct slip_data *) &lp->user));
61}
62
63struct net_kern_info slip_kern_info = {
64 .init = slip_init,
65 .protocol = slip_protocol,
66 .read = slip_read,
67 .write = slip_write,
68};
69
70static int slip_setup(char *str, char **mac_out, void *data)
71{
72 struct slip_init *init = data;
73
74 *init = ((struct slip_init)
75 { .gate_addr = NULL });
76
77 if(str[0] != '\0')
78 init->gate_addr = str;
79 return(1);
80}
81
82static struct transport slip_transport = {
83 .list = LIST_HEAD_INIT(slip_transport.list),
84 .name = "slip",
85 .setup = slip_setup,
86 .user = &slip_user_info,
87 .kern = &slip_kern_info,
88 .private_size = sizeof(struct slip_data),
89 .setup_size = sizeof(struct slip_init),
90};
91
92static int register_slip(void)
93{
94 register_transport(&slip_transport);
95 return(1);
96}
97
98__initcall(register_slip);
99
100/*
101 * Overrides for Emacs so that we follow Linus's tabbing style.
102 * Emacs will notice this stuff at the end of the file and automatically
103 * adjust the settings for this buffer only. This must remain at the end
104 * of the file.
105 * ---------------------------------------------------------------------------
106 * Local variables:
107 * c-file-style: "linux"
108 * End:
109 */