diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:27:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:08 -0400 |
commit | cd1ae0e49bdd814cfaa2e5ab28cff21a30e20085 (patch) | |
tree | 1b993b9de4cb9a8578022a4014063c3e87ec996e /arch/um/drivers/net_kern.c | |
parent | 1a80521990a0e30e61a92994a009adc52161b070 (diff) |
uml: network formatting
Style and other non-functional changes in the UML networking code, including
include tidying
style violations
copyright updates
printks getting severities
userspace code calling libc directly rather than using the os_*
wrappers
There's also a exit path cleanup in the pcap driver.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/net_kern.c')
-rw-r--r-- | arch/um/drivers/net_kern.c | 197 |
1 files changed, 97 insertions, 100 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index d35d0c1ee7f4..b097a24c1496 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -1,33 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
3 | * James Leu (jleu@mindspring.net). | 4 | * James Leu (jleu@mindspring.net). |
4 | * Copyright (C) 2001 by various other people who didn't put their name here. | 5 | * Copyright (C) 2001 by various other people who didn't put their name here. |
5 | * Licensed under the GPL. | 6 | * Licensed under the GPL. |
6 | */ | 7 | */ |
7 | 8 | ||
8 | #include "linux/kernel.h" | 9 | #include <linux/bootmem.h> |
9 | #include "linux/netdevice.h" | 10 | #include <linux/etherdevice.h> |
10 | #include "linux/rtnetlink.h" | 11 | #include <linux/ethtool.h> |
11 | #include "linux/skbuff.h" | 12 | #include <linux/inetdevice.h> |
12 | #include "linux/socket.h" | 13 | #include <linux/init.h> |
13 | #include "linux/spinlock.h" | 14 | #include <linux/list.h> |
14 | #include "linux/module.h" | 15 | #include <linux/netdevice.h> |
15 | #include "linux/init.h" | 16 | #include <linux/platform_device.h> |
16 | #include "linux/etherdevice.h" | 17 | #include <linux/rtnetlink.h> |
17 | #include "linux/list.h" | 18 | #include <linux/skbuff.h> |
18 | #include "linux/inetdevice.h" | 19 | #include <linux/spinlock.h> |
19 | #include "linux/ctype.h" | ||
20 | #include "linux/bootmem.h" | ||
21 | #include "linux/ethtool.h" | ||
22 | #include "linux/platform_device.h" | ||
23 | #include "asm/uaccess.h" | ||
24 | #include "kern_util.h" | ||
25 | #include "net_kern.h" | ||
26 | #include "net_user.h" | ||
27 | #include "mconsole_kern.h" | ||
28 | #include "init.h" | 20 | #include "init.h" |
29 | #include "irq_user.h" | ||
30 | #include "irq_kern.h" | 21 | #include "irq_kern.h" |
22 | #include "irq_user.h" | ||
23 | #include "mconsole_kern.h" | ||
24 | #include "net_kern.h" | ||
25 | #include "net_user.h" | ||
31 | 26 | ||
32 | static inline void set_ether_mac(struct net_device *dev, unsigned char *addr) | 27 | static inline void set_ether_mac(struct net_device *dev, unsigned char *addr) |
33 | { | 28 | { |
@@ -84,12 +79,12 @@ irqreturn_t uml_net_interrupt(int irq, void *dev_id) | |||
84 | struct uml_net_private *lp = dev->priv; | 79 | struct uml_net_private *lp = dev->priv; |
85 | int err; | 80 | int err; |
86 | 81 | ||
87 | if(!netif_running(dev)) | 82 | if (!netif_running(dev)) |
88 | return(IRQ_NONE); | 83 | return IRQ_NONE; |
89 | 84 | ||
90 | spin_lock(&lp->lock); | 85 | spin_lock(&lp->lock); |
91 | while((err = uml_net_rx(dev)) > 0) ; | 86 | while ((err = uml_net_rx(dev)) > 0) ; |
92 | if(err < 0) { | 87 | if (err < 0) { |
93 | printk(KERN_ERR | 88 | printk(KERN_ERR |
94 | "Device '%s' read returned %d, shutting it down\n", | 89 | "Device '%s' read returned %d, shutting it down\n", |
95 | dev->name, err); | 90 | dev->name, err); |
@@ -115,20 +110,20 @@ static int uml_net_open(struct net_device *dev) | |||
115 | struct uml_net_private *lp = dev->priv; | 110 | struct uml_net_private *lp = dev->priv; |
116 | int err; | 111 | int err; |
117 | 112 | ||
118 | if(lp->fd >= 0){ | 113 | if (lp->fd >= 0) { |
119 | err = -ENXIO; | 114 | err = -ENXIO; |
120 | goto out; | 115 | goto out; |
121 | } | 116 | } |
122 | 117 | ||
123 | lp->fd = (*lp->open)(&lp->user); | 118 | lp->fd = (*lp->open)(&lp->user); |
124 | if(lp->fd < 0){ | 119 | if (lp->fd < 0) { |
125 | err = lp->fd; | 120 | err = lp->fd; |
126 | goto out; | 121 | goto out; |
127 | } | 122 | } |
128 | 123 | ||
129 | err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt, | 124 | err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt, |
130 | IRQF_DISABLED | IRQF_SHARED, dev->name, dev); | 125 | IRQF_DISABLED | IRQF_SHARED, dev->name, dev); |
131 | if(err != 0){ | 126 | if (err != 0) { |
132 | printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); | 127 | printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); |
133 | err = -ENETUNREACH; | 128 | err = -ENETUNREACH; |
134 | goto out_close; | 129 | goto out_close; |
@@ -141,7 +136,7 @@ static int uml_net_open(struct net_device *dev) | |||
141 | * is full when we get here. In this case, new data is never queued, | 136 | * is full when we get here. In this case, new data is never queued, |
142 | * SIGIOs never arrive, and the net never works. | 137 | * SIGIOs never arrive, and the net never works. |
143 | */ | 138 | */ |
144 | while((err = uml_net_rx(dev)) > 0) ; | 139 | while ((err = uml_net_rx(dev)) > 0) ; |
145 | 140 | ||
146 | spin_lock(&opened_lock); | 141 | spin_lock(&opened_lock); |
147 | list_add(&lp->list, &opened); | 142 | list_add(&lp->list, &opened); |
@@ -149,7 +144,7 @@ static int uml_net_open(struct net_device *dev) | |||
149 | 144 | ||
150 | return 0; | 145 | return 0; |
151 | out_close: | 146 | out_close: |
152 | if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); | 147 | if (lp->close != NULL) (*lp->close)(lp->fd, &lp->user); |
153 | lp->fd = -1; | 148 | lp->fd = -1; |
154 | out: | 149 | out: |
155 | return err; | 150 | return err; |
@@ -162,7 +157,7 @@ static int uml_net_close(struct net_device *dev) | |||
162 | netif_stop_queue(dev); | 157 | netif_stop_queue(dev); |
163 | 158 | ||
164 | free_irq(dev->irq, dev); | 159 | free_irq(dev->irq, dev); |
165 | if(lp->close != NULL) | 160 | if (lp->close != NULL) |
166 | (*lp->close)(lp->fd, &lp->user); | 161 | (*lp->close)(lp->fd, &lp->user); |
167 | lp->fd = -1; | 162 | lp->fd = -1; |
168 | 163 | ||
@@ -185,7 +180,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
185 | 180 | ||
186 | len = (*lp->write)(lp->fd, &skb, lp); | 181 | len = (*lp->write)(lp->fd, &skb, lp); |
187 | 182 | ||
188 | if(len == skb->len) { | 183 | if (len == skb->len) { |
189 | lp->stats.tx_packets++; | 184 | lp->stats.tx_packets++; |
190 | lp->stats.tx_bytes += skb->len; | 185 | lp->stats.tx_bytes += skb->len; |
191 | dev->trans_start = jiffies; | 186 | dev->trans_start = jiffies; |
@@ -194,7 +189,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
194 | /* this is normally done in the interrupt when tx finishes */ | 189 | /* this is normally done in the interrupt when tx finishes */ |
195 | netif_wake_queue(dev); | 190 | netif_wake_queue(dev); |
196 | } | 191 | } |
197 | else if(len == 0){ | 192 | else if (len == 0) { |
198 | netif_start_queue(dev); | 193 | netif_start_queue(dev); |
199 | lp->stats.tx_dropped++; | 194 | lp->stats.tx_dropped++; |
200 | } | 195 | } |
@@ -218,8 +213,10 @@ static struct net_device_stats *uml_net_get_stats(struct net_device *dev) | |||
218 | 213 | ||
219 | static void uml_net_set_multicast_list(struct net_device *dev) | 214 | static void uml_net_set_multicast_list(struct net_device *dev) |
220 | { | 215 | { |
221 | if (dev->flags & IFF_PROMISC) return; | 216 | if (dev->flags & IFF_PROMISC) |
222 | else if (dev->mc_count) dev->flags |= IFF_ALLMULTI; | 217 | return; |
218 | else if (dev->mc_count) | ||
219 | dev->flags |= IFF_ALLMULTI; | ||
223 | else dev->flags &= ~IFF_ALLMULTI; | 220 | else dev->flags &= ~IFF_ALLMULTI; |
224 | } | 221 | } |
225 | 222 | ||
@@ -249,7 +246,7 @@ static int uml_net_change_mtu(struct net_device *dev, int new_mtu) | |||
249 | spin_lock_irq(&lp->lock); | 246 | spin_lock_irq(&lp->lock); |
250 | 247 | ||
251 | new_mtu = (*lp->set_mtu)(new_mtu, &lp->user); | 248 | new_mtu = (*lp->set_mtu)(new_mtu, &lp->user); |
252 | if(new_mtu < 0){ | 249 | if (new_mtu < 0) { |
253 | err = new_mtu; | 250 | err = new_mtu; |
254 | goto out; | 251 | goto out; |
255 | } | 252 | } |
@@ -288,13 +285,13 @@ static void setup_etheraddr(char *str, unsigned char *addr, char *name) | |||
288 | char *end; | 285 | char *end; |
289 | int i; | 286 | int i; |
290 | 287 | ||
291 | if(str == NULL) | 288 | if (str == NULL) |
292 | goto random; | 289 | goto random; |
293 | 290 | ||
294 | for(i=0;i<6;i++){ | 291 | for (i = 0;i < 6; i++) { |
295 | addr[i] = simple_strtoul(str, &end, 16); | 292 | addr[i] = simple_strtoul(str, &end, 16); |
296 | if((end == str) || | 293 | if ((end == str) || |
297 | ((*end != ':') && (*end != ',') && (*end != '\0'))){ | 294 | ((*end != ':') && (*end != ',') && (*end != '\0'))) { |
298 | printk(KERN_ERR | 295 | printk(KERN_ERR |
299 | "setup_etheraddr: failed to parse '%s' " | 296 | "setup_etheraddr: failed to parse '%s' " |
300 | "as an ethernet address\n", str); | 297 | "as an ethernet address\n", str); |
@@ -349,7 +346,7 @@ static void net_device_release(struct device *dev) | |||
349 | struct net_device *netdev = device->dev; | 346 | struct net_device *netdev = device->dev; |
350 | struct uml_net_private *lp = netdev->priv; | 347 | struct uml_net_private *lp = netdev->priv; |
351 | 348 | ||
352 | if(lp->remove != NULL) | 349 | if (lp->remove != NULL) |
353 | (*lp->remove)(&lp->user); | 350 | (*lp->remove)(&lp->user); |
354 | list_del(&device->list); | 351 | list_del(&device->list); |
355 | kfree(device); | 352 | kfree(device); |
@@ -413,7 +410,7 @@ static void eth_configure(int n, void *init, char *mac, | |||
413 | device->pdev.name = DRIVER_NAME; | 410 | device->pdev.name = DRIVER_NAME; |
414 | device->pdev.dev.release = net_device_release; | 411 | device->pdev.dev.release = net_device_release; |
415 | device->pdev.dev.driver_data = device; | 412 | device->pdev.dev.driver_data = device; |
416 | if(platform_device_register(&device->pdev)) | 413 | if (platform_device_register(&device->pdev)) |
417 | goto out_free_netdev; | 414 | goto out_free_netdev; |
418 | SET_NETDEV_DEV(dev,&device->pdev.dev); | 415 | SET_NETDEV_DEV(dev,&device->pdev.dev); |
419 | 416 | ||
@@ -493,9 +490,9 @@ static struct uml_net *find_device(int n) | |||
493 | struct list_head *ele; | 490 | struct list_head *ele; |
494 | 491 | ||
495 | spin_lock(&devices_lock); | 492 | spin_lock(&devices_lock); |
496 | list_for_each(ele, &devices){ | 493 | list_for_each(ele, &devices) { |
497 | device = list_entry(ele, struct uml_net, list); | 494 | device = list_entry(ele, struct uml_net, list); |
498 | if(device->index == n) | 495 | if (device->index == n) |
499 | goto out; | 496 | goto out; |
500 | } | 497 | } |
501 | device = NULL; | 498 | device = NULL; |
@@ -511,19 +508,19 @@ static int eth_parse(char *str, int *index_out, char **str_out, | |||
511 | int n, err = -EINVAL;; | 508 | int n, err = -EINVAL;; |
512 | 509 | ||
513 | n = simple_strtoul(str, &end, 0); | 510 | n = simple_strtoul(str, &end, 0); |
514 | if(end == str){ | 511 | if (end == str) { |
515 | *error_out = "Bad device number"; | 512 | *error_out = "Bad device number"; |
516 | return err; | 513 | return err; |
517 | } | 514 | } |
518 | 515 | ||
519 | str = end; | 516 | str = end; |
520 | if(*str != '='){ | 517 | if (*str != '=') { |
521 | *error_out = "Expected '=' after device number"; | 518 | *error_out = "Expected '=' after device number"; |
522 | return err; | 519 | return err; |
523 | } | 520 | } |
524 | 521 | ||
525 | str++; | 522 | str++; |
526 | if(find_device(n)){ | 523 | if (find_device(n)) { |
527 | *error_out = "Device already configured"; | 524 | *error_out = "Device already configured"; |
528 | return err; | 525 | return err; |
529 | } | 526 | } |
@@ -551,20 +548,20 @@ static int check_transport(struct transport *transport, char *eth, int n, | |||
551 | int len; | 548 | int len; |
552 | 549 | ||
553 | len = strlen(transport->name); | 550 | len = strlen(transport->name); |
554 | if(strncmp(eth, transport->name, len)) | 551 | if (strncmp(eth, transport->name, len)) |
555 | return 0; | 552 | return 0; |
556 | 553 | ||
557 | eth += len; | 554 | eth += len; |
558 | if(*eth == ',') | 555 | if (*eth == ',') |
559 | eth++; | 556 | eth++; |
560 | else if(*eth != '\0') | 557 | else if (*eth != '\0') |
561 | return 0; | 558 | return 0; |
562 | 559 | ||
563 | *init_out = kmalloc(transport->setup_size, GFP_KERNEL); | 560 | *init_out = kmalloc(transport->setup_size, GFP_KERNEL); |
564 | if(*init_out == NULL) | 561 | if (*init_out == NULL) |
565 | return 1; | 562 | return 1; |
566 | 563 | ||
567 | if(!transport->setup(eth, mac_out, *init_out)){ | 564 | if (!transport->setup(eth, mac_out, *init_out)) { |
568 | kfree(*init_out); | 565 | kfree(*init_out); |
569 | *init_out = NULL; | 566 | *init_out = NULL; |
570 | } | 567 | } |
@@ -584,13 +581,13 @@ void register_transport(struct transport *new) | |||
584 | list_add(&new->list, &transports); | 581 | list_add(&new->list, &transports); |
585 | spin_unlock(&transports_lock); | 582 | spin_unlock(&transports_lock); |
586 | 583 | ||
587 | list_for_each_safe(ele, next, ð_cmd_line){ | 584 | list_for_each_safe(ele, next, ð_cmd_line) { |
588 | eth = list_entry(ele, struct eth_init, list); | 585 | eth = list_entry(ele, struct eth_init, list); |
589 | match = check_transport(new, eth->init, eth->index, &init, | 586 | match = check_transport(new, eth->init, eth->index, &init, |
590 | &mac); | 587 | &mac); |
591 | if(!match) | 588 | if (!match) |
592 | continue; | 589 | continue; |
593 | else if(init != NULL){ | 590 | else if (init != NULL) { |
594 | eth_configure(eth->index, init, mac, new); | 591 | eth_configure(eth->index, init, mac, new); |
595 | kfree(init); | 592 | kfree(init); |
596 | } | 593 | } |
@@ -607,11 +604,11 @@ static int eth_setup_common(char *str, int index) | |||
607 | int found = 0; | 604 | int found = 0; |
608 | 605 | ||
609 | spin_lock(&transports_lock); | 606 | spin_lock(&transports_lock); |
610 | list_for_each(ele, &transports){ | 607 | list_for_each(ele, &transports) { |
611 | transport = list_entry(ele, struct transport, list); | 608 | transport = list_entry(ele, struct transport, list); |
612 | if(!check_transport(transport, str, index, &init, &mac)) | 609 | if (!check_transport(transport, str, index, &init, &mac)) |
613 | continue; | 610 | continue; |
614 | if(init != NULL){ | 611 | if (init != NULL) { |
615 | eth_configure(index, init, mac, transport); | 612 | eth_configure(index, init, mac, transport); |
616 | kfree(init); | 613 | kfree(init); |
617 | } | 614 | } |
@@ -630,15 +627,15 @@ static int __init eth_setup(char *str) | |||
630 | int n, err; | 627 | int n, err; |
631 | 628 | ||
632 | err = eth_parse(str, &n, &str, &error); | 629 | err = eth_parse(str, &n, &str, &error); |
633 | if(err){ | 630 | if (err) { |
634 | printk(KERN_ERR "eth_setup - Couldn't parse '%s' : %s\n", | 631 | printk(KERN_ERR "eth_setup - Couldn't parse '%s' : %s\n", |
635 | str, error); | 632 | str, error); |
636 | return 1; | 633 | return 1; |
637 | } | 634 | } |
638 | 635 | ||
639 | new = alloc_bootmem(sizeof(*new)); | 636 | new = alloc_bootmem(sizeof(*new)); |
640 | if (new == NULL){ | 637 | if (new == NULL) { |
641 | printk("eth_init : alloc_bootmem failed\n"); | 638 | printk(KERN_ERR "eth_init : alloc_bootmem failed\n"); |
642 | return 1; | 639 | return 1; |
643 | } | 640 | } |
644 | 641 | ||
@@ -661,36 +658,36 @@ static int net_config(char *str, char **error_out) | |||
661 | int n, err; | 658 | int n, err; |
662 | 659 | ||
663 | err = eth_parse(str, &n, &str, error_out); | 660 | err = eth_parse(str, &n, &str, error_out); |
664 | if(err) | 661 | if (err) |
665 | return err; | 662 | return err; |
666 | 663 | ||
667 | /* This string is broken up and the pieces used by the underlying | 664 | /* This string is broken up and the pieces used by the underlying |
668 | * driver. So, it is freed only if eth_setup_common fails. | 665 | * driver. So, it is freed only if eth_setup_common fails. |
669 | */ | 666 | */ |
670 | str = kstrdup(str, GFP_KERNEL); | 667 | str = kstrdup(str, GFP_KERNEL); |
671 | if(str == NULL){ | 668 | if (str == NULL) { |
672 | *error_out = "net_config failed to strdup string"; | 669 | *error_out = "net_config failed to strdup string"; |
673 | return -ENOMEM; | 670 | return -ENOMEM; |
674 | } | 671 | } |
675 | err = !eth_setup_common(str, n); | 672 | err = !eth_setup_common(str, n); |
676 | if(err) | 673 | if (err) |
677 | kfree(str); | 674 | kfree(str); |
678 | return(err); | 675 | return err; |
679 | } | 676 | } |
680 | 677 | ||
681 | static int net_id(char **str, int *start_out, int *end_out) | 678 | static int net_id(char **str, int *start_out, int *end_out) |
682 | { | 679 | { |
683 | char *end; | 680 | char *end; |
684 | int n; | 681 | int n; |
685 | 682 | ||
686 | n = simple_strtoul(*str, &end, 0); | 683 | n = simple_strtoul(*str, &end, 0); |
687 | if((*end != '\0') || (end == *str)) | 684 | if ((*end != '\0') || (end == *str)) |
688 | return -1; | 685 | return -1; |
689 | 686 | ||
690 | *start_out = n; | 687 | *start_out = n; |
691 | *end_out = n; | 688 | *end_out = n; |
692 | *str = end; | 689 | *str = end; |
693 | return n; | 690 | return n; |
694 | } | 691 | } |
695 | 692 | ||
696 | static int net_remove(int n, char **error_out) | 693 | static int net_remove(int n, char **error_out) |
@@ -700,12 +697,12 @@ static int net_remove(int n, char **error_out) | |||
700 | struct uml_net_private *lp; | 697 | struct uml_net_private *lp; |
701 | 698 | ||
702 | device = find_device(n); | 699 | device = find_device(n); |
703 | if(device == NULL) | 700 | if (device == NULL) |
704 | return -ENODEV; | 701 | return -ENODEV; |
705 | 702 | ||
706 | dev = device->dev; | 703 | dev = device->dev; |
707 | lp = dev->priv; | 704 | lp = dev->priv; |
708 | if(lp->fd > 0) | 705 | if (lp->fd > 0) |
709 | return -EBUSY; | 706 | return -EBUSY; |
710 | unregister_netdev(dev); | 707 | unregister_netdev(dev); |
711 | platform_device_unregister(&device->pdev); | 708 | platform_device_unregister(&device->pdev); |
@@ -731,13 +728,13 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
731 | void (*proc)(unsigned char *, unsigned char *, void *); | 728 | void (*proc)(unsigned char *, unsigned char *, void *); |
732 | unsigned char addr_buf[4], netmask_buf[4]; | 729 | unsigned char addr_buf[4], netmask_buf[4]; |
733 | 730 | ||
734 | if(dev->open != uml_net_open) | 731 | if (dev->open != uml_net_open) |
735 | return NOTIFY_DONE; | 732 | return NOTIFY_DONE; |
736 | 733 | ||
737 | lp = dev->priv; | 734 | lp = dev->priv; |
738 | 735 | ||
739 | proc = NULL; | 736 | proc = NULL; |
740 | switch (event){ | 737 | switch (event) { |
741 | case NETDEV_UP: | 738 | case NETDEV_UP: |
742 | proc = lp->add_address; | 739 | proc = lp->add_address; |
743 | break; | 740 | break; |
@@ -745,7 +742,7 @@ static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
745 | proc = lp->delete_address; | 742 | proc = lp->delete_address; |
746 | break; | 743 | break; |
747 | } | 744 | } |
748 | if(proc != NULL){ | 745 | if (proc != NULL) { |
749 | memcpy(addr_buf, &ifa->ifa_address, sizeof(addr_buf)); | 746 | memcpy(addr_buf, &ifa->ifa_address, sizeof(addr_buf)); |
750 | memcpy(netmask_buf, &ifa->ifa_mask, sizeof(netmask_buf)); | 747 | memcpy(netmask_buf, &ifa->ifa_mask, sizeof(netmask_buf)); |
751 | (*proc)(addr_buf, netmask_buf, &lp->user); | 748 | (*proc)(addr_buf, netmask_buf, &lp->user); |
@@ -773,13 +770,13 @@ static int uml_net_init(void) | |||
773 | * addresses which have already been set up get handled properly. | 770 | * addresses which have already been set up get handled properly. |
774 | */ | 771 | */ |
775 | spin_lock(&opened_lock); | 772 | spin_lock(&opened_lock); |
776 | list_for_each(ele, &opened){ | 773 | list_for_each(ele, &opened) { |
777 | lp = list_entry(ele, struct uml_net_private, list); | 774 | lp = list_entry(ele, struct uml_net_private, list); |
778 | ip = lp->dev->ip_ptr; | 775 | ip = lp->dev->ip_ptr; |
779 | if(ip == NULL) | 776 | if (ip == NULL) |
780 | continue; | 777 | continue; |
781 | in = ip->ifa_list; | 778 | in = ip->ifa_list; |
782 | while(in != NULL){ | 779 | while (in != NULL) { |
783 | uml_inetaddr_event(NULL, NETDEV_UP, in); | 780 | uml_inetaddr_event(NULL, NETDEV_UP, in); |
784 | in = in->ifa_next; | 781 | in = in->ifa_next; |
785 | } | 782 | } |
@@ -797,12 +794,12 @@ static void close_devices(void) | |||
797 | struct uml_net_private *lp; | 794 | struct uml_net_private *lp; |
798 | 795 | ||
799 | spin_lock(&opened_lock); | 796 | spin_lock(&opened_lock); |
800 | list_for_each(ele, &opened){ | 797 | list_for_each(ele, &opened) { |
801 | lp = list_entry(ele, struct uml_net_private, list); | 798 | lp = list_entry(ele, struct uml_net_private, list); |
802 | free_irq(lp->dev->irq, lp->dev); | 799 | free_irq(lp->dev->irq, lp->dev); |
803 | if((lp->close != NULL) && (lp->fd >= 0)) | 800 | if ((lp->close != NULL) && (lp->fd >= 0)) |
804 | (*lp->close)(lp->fd, &lp->user); | 801 | (*lp->close)(lp->fd, &lp->user); |
805 | if(lp->remove != NULL) | 802 | if (lp->remove != NULL) |
806 | (*lp->remove)(&lp->user); | 803 | (*lp->remove)(&lp->user); |
807 | } | 804 | } |
808 | spin_unlock(&opened_lock); | 805 | spin_unlock(&opened_lock); |
@@ -812,15 +809,15 @@ __uml_exitcall(close_devices); | |||
812 | 809 | ||
813 | struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra) | 810 | struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra) |
814 | { | 811 | { |
815 | if((skb != NULL) && (skb_tailroom(skb) < extra)){ | 812 | if ((skb != NULL) && (skb_tailroom(skb) < extra)) { |
816 | struct sk_buff *skb2; | 813 | struct sk_buff *skb2; |
817 | 814 | ||
818 | skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC); | 815 | skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC); |
819 | dev_kfree_skb(skb); | 816 | dev_kfree_skb(skb); |
820 | skb = skb2; | 817 | skb = skb2; |
821 | } | 818 | } |
822 | if(skb != NULL) skb_put(skb, extra); | 819 | if (skb != NULL) skb_put(skb, extra); |
823 | return(skb); | 820 | return skb; |
824 | } | 821 | } |
825 | 822 | ||
826 | void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *, | 823 | void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *, |
@@ -832,9 +829,9 @@ void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *, | |||
832 | struct in_ifaddr *in; | 829 | struct in_ifaddr *in; |
833 | unsigned char address[4], netmask[4]; | 830 | unsigned char address[4], netmask[4]; |
834 | 831 | ||
835 | if(ip == NULL) return; | 832 | if (ip == NULL) return; |
836 | in = ip->ifa_list; | 833 | in = ip->ifa_list; |
837 | while(in != NULL){ | 834 | while (in != NULL) { |
838 | memcpy(address, &in->ifa_address, sizeof(address)); | 835 | memcpy(address, &in->ifa_address, sizeof(address)); |
839 | memcpy(netmask, &in->ifa_mask, sizeof(netmask)); | 836 | memcpy(netmask, &in->ifa_mask, sizeof(netmask)); |
840 | (*cb)(address, netmask, arg); | 837 | (*cb)(address, netmask, arg); |
@@ -849,15 +846,15 @@ int dev_netmask(void *d, void *m) | |||
849 | struct in_ifaddr *in; | 846 | struct in_ifaddr *in; |
850 | __be32 *mask_out = m; | 847 | __be32 *mask_out = m; |
851 | 848 | ||
852 | if(ip == NULL) | 849 | if (ip == NULL) |
853 | return(1); | 850 | return 1; |
854 | 851 | ||
855 | in = ip->ifa_list; | 852 | in = ip->ifa_list; |
856 | if(in == NULL) | 853 | if (in == NULL) |
857 | return(1); | 854 | return 1; |
858 | 855 | ||
859 | *mask_out = in->ifa_mask; | 856 | *mask_out = in->ifa_mask; |
860 | return(0); | 857 | return 0; |
861 | } | 858 | } |
862 | 859 | ||
863 | void *get_output_buffer(int *len_out) | 860 | void *get_output_buffer(int *len_out) |
@@ -865,7 +862,7 @@ void *get_output_buffer(int *len_out) | |||
865 | void *ret; | 862 | void *ret; |
866 | 863 | ||
867 | ret = (void *) __get_free_pages(GFP_KERNEL, 0); | 864 | ret = (void *) __get_free_pages(GFP_KERNEL, 0); |
868 | if(ret) *len_out = PAGE_SIZE; | 865 | if (ret) *len_out = PAGE_SIZE; |
869 | else *len_out = 0; | 866 | else *len_out = 0; |
870 | return ret; | 867 | return ret; |
871 | } | 868 | } |
@@ -881,16 +878,16 @@ int tap_setup_common(char *str, char *type, char **dev_name, char **mac_out, | |||
881 | char *remain; | 878 | char *remain; |
882 | 879 | ||
883 | remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL); | 880 | remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL); |
884 | if(remain != NULL){ | 881 | if (remain != NULL) { |
885 | printk("tap_setup_common - Extra garbage on specification : " | 882 | printk(KERN_ERR "tap_setup_common - Extra garbage on " |
886 | "'%s'\n", remain); | 883 | "specification : '%s'\n", remain); |
887 | return(1); | 884 | return 1; |
888 | } | 885 | } |
889 | 886 | ||
890 | return(0); | 887 | return 0; |
891 | } | 888 | } |
892 | 889 | ||
893 | unsigned short eth_protocol(struct sk_buff *skb) | 890 | unsigned short eth_protocol(struct sk_buff *skb) |
894 | { | 891 | { |
895 | return(eth_type_trans(skb, skb->dev)); | 892 | return eth_type_trans(skb, skb->dev); |
896 | } | 893 | } |