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>
This commit is contained in:
committed by
Linus Torvalds
parent
1a80521990
commit
cd1ae0e49b
@ -1,24 +1,20 @@
|
||||
/*
|
||||
* user-mode-linux networking multicast transport
|
||||
* Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org>
|
||||
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
||||
*
|
||||
* based on the existing uml-networking code, which is
|
||||
* Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
|
||||
* Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
|
||||
* James Leu (jleu@mindspring.net).
|
||||
* Copyright (C) 2001 by various other people who didn't put their name here.
|
||||
*
|
||||
* Licensed under the GPL.
|
||||
*/
|
||||
|
||||
#include "linux/kernel.h"
|
||||
#include "linux/init.h"
|
||||
#include "linux/netdevice.h"
|
||||
#include "linux/etherdevice.h"
|
||||
#include "linux/in.h"
|
||||
#include "linux/inet.h"
|
||||
#include "net_kern.h"
|
||||
#include "net_user.h"
|
||||
#include <linux/netdevice.h>
|
||||
#include "mcast.h"
|
||||
#include "net_kern.h"
|
||||
|
||||
struct mcast_init {
|
||||
char *addr;
|
||||
@ -39,26 +35,23 @@ static void mcast_init(struct net_device *dev, void *data)
|
||||
dpri->ttl = init->ttl;
|
||||
dpri->dev = dev;
|
||||
|
||||
printk("mcast backend ");
|
||||
printk("multicast address: %s:%u, TTL:%u ",
|
||||
printk("mcast backend multicast address: %s:%u, TTL:%u\n",
|
||||
dpri->addr, dpri->port, dpri->ttl);
|
||||
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
static int mcast_read(int fd, struct sk_buff **skb, struct uml_net_private *lp)
|
||||
{
|
||||
*skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
|
||||
if(*skb == NULL) return(-ENOMEM);
|
||||
return(net_recvfrom(fd, skb_mac_header(*skb),
|
||||
(*skb)->dev->mtu + ETH_HEADER_OTHER));
|
||||
if (*skb == NULL)
|
||||
return -ENOMEM;
|
||||
return net_recvfrom(fd, skb_mac_header(*skb),
|
||||
(*skb)->dev->mtu + ETH_HEADER_OTHER);
|
||||
}
|
||||
|
||||
static int mcast_write(int fd, struct sk_buff **skb,
|
||||
struct uml_net_private *lp)
|
||||
static int mcast_write(int fd, struct sk_buff **skb, struct uml_net_private *lp)
|
||||
{
|
||||
return mcast_user_write(fd, (*skb)->data, (*skb)->len,
|
||||
(struct mcast_data *) &lp->user);
|
||||
return mcast_user_write(fd, (*skb)->data, (*skb)->len,
|
||||
(struct mcast_data *) &lp->user);
|
||||
}
|
||||
|
||||
static const struct net_kern_info mcast_kern_info = {
|
||||
@ -81,34 +74,34 @@ int mcast_setup(char *str, char **mac_out, void *data)
|
||||
|
||||
remain = split_if_spec(str, mac_out, &init->addr, &port_str, &ttl_str,
|
||||
NULL);
|
||||
if(remain != NULL){
|
||||
if (remain != NULL) {
|
||||
printk(KERN_ERR "mcast_setup - Extra garbage on "
|
||||
"specification : '%s'\n", remain);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(port_str != NULL){
|
||||
|
||||
if (port_str != NULL) {
|
||||
init->port = simple_strtoul(port_str, &last, 10);
|
||||
if((*last != '\0') || (last == port_str)){
|
||||
printk(KERN_ERR "mcast_setup - Bad port : '%s'\n",
|
||||
if ((*last != '\0') || (last == port_str)) {
|
||||
printk(KERN_ERR "mcast_setup - Bad port : '%s'\n",
|
||||
port_str);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ttl_str != NULL){
|
||||
if (ttl_str != NULL) {
|
||||
init->ttl = simple_strtoul(ttl_str, &last, 10);
|
||||
if((*last != '\0') || (last == ttl_str)){
|
||||
printk(KERN_ERR "mcast_setup - Bad ttl : '%s'\n",
|
||||
if ((*last != '\0') || (last == ttl_str)) {
|
||||
printk(KERN_ERR "mcast_setup - Bad ttl : '%s'\n",
|
||||
ttl_str);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Configured mcast device: %s:%u-%u\n", init->addr,
|
||||
init->port, init->ttl);
|
||||
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct transport mcast_transport = {
|
||||
|
Reference in New Issue
Block a user