2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL.
8 #include "linux/kernel.h"
9 #include "linux/init.h"
10 #include "linux/netdevice.h"
11 #include "linux/etherdevice.h"
21 void daemon_init(struct net_device *dev, void *data)
23 struct uml_net_private *pri;
24 struct daemon_data *dpri;
25 struct daemon_init *init = data;
28 dpri = (struct daemon_data *) pri->user;
29 dpri->sock_type = init->sock_type;
30 dpri->ctl_sock = init->ctl_sock;
35 printk("daemon backend (uml_switch version %d) - %s:%s",
36 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
40 static int daemon_read(int fd, struct sk_buff **skb,
41 struct uml_net_private *lp)
43 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
44 if(*skb == NULL) return(-ENOMEM);
45 return(net_recvfrom(fd, (*skb)->mac.raw,
46 (*skb)->dev->mtu + ETH_HEADER_OTHER));
49 static int daemon_write(int fd, struct sk_buff **skb,
50 struct uml_net_private *lp)
52 return(daemon_user_write(fd, (*skb)->data, (*skb)->len,
53 (struct daemon_data *) &lp->user));
56 static struct net_kern_info daemon_kern_info = {
58 .protocol = eth_protocol,
60 .write = daemon_write,
63 int daemon_setup(char *str, char **mac_out, void *data)
65 struct daemon_init *init = data;
68 *init = ((struct daemon_init)
69 { .sock_type = "unix",
70 .ctl_sock = "/tmp/uml.ctl" });
72 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,
75 printk(KERN_WARNING "daemon_setup : Ignoring data socket "
81 static struct transport daemon_transport = {
82 .list = LIST_HEAD_INIT(daemon_transport.list),
84 .setup = daemon_setup,
85 .user = &daemon_user_info,
86 .kern = &daemon_kern_info,
87 .private_size = sizeof(struct daemon_data),
88 .setup_size = sizeof(struct daemon_init),
91 static int register_daemon(void)
93 register_transport(&daemon_transport);
97 __initcall(register_daemon);
100 * Overrides for Emacs so that we follow Linus's tabbing style.
101 * Emacs will notice this stuff at the end of the file and automatically
102 * adjust the settings for this buffer only. This must remain at the end
104 * ---------------------------------------------------------------------------
106 * c-file-style: "linux"