initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / um / drivers / net_kern.c
blobc686a39ea0d5a69eb2f6b1a40622d838a01cec74
1 /*
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.
6 */
8 #include "linux/config.h"
9 #include "linux/kernel.h"
10 #include "linux/netdevice.h"
11 #include "linux/rtnetlink.h"
12 #include "linux/skbuff.h"
13 #include "linux/socket.h"
14 #include "linux/spinlock.h"
15 #include "linux/module.h"
16 #include "linux/init.h"
17 #include "linux/etherdevice.h"
18 #include "linux/list.h"
19 #include "linux/inetdevice.h"
20 #include "linux/ctype.h"
21 #include "linux/bootmem.h"
22 #include "linux/ethtool.h"
23 #include "asm/uaccess.h"
24 #include "user_util.h"
25 #include "kern_util.h"
26 #include "net_kern.h"
27 #include "net_user.h"
28 #include "mconsole_kern.h"
29 #include "init.h"
30 #include "irq_user.h"
31 #include "irq_kern.h"
33 static spinlock_t opened_lock = SPIN_LOCK_UNLOCKED;
34 LIST_HEAD(opened);
36 static int uml_net_rx(struct net_device *dev)
38 struct uml_net_private *lp = dev->priv;
39 int pkt_len;
40 struct sk_buff *skb;
42 /* If we can't allocate memory, try again next round. */
43 skb = dev_alloc_skb(dev->mtu);
44 if (skb == NULL) {
45 lp->stats.rx_dropped++;
46 return 0;
49 skb->dev = dev;
50 skb_put(skb, dev->mtu);
51 skb->mac.raw = skb->data;
52 pkt_len = (*lp->read)(lp->fd, &skb, lp);
54 if (pkt_len > 0) {
55 skb_trim(skb, pkt_len);
56 skb->protocol = (*lp->protocol)(skb);
57 netif_rx(skb);
59 lp->stats.rx_bytes += skb->len;
60 lp->stats.rx_packets++;
61 return pkt_len;
64 kfree_skb(skb);
65 return pkt_len;
68 irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs)
70 struct net_device *dev = dev_id;
71 struct uml_net_private *lp = dev->priv;
72 int err;
74 if(!netif_running(dev))
75 return(IRQ_NONE);
77 spin_lock(&lp->lock);
78 while((err = uml_net_rx(dev)) > 0) ;
79 if(err < 0) {
80 printk(KERN_ERR
81 "Device '%s' read returned %d, shutting it down\n",
82 dev->name, err);
83 dev_close(dev);
84 goto out;
86 reactivate_fd(lp->fd, UM_ETH_IRQ);
88 out:
89 spin_unlock(&lp->lock);
90 return(IRQ_HANDLED);
93 static int uml_net_open(struct net_device *dev)
95 struct uml_net_private *lp = dev->priv;
96 char addr[sizeof("255.255.255.255\0")];
97 int err;
99 spin_lock(&lp->lock);
101 if(lp->fd >= 0){
102 err = -ENXIO;
103 goto out;
106 if(!lp->have_mac){
107 dev_ip_addr(dev, addr, &lp->mac[2]);
108 set_ether_mac(dev, lp->mac);
111 lp->fd = (*lp->open)(&lp->user);
112 if(lp->fd < 0){
113 err = lp->fd;
114 goto out;
117 err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt,
118 SA_INTERRUPT | SA_SHIRQ, dev->name, dev);
119 if(err != 0){
120 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
121 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
122 lp->fd = -1;
123 err = -ENETUNREACH;
126 lp->tl.data = (unsigned long) &lp->user;
127 netif_start_queue(dev);
129 spin_lock(&opened_lock);
130 list_add(&lp->list, &opened);
131 spin_unlock(&opened_lock);
133 /* clear buffer - it can happen that the host side of the interface
134 * is full when we get here. In this case, new data is never queued,
135 * SIGIOs never arrive, and the net never works.
137 while((err = uml_net_rx(dev)) > 0) ;
139 out:
140 spin_unlock(&lp->lock);
141 return(err);
144 static int uml_net_close(struct net_device *dev)
146 struct uml_net_private *lp = dev->priv;
148 netif_stop_queue(dev);
149 spin_lock(&lp->lock);
151 free_irq(dev->irq, dev);
152 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
153 lp->fd = -1;
154 spin_lock(&opened_lock);
155 list_del(&lp->list);
156 spin_unlock(&opened_lock);
158 spin_unlock(&lp->lock);
159 return 0;
162 static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
164 struct uml_net_private *lp = dev->priv;
165 unsigned long flags;
166 int len;
168 netif_stop_queue(dev);
170 spin_lock_irqsave(&lp->lock, flags);
172 len = (*lp->write)(lp->fd, &skb, lp);
174 if(len == skb->len) {
175 lp->stats.tx_packets++;
176 lp->stats.tx_bytes += skb->len;
177 dev->trans_start = jiffies;
178 netif_start_queue(dev);
180 /* this is normally done in the interrupt when tx finishes */
181 netif_wake_queue(dev);
183 else if(len == 0){
184 netif_start_queue(dev);
185 lp->stats.tx_dropped++;
187 else {
188 netif_start_queue(dev);
189 printk(KERN_ERR "uml_net_start_xmit: failed(%d)\n", len);
192 spin_unlock_irqrestore(&lp->lock, flags);
194 dev_kfree_skb(skb);
196 return 0;
199 static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
201 struct uml_net_private *lp = dev->priv;
202 return &lp->stats;
205 static void uml_net_set_multicast_list(struct net_device *dev)
207 if (dev->flags & IFF_PROMISC) return;
208 else if (dev->mc_count) dev->flags |= IFF_ALLMULTI;
209 else dev->flags &= ~IFF_ALLMULTI;
212 static void uml_net_tx_timeout(struct net_device *dev)
214 dev->trans_start = jiffies;
215 netif_wake_queue(dev);
218 static int uml_net_set_mac(struct net_device *dev, void *addr)
220 struct uml_net_private *lp = dev->priv;
221 struct sockaddr *hwaddr = addr;
223 spin_lock(&lp->lock);
224 memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
225 spin_unlock(&lp->lock);
227 return(0);
230 static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
232 struct uml_net_private *lp = dev->priv;
233 int err = 0;
235 spin_lock(&lp->lock);
237 new_mtu = (*lp->set_mtu)(new_mtu, &lp->user);
238 if(new_mtu < 0){
239 err = new_mtu;
240 goto out;
243 dev->mtu = new_mtu;
245 out:
246 spin_unlock(&lp->lock);
247 return err;
250 static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
252 static const struct ethtool_drvinfo info = {
253 .cmd = ETHTOOL_GDRVINFO,
254 .driver = "uml virtual ethernet",
255 .version = "42",
257 void *useraddr;
258 u32 ethcmd;
260 switch (cmd) {
261 case SIOCETHTOOL:
262 useraddr = ifr->ifr_data;
263 if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
264 return -EFAULT;
265 switch (ethcmd) {
266 case ETHTOOL_GDRVINFO:
267 if (copy_to_user(useraddr, &info, sizeof(info)))
268 return -EFAULT;
269 return 0;
270 default:
271 return -EOPNOTSUPP;
273 default:
274 return -EINVAL;
278 void uml_net_user_timer_expire(unsigned long _conn)
280 #ifdef undef
281 struct connection *conn = (struct connection *)_conn;
283 dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);
284 do_connect(conn);
285 #endif
288 static spinlock_t devices_lock = SPIN_LOCK_UNLOCKED;
289 static struct list_head devices = LIST_HEAD_INIT(devices);
291 static int eth_configure(int n, void *init, char *mac,
292 struct transport *transport)
294 struct uml_net *device;
295 struct net_device *dev;
296 struct uml_net_private *lp;
297 int save, err, size;
299 size = transport->private_size + sizeof(struct uml_net_private) +
300 sizeof(((struct uml_net_private *) 0)->user);
302 device = kmalloc(sizeof(*device), GFP_KERNEL);
303 if (device == NULL) {
304 printk(KERN_ERR "eth_configure failed to allocate uml_net\n");
305 return(1);
308 memset(device, 0, sizeof(*device));
309 INIT_LIST_HEAD(&device->list);
310 device->index = n;
312 spin_lock(&devices_lock);
313 list_add(&device->list, &devices);
314 spin_unlock(&devices_lock);
316 if (setup_etheraddr(mac, device->mac))
317 device->have_mac = 1;
319 printk(KERN_INFO "Netdevice %d ", n);
320 if (device->have_mac)
321 printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
322 device->mac[0], device->mac[1],
323 device->mac[2], device->mac[3],
324 device->mac[4], device->mac[5]);
325 printk(": ");
326 dev = alloc_etherdev(size);
327 if (dev == NULL) {
328 printk(KERN_ERR "eth_configure: failed to allocate device\n");
329 return 1;
332 /* If this name ends up conflicting with an existing registered
333 * netdevice, that is OK, register_netdev{,ice}() will notice this
334 * and fail.
336 snprintf(dev->name, sizeof(dev->name), "eth%d", n);
337 device->dev = dev;
339 (*transport->kern->init)(dev, init);
341 dev->mtu = transport->user->max_packet;
342 dev->open = uml_net_open;
343 dev->hard_start_xmit = uml_net_start_xmit;
344 dev->stop = uml_net_close;
345 dev->get_stats = uml_net_get_stats;
346 dev->set_multicast_list = uml_net_set_multicast_list;
347 dev->tx_timeout = uml_net_tx_timeout;
348 dev->set_mac_address = uml_net_set_mac;
349 dev->change_mtu = uml_net_change_mtu;
350 dev->do_ioctl = uml_net_ioctl;
351 dev->watchdog_timeo = (HZ >> 1);
352 dev->irq = UM_ETH_IRQ;
354 rtnl_lock();
355 err = register_netdevice(dev);
356 rtnl_unlock();
357 if (err) {
358 device->dev = NULL;
359 /* XXX: should we call ->remove() here? */
360 free_netdev(dev);
361 return 1;
363 lp = dev->priv;
365 /* lp.user is the first four bytes of the transport data, which
366 * has already been initialized. This structure assignment will
367 * overwrite that, so we make sure that .user gets overwritten with
368 * what it already has.
370 save = lp->user[0];
371 *lp = ((struct uml_net_private)
372 { .list = LIST_HEAD_INIT(lp->list),
373 .lock = SPIN_LOCK_UNLOCKED,
374 .dev = dev,
375 .fd = -1,
376 .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
377 .have_mac = device->have_mac,
378 .protocol = transport->kern->protocol,
379 .open = transport->user->open,
380 .close = transport->user->close,
381 .remove = transport->user->remove,
382 .read = transport->kern->read,
383 .write = transport->kern->write,
384 .add_address = transport->user->add_address,
385 .delete_address = transport->user->delete_address,
386 .set_mtu = transport->user->set_mtu,
387 .user = { save } });
389 init_timer(&lp->tl);
390 lp->tl.function = uml_net_user_timer_expire;
391 if (lp->have_mac)
392 memcpy(lp->mac, device->mac, sizeof(lp->mac));
394 if (transport->user->init)
395 (*transport->user->init)(&lp->user, dev);
397 if (device->have_mac)
398 set_ether_mac(dev, device->mac);
399 return(0);
402 static struct uml_net *find_device(int n)
404 struct uml_net *device;
405 struct list_head *ele;
407 spin_lock(&devices_lock);
408 list_for_each(ele, &devices){
409 device = list_entry(ele, struct uml_net, list);
410 if(device->index == n)
411 goto out;
413 device = NULL;
414 out:
415 spin_unlock(&devices_lock);
416 return(device);
419 static int eth_parse(char *str, int *index_out, char **str_out)
421 char *end;
422 int n;
424 n = simple_strtoul(str, &end, 0);
425 if(end == str){
426 printk(KERN_ERR "eth_setup: Failed to parse '%s'\n", str);
427 return(1);
429 if(n < 0){
430 printk(KERN_ERR "eth_setup: device %d is negative\n", n);
431 return(1);
433 str = end;
434 if(*str != '='){
435 printk(KERN_ERR
436 "eth_setup: expected '=' after device number\n");
437 return(1);
439 str++;
440 if(find_device(n)){
441 printk(KERN_ERR "eth_setup: Device %d already configured\n",
443 return(1);
445 if(index_out) *index_out = n;
446 *str_out = str;
447 return(0);
450 struct eth_init {
451 struct list_head list;
452 char *init;
453 int index;
456 /* Filled in at boot time. Will need locking if the transports become
457 * modular.
459 struct list_head transports = LIST_HEAD_INIT(transports);
461 /* Filled in during early boot */
462 struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line);
464 static int check_transport(struct transport *transport, char *eth, int n,
465 void **init_out, char **mac_out)
467 int len;
469 len = strlen(transport->name);
470 if(strncmp(eth, transport->name, len))
471 return(0);
473 eth += len;
474 if(*eth == ',')
475 eth++;
476 else if(*eth != '\0')
477 return(0);
479 *init_out = kmalloc(transport->setup_size, GFP_KERNEL);
480 if(*init_out == NULL)
481 return(1);
483 if(!transport->setup(eth, mac_out, *init_out)){
484 kfree(*init_out);
485 *init_out = NULL;
487 return(1);
490 void register_transport(struct transport *new)
492 struct list_head *ele, *next;
493 struct eth_init *eth;
494 void *init;
495 char *mac = NULL;
496 int match;
498 list_add(&new->list, &transports);
500 list_for_each_safe(ele, next, &eth_cmd_line){
501 eth = list_entry(ele, struct eth_init, list);
502 match = check_transport(new, eth->init, eth->index, &init,
503 &mac);
504 if(!match)
505 continue;
506 else if(init != NULL){
507 eth_configure(eth->index, init, mac, new);
508 kfree(init);
510 list_del(&eth->list);
514 static int eth_setup_common(char *str, int index)
516 struct list_head *ele;
517 struct transport *transport;
518 void *init;
519 char *mac = NULL;
521 list_for_each(ele, &transports){
522 transport = list_entry(ele, struct transport, list);
523 if(!check_transport(transport, str, index, &init, &mac))
524 continue;
525 if(init != NULL){
526 eth_configure(index, init, mac, transport);
527 kfree(init);
529 return(1);
531 return(0);
534 static int eth_setup(char *str)
536 struct eth_init *new;
537 int n, err;
539 err = eth_parse(str, &n, &str);
540 if(err) return(1);
542 new = alloc_bootmem(sizeof(new));
543 if (new == NULL){
544 printk("eth_init : alloc_bootmem failed\n");
545 return(1);
548 INIT_LIST_HEAD(&new->list);
549 new->index = n;
550 new->init = str;
552 list_add_tail(&new->list, &eth_cmd_line);
553 return(1);
556 __setup("eth", eth_setup);
557 __uml_help(eth_setup,
558 "eth[0-9]+=<transport>,<options>\n"
559 " Configure a network device.\n\n"
562 static int eth_init(void)
564 struct list_head *ele, *next;
565 struct eth_init *eth;
567 list_for_each_safe(ele, next, &eth_cmd_line){
568 eth = list_entry(ele, struct eth_init, list);
570 if(eth_setup_common(eth->init, eth->index))
571 list_del(&eth->list);
574 return(1);
577 __initcall(eth_init);
579 static int net_config(char *str)
581 int n, err;
583 err = eth_parse(str, &n, &str);
584 if(err) return(err);
586 str = uml_strdup(str);
587 if(str == NULL){
588 printk(KERN_ERR "net_config failed to strdup string\n");
589 return(-1);
591 err = !eth_setup_common(str, n);
592 if(err)
593 kfree(str);
594 return(err);
597 static int net_remove(char *str)
599 struct uml_net *device;
600 struct net_device *dev;
601 struct uml_net_private *lp;
602 char *end;
603 int n;
605 n = simple_strtoul(str, &end, 0);
606 if((*end != '\0') || (end == str))
607 return(-1);
609 device = find_device(n);
610 if(device == NULL)
611 return(0);
613 dev = device->dev;
614 lp = dev->priv;
615 if(lp->fd > 0) return(-1);
616 if(lp->remove != NULL) (*lp->remove)(&lp->user);
617 unregister_netdev(dev);
619 list_del(&device->list);
620 kfree(device);
621 free_netdev(dev);
622 return(0);
625 static struct mc_device net_mc = {
626 .name = "eth",
627 .config = net_config,
628 .get_config = NULL,
629 .remove = net_remove,
632 static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
633 void *ptr)
635 struct in_ifaddr *ifa = ptr;
636 u32 addr = ifa->ifa_address;
637 u32 netmask = ifa->ifa_mask;
638 struct net_device *dev = ifa->ifa_dev->dev;
639 struct uml_net_private *lp;
640 void (*proc)(unsigned char *, unsigned char *, void *);
641 unsigned char addr_buf[4], netmask_buf[4];
643 if(dev->open != uml_net_open) return(NOTIFY_DONE);
645 lp = dev->priv;
647 proc = NULL;
648 switch (event){
649 case NETDEV_UP:
650 proc = lp->add_address;
651 break;
652 case NETDEV_DOWN:
653 proc = lp->delete_address;
654 break;
656 if(proc != NULL){
657 addr_buf[0] = addr & 0xff;
658 addr_buf[1] = (addr >> 8) & 0xff;
659 addr_buf[2] = (addr >> 16) & 0xff;
660 addr_buf[3] = addr >> 24;
661 netmask_buf[0] = netmask & 0xff;
662 netmask_buf[1] = (netmask >> 8) & 0xff;
663 netmask_buf[2] = (netmask >> 16) & 0xff;
664 netmask_buf[3] = netmask >> 24;
665 (*proc)(addr_buf, netmask_buf, &lp->user);
667 return(NOTIFY_DONE);
670 struct notifier_block uml_inetaddr_notifier = {
671 .notifier_call = uml_inetaddr_event,
674 static int uml_net_init(void)
676 struct list_head *ele;
677 struct uml_net_private *lp;
678 struct in_device *ip;
679 struct in_ifaddr *in;
681 mconsole_register_dev(&net_mc);
682 register_inetaddr_notifier(&uml_inetaddr_notifier);
684 /* Devices may have been opened already, so the uml_inetaddr_notifier
685 * didn't get a chance to run for them. This fakes it so that
686 * addresses which have already been set up get handled properly.
688 list_for_each(ele, &opened){
689 lp = list_entry(ele, struct uml_net_private, list);
690 ip = lp->dev->ip_ptr;
691 if(ip == NULL) continue;
692 in = ip->ifa_list;
693 while(in != NULL){
694 uml_inetaddr_event(NULL, NETDEV_UP, in);
695 in = in->ifa_next;
699 return(0);
702 __initcall(uml_net_init);
704 static void close_devices(void)
706 struct list_head *ele;
707 struct uml_net_private *lp;
709 list_for_each(ele, &opened){
710 lp = list_entry(ele, struct uml_net_private, list);
711 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
712 if(lp->remove != NULL) (*lp->remove)(&lp->user);
716 __uml_exitcall(close_devices);
718 int setup_etheraddr(char *str, unsigned char *addr)
720 char *end;
721 int i;
723 if(str == NULL)
724 return(0);
725 for(i=0;i<6;i++){
726 addr[i] = simple_strtoul(str, &end, 16);
727 if((end == str) ||
728 ((*end != ':') && (*end != ',') && (*end != '\0'))){
729 printk(KERN_ERR
730 "setup_etheraddr: failed to parse '%s' "
731 "as an ethernet address\n", str);
732 return(0);
734 str = end + 1;
736 if(addr[0] & 1){
737 printk(KERN_ERR
738 "Attempt to assign a broadcast ethernet address to a "
739 "device disallowed\n");
740 return(0);
742 return(1);
745 void dev_ip_addr(void *d, char *buf, char *bin_buf)
747 struct net_device *dev = d;
748 struct in_device *ip = dev->ip_ptr;
749 struct in_ifaddr *in;
750 u32 addr;
752 if((ip == NULL) || ((in = ip->ifa_list) == NULL)){
753 printk(KERN_WARNING "dev_ip_addr - device not assigned an "
754 "IP address\n");
755 return;
757 addr = in->ifa_address;
758 sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff,
759 (addr >> 16) & 0xff, addr >> 24);
760 if(bin_buf){
761 bin_buf[0] = addr & 0xff;
762 bin_buf[1] = (addr >> 8) & 0xff;
763 bin_buf[2] = (addr >> 16) & 0xff;
764 bin_buf[3] = addr >> 24;
768 void set_ether_mac(void *d, unsigned char *addr)
770 struct net_device *dev = d;
772 memcpy(dev->dev_addr, addr, ETH_ALEN);
775 struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
777 if((skb != NULL) && (skb_tailroom(skb) < extra)){
778 struct sk_buff *skb2;
780 skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
781 dev_kfree_skb(skb);
782 skb = skb2;
784 if(skb != NULL) skb_put(skb, extra);
785 return(skb);
788 void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *,
789 void *),
790 void *arg)
792 struct net_device *dev = d;
793 struct in_device *ip = dev->ip_ptr;
794 struct in_ifaddr *in;
795 unsigned char address[4], netmask[4];
797 if(ip == NULL) return;
798 in = ip->ifa_list;
799 while(in != NULL){
800 address[0] = in->ifa_address & 0xff;
801 address[1] = (in->ifa_address >> 8) & 0xff;
802 address[2] = (in->ifa_address >> 16) & 0xff;
803 address[3] = in->ifa_address >> 24;
804 netmask[0] = in->ifa_mask & 0xff;
805 netmask[1] = (in->ifa_mask >> 8) & 0xff;
806 netmask[2] = (in->ifa_mask >> 16) & 0xff;
807 netmask[3] = in->ifa_mask >> 24;
808 (*cb)(address, netmask, arg);
809 in = in->ifa_next;
813 int dev_netmask(void *d, void *m)
815 struct net_device *dev = d;
816 struct in_device *ip = dev->ip_ptr;
817 struct in_ifaddr *in;
818 __u32 *mask_out = m;
820 if(ip == NULL)
821 return(1);
823 in = ip->ifa_list;
824 if(in == NULL)
825 return(1);
827 *mask_out = in->ifa_mask;
828 return(0);
831 void *get_output_buffer(int *len_out)
833 void *ret;
835 ret = (void *) __get_free_pages(GFP_KERNEL, 0);
836 if(ret) *len_out = PAGE_SIZE;
837 else *len_out = 0;
838 return(ret);
841 void free_output_buffer(void *buffer)
843 free_pages((unsigned long) buffer, 0);
846 int tap_setup_common(char *str, char *type, char **dev_name, char **mac_out,
847 char **gate_addr)
849 char *remain;
851 remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL);
852 if(remain != NULL){
853 printk("tap_setup_common - Extra garbage on specification : "
854 "'%s'\n", remain);
855 return(1);
858 return(0);
861 unsigned short eth_protocol(struct sk_buff *skb)
863 return(eth_type_trans(skb, skb->dev));
867 * Overrides for Emacs so that we follow Linus's tabbing style.
868 * Emacs will notice this stuff at the end of the file and automatically
869 * adjust the settings for this buffer only. This must remain at the end
870 * of the file.
871 * ---------------------------------------------------------------------------
872 * Local variables:
873 * c-file-style: "linux"
874 * End: