Allow ARG_MAX execve string space even with a small stack limit
[wrt350n-kernel.git] / arch / um / drivers / slip_kern.c
blob6b4a0f9e38deeb3d4852639ec4c3d83684e5612f
1 /*
2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL.
4 */
6 #include <linux/if_arp.h>
7 #include <linux/init.h>
8 #include <linux/netdevice.h>
9 #include "net_kern.h"
10 #include "slip.h"
12 struct slip_init {
13 char *gate_addr;
16 void slip_init(struct net_device *dev, void *data)
18 struct uml_net_private *private;
19 struct slip_data *spri;
20 struct slip_init *init = data;
22 private = dev->priv;
23 spri = (struct slip_data *) private->user;
25 memset(spri->name, 0, sizeof(spri->name));
26 spri->addr = NULL;
27 spri->gate_addr = init->gate_addr;
28 spri->slave = -1;
29 spri->dev = dev;
31 slip_proto_init(&spri->slip);
33 dev->init = NULL;
34 dev->hard_header_len = 0;
35 dev->header_ops = NULL;
36 dev->addr_len = 0;
37 dev->type = ARPHRD_SLIP;
38 dev->tx_queue_len = 256;
39 dev->flags = IFF_NOARP;
40 printk("SLIP backend - SLIP IP = %s\n", spri->gate_addr);
43 static unsigned short slip_protocol(struct sk_buff *skbuff)
45 return htons(ETH_P_IP);
48 static int slip_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
50 return slip_user_read(fd, skb_mac_header(skb), skb->dev->mtu,
51 (struct slip_data *) &lp->user);
54 static int slip_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
56 return slip_user_write(fd, skb->data, skb->len,
57 (struct slip_data *) &lp->user);
60 const struct net_kern_info slip_kern_info = {
61 .init = slip_init,
62 .protocol = slip_protocol,
63 .read = slip_read,
64 .write = slip_write,
67 static int slip_setup(char *str, char **mac_out, void *data)
69 struct slip_init *init = data;
71 *init = ((struct slip_init) { .gate_addr = NULL });
73 if (str[0] != '\0')
74 init->gate_addr = str;
75 return 1;
78 static struct transport slip_transport = {
79 .list = LIST_HEAD_INIT(slip_transport.list),
80 .name = "slip",
81 .setup = slip_setup,
82 .user = &slip_user_info,
83 .kern = &slip_kern_info,
84 .private_size = sizeof(struct slip_data),
85 .setup_size = sizeof(struct slip_init),
88 static int register_slip(void)
90 register_transport(&slip_transport);
91 return 0;
94 late_initcall(register_slip);