diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/datagram.c | 2 | ||||
-rw-r--r-- | net/core/dev.c | 100 | ||||
-rw-r--r-- | net/core/dev_mcast.c | 30 | ||||
-rw-r--r-- | net/core/dst.c | 9 | ||||
-rw-r--r-- | net/core/ethtool.c | 10 | ||||
-rw-r--r-- | net/core/filter.c | 8 | ||||
-rw-r--r-- | net/core/gen_estimator.c | 6 | ||||
-rw-r--r-- | net/core/gen_stats.c | 2 | ||||
-rw-r--r-- | net/core/iovec.c | 10 | ||||
-rw-r--r-- | net/core/link_watch.c | 4 | ||||
-rw-r--r-- | net/core/neighbour.c | 58 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 10 | ||||
-rw-r--r-- | net/core/netpoll.c | 18 | ||||
-rw-r--r-- | net/core/pktgen.c | 68 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 2 | ||||
-rw-r--r-- | net/core/scm.c | 12 | ||||
-rw-r--r-- | net/core/skbuff.c | 14 | ||||
-rw-r--r-- | net/core/sock.c | 150 | ||||
-rw-r--r-- | net/core/stream.c | 4 | ||||
-rw-r--r-- | net/core/user_dma.c | 8 | ||||
-rw-r--r-- | net/core/utils.c | 4 | ||||
-rw-r--r-- | net/core/wireless.c | 22 |
22 files changed, 274 insertions, 277 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index 797fdd4352c..186212b5b7d 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -430,7 +430,7 @@ EXPORT_SYMBOL(__skb_checksum_complete); * @skb: skbuff * @hlen: hardware length * @iov: io vector - * + * * Caller _must_ check that skb will fit to this iovec. * * Returns: 0 - success. diff --git a/net/core/dev.c b/net/core/dev.c index 1e94a1b9a0f..cf71614dae9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -255,7 +255,7 @@ static int netdev_nit; * is linked into kernel lists and may not be freed until it has been * removed from the kernel lists. * - * This call does not sleep therefore it can not + * This call does not sleep therefore it can not * guarantee all CPU's that are in middle of receiving packets * will see the new packet type (until the next received packet). */ @@ -282,7 +282,7 @@ void dev_add_pack(struct packet_type *pt) * Remove a protocol handler that was previously added to the kernel * protocol handlers by dev_add_pack(). The passed &packet_type is removed * from the kernel lists and can be freed or reused once this function - * returns. + * returns. * * The packet type might still be in use by receivers * and must not be freed until after all the CPU's have gone @@ -327,7 +327,7 @@ out: void dev_remove_pack(struct packet_type *pt) { __dev_remove_pack(pt); - + synchronize_net(); } @@ -607,7 +607,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype); * @mask: bitmask of bits in if_flags to check * * Search for any interface with the given flags. Returns NULL if a device - * is not found or a pointer to the device. The device returned has + * is not found or a pointer to the device. The device returned has * had a reference added and the pointer is safe until the user calls * dev_put to indicate they have finished with it. */ @@ -802,7 +802,7 @@ void netdev_state_change(struct net_device *dev) void dev_load(const char *name) { - struct net_device *dev; + struct net_device *dev; read_lock(&dev_base_lock); dev = __dev_get_by_name(name); @@ -860,7 +860,7 @@ int dev_open(struct net_device *dev) clear_bit(__LINK_STATE_START, &dev->state); } - /* + /* * If it went open OK then: */ @@ -964,7 +964,7 @@ int dev_close(struct net_device *dev) * is returned on a failure. * * When registered all registration and up events are replayed - * to the new notifier to allow device to have a race free + * to the new notifier to allow device to have a race free * view of the network device list. */ @@ -979,7 +979,7 @@ int register_netdevice_notifier(struct notifier_block *nb) for (dev = dev_base; dev; dev = dev->next) { nb->notifier_call(nb, NETDEV_REGISTER, dev); - if (dev->flags & IFF_UP) + if (dev->flags & IFF_UP) nb->notifier_call(nb, NETDEV_UP, dev); } } @@ -1157,7 +1157,7 @@ void netif_device_attach(struct net_device *dev) if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && netif_running(dev)) { netif_wake_queue(dev); - __netdev_watchdog_up(dev); + __netdev_watchdog_up(dev); } } EXPORT_SYMBOL(netif_device_attach); @@ -1197,7 +1197,7 @@ int skb_checksum_help(struct sk_buff *skb) out_set_summed: skb->ip_summed = CHECKSUM_NONE; -out: +out: return ret; } @@ -1258,7 +1258,7 @@ EXPORT_SYMBOL(skb_gso_segment); void netdev_rx_csum_fault(struct net_device *dev) { if (net_ratelimit()) { - printk(KERN_ERR "%s: hw csum failure.\n", + printk(KERN_ERR "%s: hw csum failure.\n", dev ? dev->name : "<unknown>"); dump_stack(); } @@ -1372,7 +1372,7 @@ gso: if (unlikely(netif_queue_stopped(dev) && skb->next)) return NETDEV_TX_BUSY; } while (skb->next); - + skb->destructor = DEV_GSO_CB(skb)->destructor; out_kfree_skb: @@ -1449,25 +1449,25 @@ int dev_queue_xmit(struct sk_buff *skb) (!(dev->features & NETIF_F_GEN_CSUM) && (!(dev->features & NETIF_F_IP_CSUM) || skb->protocol != htons(ETH_P_IP)))) - if (skb_checksum_help(skb)) - goto out_kfree_skb; + if (skb_checksum_help(skb)) + goto out_kfree_skb; gso: spin_lock_prefetch(&dev->queue_lock); - /* Disable soft irqs for various locks below. Also - * stops preemption for RCU. + /* Disable soft irqs for various locks below. Also + * stops preemption for RCU. */ - rcu_read_lock_bh(); + rcu_read_lock_bh(); - /* Updates of qdisc are serialized by queue_lock. - * The struct Qdisc which is pointed to by qdisc is now a - * rcu structure - it may be accessed without acquiring + /* Updates of qdisc are serialized by queue_lock. + * The struct Qdisc which is pointed to by qdisc is now a + * rcu structure - it may be accessed without acquiring * a lock (but the structure may be stale.) The freeing of the - * qdisc will be deferred until it's known that there are no + * qdisc will be deferred until it's known that there are no * more references to it. - * - * If the qdisc has an enqueue function, we still need to + * + * If the qdisc has an enqueue function, we still need to * hold the queue_lock before calling it, since queue_lock * also serializes access to the device queue. */ @@ -1715,8 +1715,8 @@ static __inline__ int handle_bridge(struct sk_buff **pskb, if (*pt_prev) { *ret = deliver_skb(*pskb, *pt_prev, orig_dev); *pt_prev = NULL; - } - + } + return br_handle_frame_hook(port, pskb); } #else @@ -1728,16 +1728,16 @@ static __inline__ int handle_bridge(struct sk_buff **pskb, * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions * a compare and 2 stores extra right now if we dont have it on * but have CONFIG_NET_CLS_ACT - * NOTE: This doesnt stop any functionality; if you dont have + * NOTE: This doesnt stop any functionality; if you dont have * the ingress scheduler, you just cant add policies on ingress. * */ -static int ing_filter(struct sk_buff *skb) +static int ing_filter(struct sk_buff *skb) { struct Qdisc *q; struct net_device *dev = skb->dev; int result = TC_ACT_OK; - + if (dev->qdisc_ingress) { __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); if (MAX_RED_LOOP < ttl++) { @@ -1801,7 +1801,7 @@ int netif_receive_skb(struct sk_buff *skb) list_for_each_entry_rcu(ptype, &ptype_all, list) { if (!ptype->dev || ptype->dev == skb->dev) { - if (pt_prev) + if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } @@ -1833,7 +1833,7 @@ ncls: list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { if (ptype->type == type && (!ptype->dev || ptype->dev == skb->dev)) { - if (pt_prev) + if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } @@ -2061,7 +2061,7 @@ static int dev_ifconf(char __user *arg) total += done; } } - } + } /* * All done. Write the updated control block back to the caller. @@ -2154,7 +2154,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos) struct netif_rx_stats *rc = NULL; while (*pos < NR_CPUS) - if (cpu_online(*pos)) { + if (cpu_online(*pos)) { rc = &per_cpu(netdev_rx_stat, *pos); break; } else @@ -2200,7 +2200,7 @@ static int dev_seq_open(struct inode *inode, struct file *file) return seq_open(file, &dev_seq_ops); } -static struct file_operations dev_seq_fops = { +static const struct file_operations dev_seq_fops = { .owner = THIS_MODULE, .open = dev_seq_open, .read = seq_read, @@ -2220,7 +2220,7 @@ static int softnet_seq_open(struct inode *inode, struct file *file) return seq_open(file, &softnet_seq_ops); } -static struct file_operations softnet_seq_fops = { +static const struct file_operations softnet_seq_fops = { .owner = THIS_MODULE, .open = softnet_seq_open, .read = seq_read, @@ -2282,7 +2282,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master) } slave->master = master; - + synchronize_net(); if (old) @@ -2319,13 +2319,13 @@ void dev_set_promiscuity(struct net_device *dev, int inc) dev_mc_upload(dev); printk(KERN_INFO "device %s %s promiscuous mode\n", dev->name, (dev->flags & IFF_PROMISC) ? "entered" : - "left"); + "left"); audit_log(current->audit_context, GFP_ATOMIC, AUDIT_ANOM_PROMISCUOUS, "dev=%s prom=%d old_prom=%d auid=%u", dev->name, (dev->flags & IFF_PROMISC), (old_flags & IFF_PROMISC), - audit_get_loginuid(current->audit_context)); + audit_get_loginuid(current->audit_context)); } } @@ -2816,7 +2816,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg) rtnl_unlock(); if (IW_IS_GET(cmd) && copy_to_user(arg, &ifr, - sizeof(struct ifreq))) + sizeof(struct ifreq))) ret = -EFAULT; return ret; } @@ -2906,7 +2906,7 @@ int register_netdevice(struct net_device *dev) goto out; } } - + if (!dev_valid_name(dev->name)) { ret = -EINVAL; goto out; @@ -2923,9 +2923,9 @@ int register_netdevice(struct net_device *dev) = hlist_entry(p, struct net_device, name_hlist); if (!strncmp(d->name, dev->name, IFNAMSIZ)) { ret = -EEXIST; - goto out; + goto out; } - } + } /* Fix illegal SG+CSUM combinations. */ if ((dev->features & NETIF_F_SG) && @@ -3024,7 +3024,7 @@ int register_netdev(struct net_device *dev) if (err < 0) goto out; } - + err = register_netdevice(dev); out: rtnl_unlock(); @@ -3041,7 +3041,7 @@ EXPORT_SYMBOL(register_netdev); * for netdevice notification, and cleanup and put back the * reference if they receive an UNREGISTER event. * We can get stuck here if buggy protocols don't correctly - * call dev_put. + * call dev_put. */ static void netdev_wait_allrefs(struct net_device *dev) { @@ -3205,8 +3205,8 @@ EXPORT_SYMBOL(alloc_netdev); * free_netdev - free network device * @dev: device * - * This function does the last stage of destroying an allocated device - * interface. The reference to the device object is released. + * This function does the last stage of destroying an allocated device + * interface. The reference to the device object is released. * If this is the last reference then it will be freed. */ void free_netdev(struct net_device *dev) @@ -3227,9 +3227,9 @@ void free_netdev(struct net_device *dev) kfree((char *)dev - dev->padded); #endif } - + /* Synchronize with packet receive processing. */ -void synchronize_net(void) +void synchronize_net(void) { might_sleep(); synchronize_rcu(); @@ -3291,12 +3291,12 @@ void unregister_netdevice(struct net_device *dev) /* Shutdown queueing discipline. */ dev_shutdown(dev); - + /* Notify protocols, that we are about to destroy this device. They should clean all the things. */ raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); - + /* * Flush the multicast chain */ @@ -3483,7 +3483,7 @@ static int __init net_dev_init(void) goto out; INIT_LIST_HEAD(&ptype_all); - for (i = 0; i < 16; i++) + for (i = 0; i < 16; i++) INIT_LIST_HEAD(&ptype_base[i]); for (i = 0; i < ARRAY_SIZE(dev_name_head); i++) diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index b22648d04d3..c4e754e86e9 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c @@ -1,12 +1,12 @@ /* - * Linux NET3: Multicast List maintenance. + * Linux NET3: Multicast List maintenance. * * Authors: - * Tim Kordas <tjk@nostromo.eeap.cwru.edu> + * Tim Kordas <tjk@nostromo.eeap.cwru.edu> * Richard Underwood <richard@wuzz.demon.co.uk> * * Stir fried together from the IP multicast and CAP patches above - * Alan Cox <Alan.Cox@linux.org> + * Alan Cox <Alan.Cox@linux.org> * * Fixes: * Alan Cox : Update the device on a real delete @@ -50,11 +50,11 @@ /* - * Device multicast list maintenance. + * Device multicast list maintenance. * - * This is used both by IP and by the user level maintenance functions. - * Unlike BSD we maintain a usage count on a given multicast address so - * that a casual user application can add/delete multicasts used by + * This is used both by IP and by the user level maintenance functions. + * Unlike BSD we maintain a usage count on a given multicast address so + * that a casual user application can add/delete multicasts used by * protocols without doing damage to the protocols when it deletes the * entries. It also helps IP as it tracks overlapping maps. * @@ -67,7 +67,7 @@ /* * Update the multicast list into the physical NIC controller. */ - + static void __dev_mc_upload(struct net_device *dev) { /* Don't do anything till we up the interface @@ -100,7 +100,7 @@ void dev_mc_upload(struct net_device *dev) /* * Delete a device level multicast */ - + int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) { int err = 0; @@ -137,7 +137,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) * loaded filter is now wrong. Fix it */ __dev_mc_upload(dev); - + netif_tx_unlock_bh(dev); return 0; } @@ -151,7 +151,7 @@ done: /* * Add a device level multicast */ - + int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) { int err = 0; @@ -187,7 +187,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) dev->mc_count++; __dev_mc_upload(dev); - + netif_tx_unlock_bh(dev); return 0; @@ -204,7 +204,7 @@ done: void dev_mc_discard(struct net_device *dev) { netif_tx_lock_bh(dev); - + while (dev->mc_list != NULL) { struct dev_mc_list *tmp = dev->mc_list; dev->mc_list = tmp->next; @@ -225,7 +225,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos) read_lock(&dev_base_lock); for (dev = dev_base; dev; dev = dev->next) { - if (off++ == *pos) + if (off++ == *pos) return dev; } return NULL; @@ -277,7 +277,7 @@ static int dev_mc_seq_open(struct inode *inode, struct file *file) return seq_open(file, &dev_mc_seq_ops); } -static struct file_operations dev_mc_seq_fops = { +static const struct file_operations dev_mc_seq_fops = { .owner = THIS_MODULE, .open = dev_mc_seq_open, .read = seq_read, diff --git a/net/core/dst.c b/net/core/dst.c index 1a53fb39b7e..61dd9d3951f 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -29,7 +29,7 @@ * 4) All operations modify state, so a spinlock is used. */ static struct dst_entry *dst_garbage_list; -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 static atomic_t dst_total = ATOMIC_INIT(0); #endif static DEFINE_SPINLOCK(dst_lock); @@ -132,17 +132,16 @@ void * dst_alloc(struct dst_ops * ops) if (ops->gc()) return NULL; } - dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); + dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC); if (!dst) return NULL; - memset(dst, 0, ops->entry_size); atomic_set(&dst->__refcnt, 0); dst->ops = ops; dst->lastuse = jiffies; dst->path = dst; dst->input = dst_discard_in; dst->output = dst_discard_out; -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 atomic_inc(&dst_total); #endif atomic_inc(&ops->entries); @@ -203,7 +202,7 @@ again: dst->ops->destroy(dst); if (dst->dev) dev_put(dst->dev); -#if RT_CACHE_DEBUG >= 2 +#if RT_CACHE_DEBUG >= 2 atomic_dec(&dst_total); #endif kmem_cache_free(dst->ops->kmem_cachep, dst); diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 87dc556fd9d..6168edd137d 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -17,7 +17,7 @@ #include <linux/netdevice.h> #include <asm/uaccess.h> -/* +/* * Some useful ethtool_ops methods that're device independent. * If we find that all drivers want to do the same thing here, * we can turn these into dev_() function calls. @@ -87,12 +87,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a unsigned char len = dev->addr_len; if ( addr->size < len ) return -ETOOSMALL; - + addr->size = len; memcpy(data, dev->perm_addr, len); return 0; } - + u32 ethtool_op_get_ufo(struct net_device *dev) { @@ -550,7 +550,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr) if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; - if (edata.data && + if (edata.data && !(dev->features & NETIF_F_ALL_CSUM)) return -EINVAL; @@ -951,7 +951,7 @@ int dev_ethtool(struct ifreq *ifr) default: rc = -EOPNOTSUPP; } - + if(dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev); diff --git a/net/core/filter.c b/net/core/filter.c index 0df843b667f..8123a31d919 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -53,7 +53,7 @@ static void *__load_pointer(struct sk_buff *skb, int k) } static inline void *load_pointer(struct sk_buff *skb, int k, - unsigned int size, void *buffer) + unsigned int size, void *buffer) { if (k >= 0) return skb_header_pointer(skb, k, size, buffer); @@ -91,7 +91,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int */ for (pc = 0; pc < flen; pc++) { fentry = &filter[pc]; - + switch (fentry->code) { case BPF_ALU|BPF_ADD|BPF_X: A += X; @@ -399,7 +399,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) */ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) { - struct sk_filter *fp; + struct sk_filter *fp; unsigned int fsize = sizeof(struct sock_filter) * fprog->len; int err; @@ -411,7 +411,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) if (!fp) return -ENOMEM; if (copy_from_user(fp->insns, fprog->filter, fsize)) { - sock_kfree_s(sk, fp, fsize+sizeof(*fp)); + sock_kfree_s(sk, fp, fsize+sizeof(*fp)); return -EFAULT; } diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 3cad026764f..17daf4c9f79 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -144,7 +144,7 @@ static void est_timer(unsigned long arg) * configuration TLV is created. Upon each interval, the latest statistics * will be read from &bstats and the estimated rate will be stored in * &rate_est with the statistics lock grabed during this period. - * + * * Returns 0 on success or a negative error code. */ int gen_new_estimator(struct gnet_stats_basic *bstats, @@ -231,7 +231,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats, * * Replaces the configuration of a rate estimator by calling * gen_kill_estimator() and gen_new_estimator(). - * + * * Returns 0 on success or a negative error code. */ int @@ -242,7 +242,7 @@ gen_replace_estimator(struct gnet_stats_basic *bstats, gen_kill_estimator(bstats, rate_est); return gen_new_estimator(bstats, rate_est, stats_lock, opt); } - + EXPORT_SYMBOL(gen_kill_estimator); EXPORT_SYMBOL(gen_new_estimator); diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index 8f21490355f..259473d0559 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -57,7 +57,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, int xstats_type, spinlock_t *lock, struct gnet_dump *d) { memset(d, 0, sizeof(*d)); - + spin_lock_bh(lock); d->lock = lock; if (type) diff --git a/net/core/iovec.c b/net/core/iovec.c index 04b249c40b5..4fb1cb9b79b 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -40,7 +40,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) { int size, err, ct; - + if (m->msg_namelen) { if (mode == VERIFY_READ) { err = move_addr_to_kernel(m->msg_name, m->msg_namelen, @@ -79,7 +79,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) * * Note: this modifies the original iovec. */ - + int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) { while (len > 0) { @@ -103,7 +103,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) * * Note: this modifies the original iovec. */ - + int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) { while (len > 0) { @@ -209,7 +209,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, if (partial_cnt) { copy -= partial_cnt; if (copy_from_user(kdata + copy, base + copy, - partial_cnt)) + partial_cnt)) goto out_fault; } } @@ -224,7 +224,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, kdata += copy + partial_cnt; iov++; } - *csump = csum; + *csump = csum; out: return err; diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 549a2ce951b..8b45c9d3b24 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -124,7 +124,7 @@ void linkwatch_run_queue(void) dev_put(dev); } -} +} static void linkwatch_event(struct work_struct *dummy) @@ -133,7 +133,7 @@ static void linkwatch_event(struct work_struct *dummy) * per second so that a runaway driver does not * cause a storm of messages on the netlink * socket - */ + */ linkwatch_nextevent = jiffies + HZ; clear_bit(LW_RUNNING, &linkwatch_flags); diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 054d46493d2..512eed91785 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -63,7 +63,7 @@ void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); static struct neigh_table *neigh_tables; #ifdef CONFIG_PROC_FS -static struct file_operations neigh_stat_seq_fops; +static const struct file_operations neigh_stat_seq_fops; #endif /* @@ -251,12 +251,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl) goto out_entries; } - n = kmem_cache_alloc(tbl->kmem_cachep, GFP_ATOMIC); + n = kmem_cache_zalloc(tbl->kmem_cachep, GFP_ATOMIC); if (!n) goto out_entries; - memset(n, 0, tbl->entry_size); - skb_queue_head_init(&n->arp_queue); rwlock_init(&n->lock); n->updated = n->used = now; @@ -345,7 +343,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, struct neighbour *n; int key_len = tbl->key_len; u32 hash_val = tbl->hash(pkey, dev); - + NEIGH_CACHE_STAT_INC(tbl, lookups); read_lock_bh(&tbl->lock); @@ -687,9 +685,9 @@ next_elt: np = &n->next; } - /* Cycle through all hash buckets every base_reachable_time/2 ticks. - * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 - * base_reachable_time. + /* Cycle through all hash buckets every base_reachable_time/2 ticks. + * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 + * base_reachable_time. */ expire = tbl->parms.base_reachable_time >> 1; expire /= (tbl->hash_mask + 1); @@ -744,7 +742,7 @@ static void neigh_timer_handler(unsigned long arg) } if (state & NUD_REACHABLE) { - if (time_before_eq(now, + if (time_before_eq(now, neigh->confirmed + neigh->parms->reachable_time)) { NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); next = neigh->confirmed + neigh->parms->reachable_time; @@ -763,7 +761,7 @@ static void neigh_timer_handler(unsigned long arg) notify = 1; } } else if (state & NUD_DELAY) { - if (time_before_eq(now, + if (time_before_eq(now, neigh->confirmed + neigh->parms->delay_probe_time)) { NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); neigh->nud_state = NUD_REACHABLE; @@ -849,7 +847,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) goto out_unlock_bh; now = jiffies; - + if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { if (neigh->parms->mcast_probes + neigh->parms->app_probes) { atomic_set(&neigh->probes, neigh->parms->ucast_probes); @@ -917,13 +915,13 @@ static void neigh_update_hhs(struct neighbour *neigh) NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, if it is different. NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" - lladdr instead of overriding it + lladdr instead of overriding it if it is different. It also allows to retain current state if lladdr is unchanged. NEIGH_UPDATE_F_ADMIN means that the change is administrative. - NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing + NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing NTF_ROUTER flag. NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as a router. @@ -946,7 +944,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, old = neigh->nud_state; err = -EPERM; - if (!(flags & NEIGH_UPDATE_F_ADMIN) && + if (!(flags & NEIGH_UPDATE_F_ADMIN) && (old & (NUD_NOARP | NUD_PERMANENT))) goto out; @@ -970,7 +968,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, - compare new & old - if they are different, check override flag */ - if ((old & NUD_VALID) && + if ((old & NUD_VALID) && !memcmp(lladdr, neigh->ha, dev->addr_len)) lladdr = neigh->ha; } else { @@ -1014,8 +1012,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, neigh_del_timer(neigh); if (new & NUD_IN_TIMER) { neigh_hold(neigh); - neigh_add_timer(neigh, (jiffies + - ((new & NUD_REACHABLE) ? + neigh_add_timer(neigh, (jiffies + + ((new & NUD_REACHABLE) ? neigh->parms->reachable_time : 0))); } @@ -1077,7 +1075,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl, struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, lladdr || !dev->addr_len); if (neigh) - neigh_update(neigh, lladdr, NUD_STALE, + neigh_update(neigh, lladdr, NUD_STALE, NEIGH_UPDATE_F_OVERRIDE); return neigh; } @@ -1129,7 +1127,7 @@ int neigh_compat_output(struct sk_buff *skb) if (dev->hard_header && dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, - skb->len) < 0 && + skb->len) < 0 && dev->rebuild_header(skb)) return 0; @@ -1349,10 +1347,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) tbl->stats = alloc_percpu(struct neigh_statistics); if (!tbl->stats) panic("cannot create neighbour cache statistics"); - + #ifdef CONFIG_PROC_FS tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat); - if (!tbl->pde) + if (!tbl->pde) panic("cannot create neighbour proc dir entry"); tbl->pde->proc_fops = &neigh_stat_seq_fops; tbl->pde->data = tbl; @@ -1567,7 +1565,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) err = -ENOENT; goto out_dev_put; } - + neigh = __neigh_lookup_errno(tbl, dst, dev); if (IS_ERR(neigh)) { err = PTR_ERR(neigh); @@ -1744,12 +1742,12 @@ errout: nlmsg_cancel(skb, nlh); return -EMSGSIZE; } - + static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, int ifindex) { struct neigh_parms *p; - + for (p = &tbl->parms; p; p = p->next) if ((p->dev && p->dev->ifindex == ifindex) || (!p->dev && !ifindex)) @@ -1815,7 +1813,7 @@ int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) goto errout_locked; } - /* + /* * We acquire tbl->lock to be nice to the periodic timers and * make sure they always see a consistent set of values. */ @@ -2323,7 +2321,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) return SEQ_START_TOKEN; - + for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) { if (!cpu_possible(cpu)) continue; @@ -2405,7 +2403,7 @@ static int neigh_stat_seq_open(struct inode *inode, struct file *file) return ret; }; -static struct file_operations neigh_stat_seq_fops = { +static const struct file_operations neigh_stat_seq_fops = { .owner = THIS_MODULE, .open = neigh_stat_seq_open, .read = seq_read, @@ -2631,7 +2629,7 @@ static struct neigh_sysctl_table { }; int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, - int p_id, int pdev_id, char *p_name, + int p_id, int pdev_id, char *p_name, proc_handler *handler, ctl_handler *strategy) { struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, @@ -2663,7 +2661,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, t->neigh_vars[14].procname = NULL; t->neigh_vars[15].procname = NULL; } else { - dev_name_source = t->neigh_dev[0].procname; + dev_name_source = t->neigh_dev[0].procname; t->neigh_vars[12].data = (int *)(p + 1); t->neigh_vars[13].data = (int *)(p + 1) + 1; t->neigh_vars[14].data = (int *)(p + 1) + 2; @@ -2698,7 +2696,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, goto free; } - t->neigh_dev[0].procname = dev_name; + t->neigh_dev[0].procname = dev_name; t->neigh_neigh_dir[0].ctl_name = pdev_id; diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index cd59ac62009..4cbb1290a6a 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -2,7 +2,7 @@ * net-sysfs.c - network device class and attributes * * Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org> - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -23,7 +23,7 @@ static const char fmt_long_hex[] = "%#lx\n"; static const char fmt_dec[] = "%d\n"; static const char fmt_ulong[] = "%lu\n"; -static inline int dev_isalive(const struct net_device *dev) +static inline int dev_isalive(const struct net_device *dev) { return dev->reg_state <= NETREG_REGISTERED; } @@ -265,7 +265,7 @@ static ssize_t netstat_show(const struct device *d, read_lock(&dev_base_lock); if (dev_isalive(dev) && dev->get_stats && - (stats = (*dev->get_stats)(dev))) + (stats = (*dev->get_stats)(dev))) ret = sprintf(buf, fmt_ulong, *(unsigned long *)(((u8 *) stats) + offset)); @@ -349,7 +349,7 @@ static ssize_t wireless_show(struct device *d, char *buf, struct net_device *dev = to_net_dev(d); const struct iw_statistics *iw = NULL; ssize_t ret = -EINVAL; - + read_lock(&dev_base_lock); if (dev_isalive(dev)) { if(dev->wireless_handlers && @@ -430,7 +430,7 @@ static int netdev_uevent(struct device *d, char **envp, #endif /* - * netdev_release -- destroy and free a dead device. + * netdev_release -- destroy and free a dead device. * Called when last reference to device kobject is gone. */ static void netdev_release(struct device *d) diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 823215d8e90..da1019451cc 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -237,13 +237,13 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { int status = NETDEV_TX_BUSY; unsigned long tries; - struct net_device *dev = np->dev; - struct netpoll_info *npinfo = np->dev->npinfo; + struct net_device *dev = np->dev; + struct netpoll_info *npinfo = np->dev->npinfo; - if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { - __kfree_skb(skb); - return; - } + if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { + __kfree_skb(skb); + return; + } /* don't get messages out of order, and no recursion */ if (skb_queue_len(&npinfo->txq) == 0 && @@ -676,7 +676,7 @@ int netpoll_setup(struct netpoll *np) } atleast = jiffies + HZ/10; - atmost = jiffies + 4*HZ; + atmost = jiffies + 4*HZ; while (!netif_carrier_ok(ndev)) { if (time_after(jiffies, atmost)) { printk(KERN_NOTICE @@ -772,9 +772,9 @@ void netpoll_cleanup(struct netpoll *np) np->dev->npinfo = NULL; if (atomic_dec_and_test(&npinfo->refcnt)) { skb_queue_purge(&npinfo->arp_tx); - skb_queue_purge(&npinfo->txq); + skb_queue_purge(&npinfo->txq); cancel_rearming_delayed_work(&npinfo->tx_work); - flush_scheduled_work(); + flush_scheduled_work(); kfree(npinfo); } diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 04d4b93c68e..74a9a32b906 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -15,7 +15,7 @@ * * * A tool for loading the network with preconfigurated packets. - * The tool is implemented as a linux module. Parameters are output + * The tool is implemented as a linux module. Parameters are output * device, delay (to hard_xmit), number of packets, and whether * to use multiple SKBs or just the same one. * pktgen uses the installed interface's output routine. @@ -44,14 +44,14 @@ * * Add IOCTL interface to easily get counters & configuration. * --Ben Greear <greearb@candelatech.com> * - * Renamed multiskb to clone_skb and cleaned up sending core for two distinct - * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 + * Renamed multiskb to clone_skb and cleaned up sending core for two distinct + * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 * as a "fastpath" with a configurable number of clones after alloc's. - * clone_skb=0 means all packets are allocated this also means ranges time - * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 + * clone_skb=0 means all packets are allocated this also means ranges time + * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 * clones. * - * Also moved to /proc/net/pktgen/ + * Also moved to /proc/net/pktgen/ * --ro * * Sept 10: Fixed threading/locking. Lots of bone-headed and more clever @@ -60,28 +60,28 @@ * * Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br) * - * + * * 021124 Finished major redesign and rewrite for new functionality. * See Documentation/networking/pktgen.txt for how to use this. * * The new operation: - * For each CPU one thread/process is created at start. This process checks - * for running devices in the if_list and sends packets until count is 0 it - * also the thread checks the thread->control which is used for inter-process - * communication. controlling process "posts" operations to the threads this + * For each CPU one thread/process is created at start. This process checks + * for running devices in the if_list and sends packets until count is 0 it + * also the thread checks the thread->control which is used for inter-process + * communication. controlling process "posts" operations to the threads this * way. The if_lock should be possible to remove when add/rem_device is merged * into this too. * - * By design there should only be *one* "controlling" process. In practice - * multiple write accesses gives unpredictable result. Understood by "write" + * By design there should only be *one* "controlling" process. In practice + * multiple write accesses gives unpredictable result. Understood by "write" * to /proc gives result code thats should be read be the "writer". * For practical use this should be no problem. * - * Note when adding devices to a specific CPU there good idea to also assign - * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. + * Note when adding devices to a specific CPU there good idea to also assign + * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. * --ro * - * Fix refcount off by one if first packet fails, potential null deref, + * Fix refcount off by one if first packet fails, potential null deref, * memleak 030710- KJP * * First "ranges" functionality for ipv6 030726 --ro @@ -89,22 +89,22 @@ * Included flow support. 030802 ANK. * * Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org> - * + * * Remove if fix from added Harald Welte <laforge@netfilter.org> 040419 * ia64 compilation fix from Aron Griffis <aron@hp.com> 040604 * - * New xmit() return, do_div and misc clean up by Stephen Hemminger + * New xmit() return, do_div and misc clean up by Stephen Hemminger * <shemminger@osdl.org> 040923 * - * Randy Dunlap fixed u64 printk compiler waring + * Randy Dunlap fixed u64 printk compiler waring * * Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org> * New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213 * - * Corrections from Nikolai Malykh (nmalykh@bilim.com) + * Corrections from Nikolai Malykh (nmalykh@bilim.com) * Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230 * - * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> + * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> * 050103 * * MPLS support by Steven Whitehouse <steve@chygwyn.com> @@ -456,7 +456,7 @@ static inline __u64 pg_div64(__u64 n, __u64 base) /* * How do we know if the architecture we are running on * supports division with 64 bit base? - * + * */ #if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__) @@ -529,7 +529,7 @@ static struct notifier_block pktgen_notifier_block = { }; /* - * /proc handling functions + * /proc handling functions * */ @@ -579,7 +579,7 @@ static int pgctrl_open(struct inode *inode, struct file *file) return single_open(file, pgctrl_show, PDE(inode)->data); } -static struct file_operations pktgen_fops = { +static const struct file_operations pktgen_fops = { .owner = THIS_MODULE, .open = pgctrl_open, .read = seq_read, @@ -1672,7 +1672,7 @@ static int pktgen_if_open(struct inode *inode, struct file *file) return single_open(file, pktgen_if_show, PDE(inode)->data); } -static struct file_operations pktgen_if_fops = { +static const struct file_operations pktgen_if_fops = { .owner = THIS_MODULE, .open = pktgen_if_open, .read = seq_read, @@ -1815,7 +1815,7 @@ static int pktgen_thread_open(struct inode *inode, struct file *file) return single_open(file, pktgen_thread_show, PDE(inode)->data); } -static struct file_operations pktgen_thread_fops = { +static const struct file_operations pktgen_thread_fops = { .owner = THIS_MODULE, .open = pktgen_thread_open, .read = seq_read, @@ -1979,7 +1979,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) if (pkt_dev->flags & F_IPV6) { /* - * Skip this automatic address setting until locks or functions + * Skip this automatic address setting until locks or functions * gets exported */ @@ -2477,10 +2477,10 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, } /* - * scan_ip6, fmt_ip taken from dietlibc-0.21 + * scan_ip6, fmt_ip taken from dietlibc-0.21 * Author Felix von Leitner <felix-dietlibc@fefe.de> * - * Slightly modified for kernel. + * Slightly modified for kernel. * Should be candidate for net/ipv4/utils.c * --ro */ @@ -3256,7 +3256,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) out:; } -/* +/* * Main loop of the thread goes here */ @@ -3365,8 +3365,8 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, return pkt_dev; } -/* - * Adds a dev at front of if_list. +/* + * Adds a dev at front of if_list. */ static int add_dev_to_thread(struct pktgen_thread *t, @@ -3510,8 +3510,8 @@ static int __init pktgen_create_thread(int cpu) return 0; } -/* - * Removes a device from the thread if_list. +/* + * Removes a device from the thread if_list. */ static void _rem_dev_from_if_list(struct pktgen_thread *t, struct pktgen_dev *pkt_dev) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 9bf9ae05f15..ee5a787271f 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -874,7 +874,7 @@ void __init rtnetlink_init(void) panic("rtnetlink_init: cannot allocate rta_buf\n"); rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, - THIS_MODULE); + THIS_MODULE); if (rtnl == NULL) panic("rtnetlink_init: cannot initialize rtnetlink\n"); netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); diff --git a/net/core/scm.c b/net/core/scm.c index 271cf060ef8..292ad8d5ad7 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -36,7 +36,7 @@ /* - * Only allow a user to send credentials, that they could set with + * Only allow a user to send credentials, that they could set with * setu(g)id. */ @@ -79,11 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) if (fpl->count + num > SCM_MAX_FD) return -EINVAL; - + /* * Verify the descriptors and increment the usage count. */ - + for (i=0; i< num; i++) { int fd = fdp[i]; @@ -123,7 +123,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) /* The first check was omitted in <= 2.2.5. The reasoning was that parser checks cmsg_len in any case, so that additional check would be work duplication. - But if cmsg_level is not SOL_SOCKET, we do not check + But if cmsg_level is not SOL_SOCKET, we do not check for too short ancillary data object at all! Oops. OK, let's add it... */ @@ -159,7 +159,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) p->fp = NULL; } return 0; - + error: scm_destroy(p); return err; @@ -189,7 +189,7 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data) err = -EFAULT; if (copy_to_user(cm, &cmhdr, sizeof cmhdr)) - goto out; + goto out; if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr))) goto out; cmlen = CMSG_SPACE(len); diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f3404ae9f19..3d564686902 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -88,7 +88,7 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; void skb_over_panic(struct sk_buff *skb, int sz, void *here) { printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " - "data:%p tail:%p end:%p dev:%s\n", + "data:%p tail:%p end:%p dev:%s\n", here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, skb->dev ? skb->dev->name : "<NULL>"); BUG(); @@ -106,7 +106,7 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) void skb_under_panic(struct sk_buff *skb, int sz, void *here) { printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " - "data:%p tail:%p end:%p dev:%s\n", + "data:%p tail:%p end:%p dev:%s\n", here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, skb->dev ? skb->dev->name : "<NULL>"); BUG(); @@ -271,7 +271,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; struct sk_buff *skb; - skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); + skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); if (likely(skb)) { skb_reserve(skb, NET_SKB_PAD); skb->dev = dev; @@ -819,12 +819,12 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, * * May return error in out of memory cases. The skb is freed on error. */ - + int skb_pad(struct sk_buff *skb, int pad) { int err; int ntail; - + /* If the skbuff is non linear tailroom is always zero.. */ if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) { memset(skb->data+skb->len, 0, pad); @@ -851,8 +851,8 @@ int skb_pad(struct sk_buff *skb, int pad) free_skb: kfree_skb(skb); return err; -} - +} + /* Trims skb to length len. It can change skb pointers. */ diff --git a/net/core/sock.c b/net/core/sock.c index 0ed5b4f0bc4..e9986acdd0a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -34,7 +34,7 @@ * Alan Cox : TCP ack handling is buggy, the DESTROY timer * was buggy. Put a remove_sock() in the handler * for memory when we hit 0. Also altered the timer - * code. The ACK stuff can wait and needs major + * code. The ACK stuff can wait and needs major * TCP layer surgery. * Alan Cox : Fixed TCP ack bug, removed remove sock * and fixed timer/inet_bh race. @@ -217,8 +217,8 @@ static void sock_warn_obsolete_bsdism(const char *name) { static int warned; static char warncomm[TASK_COMM_LEN]; - if (strcmp(warncomm, current->comm) && warned < 5) { - strcpy(warncomm, current->comm); + if (strcmp(warncomm, current->comm) && warned < 5) { + strcpy(warncomm, current->comm); printk(KERN_WARNING "process `%s' is using obsolete " "%s SO_BSDCOMPAT\n", warncomm, name); warned++; @@ -226,8 +226,8 @@ static void sock_warn_obsolete_bsdism(const char *name) } static void sock_disable_timestamp(struct sock *sk) -{ - if (sock_flag(sk, SOCK_TIMESTAMP)) { +{ + if (sock_flag(sk, SOCK_TIMESTAMP)) { sock_reset_flag(sk, SOCK_TIMESTAMP); net_disable_timestamp(); } @@ -347,7 +347,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, int valbool; struct linger ling; int ret = 0; - + /* * Options without arguments */ @@ -360,20 +360,20 @@ int sock_setsockopt(struct socket *sock, int level, int optname, return 0; } #endif - - if(optlen<sizeof(int)) - return(-EINVAL); - + + if(optlen<sizeof(int)) + return(-EINVAL); + if (get_user(val, (int __user *)optval)) return -EFAULT; - - valbool = val?1:0; + + valbool = val?1:0; lock_sock(sk); - switch(optname) - { - case SO_DEBUG: + switch(optname) + { + case SO_DEBUG: if(val && !capable(CAP_NET_ADMIN)) { ret = -EACCES; @@ -389,7 +389,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, case SO_TYPE: case SO_ERROR: ret = -ENOPROTOOPT; - break; + break; case SO_DONTROUTE: if (valbool) sock_set_flag(sk, SOCK_LOCALROUTE); @@ -404,7 +404,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, about it this is right. Otherwise apps have to play 'guess the biggest size' games. RCVBUF/SNDBUF are treated in BSD as hints */ - + if (val > sysctl_wmem_max) val = sysctl_wmem_max; set_sndbuf: @@ -433,7 +433,7 @@ set_sndbuf: about it this is right. Otherwise apps have to play 'guess the biggest size' games. RCVBUF/SNDBUF are treated in BSD as hints */ - + if (val > sysctl_rmem_max) val = sysctl_rmem_max; set_rcvbuf: @@ -474,16 +474,16 @@ set_rcvbuf: sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); break; - case SO_OOBINLINE: + case SO_OOBINLINE: sock_valbool_flag(sk, SOCK_URGINLINE, valbool); break; - case SO_NO_CHECK: + case SO_NO_CHECK: sk->sk_no_check = valbool; break; case SO_PRIORITY: - if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) + if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) sk->sk_priority = val; else ret = -EPERM; @@ -547,9 +547,9 @@ set_rcvbuf: #ifdef CONFIG_NETDEVICES case SO_BINDTODEVICE: { - char devname[IFNAMSIZ]; + char devname[IFNAMSIZ]; - /* Sorry... */ + /* Sorry... */ if (!capable(CAP_NET_RAW)) { ret = -EPERM; break; @@ -557,9 +557,9 @@ set_rcvbuf: /* Bind this socket to a particular device like "eth0", * as specified in the passed interface name. If the - * name is "" or the option length is zero the socket - * is not bound. - */ + * name is "" or the option length is zero the socket + * is not bound. + */ if (!valbool) { sk->sk_bound_dev_if = 0; @@ -608,7 +608,7 @@ set_rcvbuf: case SO_DETACH_FILTER: rcu_read_lock_bh(); filter = rcu_dereference(sk->sk_filter); - if (filter) { + if (filter) { rcu_assign_pointer(sk->sk_filter, NULL); sk_filter_release(sk, filter); rcu_read_unlock_bh(); @@ -628,9 +628,9 @@ set_rcvbuf: /* We implement the SO_SNDLOWAT etc to not be settable (1003.1g 5.3) */ default: - ret = -ENOPROTOOPT; + ret = -ENOPROTOOPT; break; - } + } release_sock(sk); return ret; } @@ -640,32 +640,32 @@ int sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; - + union { - int val; - struct linger ling; + int val; + struct linger ling; struct timeval tm; } v; - + unsigned int lv = sizeof(int); int len; - - if(get_user(len,optlen)) - return -EFAULT; + + if(get_user(len,optlen)) + return -EFAULT; if(len < 0) return -EINVAL; - - switch(optname) - { - case SO_DEBUG: + + switch(optname) + { + case SO_DEBUG: v.val = sock_flag(sk, SOCK_DBG); break; - + case SO_DONTROUTE: v.val = sock_flag(sk, SOCK_LOCALROUTE); break; - + case SO_BROADCAST: v.val = !!sock_flag(sk, SOCK_BROADCAST); break; @@ -673,7 +673,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_SNDBUF: v.val = sk->sk_sndbuf; break; - + case SO_RCVBUF: v.val = sk->sk_rcvbuf; break; @@ -687,7 +687,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, break; case SO_TYPE: - v.val = sk->sk_type; + v.val = sk->sk_type; break; case SO_ERROR: @@ -699,7 +699,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_OOBINLINE: v.val = !!sock_flag(sk, SOCK_URGINLINE); break; - + case SO_NO_CHECK: v.val = sk->sk_no_check; break; @@ -707,13 +707,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_PRIORITY: v.val = sk->sk_priority; break; - - case SO_LINGER: + + case SO_LINGER: lv = sizeof(v.ling); v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); - v.ling.l_linger = sk->sk_lingertime / HZ; + v.ling.l_linger = sk->sk_lingertime / HZ; break; - + case SO_BSDCOMPAT: sock_warn_obsolete_bsdism("getsockopt"); break; @@ -750,7 +750,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_SNDLOWAT: v.val=1; - break; + break; case SO_PASSCRED: v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; @@ -798,9 +798,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname, if (copy_to_user(optval, &v, len)) return -EFAULT; lenout: - if (put_user(len, optlen)) - return -EFAULT; - return 0; + if (put_user(len, optlen)) + return -EFAULT; + return 0; } /* @@ -846,7 +846,7 @@ struct sock *sk_alloc(int family, gfp_t priority, sk->sk_prot = sk->sk_prot_creator = prot; sock_lock_init(sk); } - + if (security_sk_alloc(sk, family, priority)) goto out_free; @@ -988,8 +988,8 @@ void __init sk_init(void) */ -/* - * Write buffer destructor automatically called from kfree_skb. +/* + * Write buffer destructor automatically called from kfree_skb. */ void sock_wfree(struct sk_buff *skb) { @@ -1002,8 +1002,8 @@ void sock_wfree(struct sk_buff *skb) sock_put(sk); } -/* - * Read buffer destructor automatically called from kfree_skb. +/* + * Read buffer destructor automatically called from kfree_skb. */ void sock_rfree(struct sk_buff *skb) { @@ -1051,7 +1051,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, /* * Allocate a skb from the socket's receive buffer. - */ + */ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, gfp_t priority) { @@ -1065,16 +1065,16 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, return NULL; } -/* +/* * Allocate a memory block from the socket's option memory buffer. - */ + */ void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) { if ((unsigned)size <= sysctl_optmem_max && atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { void *mem; /* First do the add, to avoid the race if kmalloc - * might sleep. + * might sleep. */ atomic_add(size, &sk->sk_omem_alloc); mem = kmalloc(size, priority); @@ -1210,7 +1210,7 @@ failure: return NULL; } -struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, +struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, int noblock, int *errcode) { return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); @@ -1298,7 +1298,7 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len) return -EOPNOTSUPP; } -int sock_no_connect(struct socket *sock, struct sockaddr *saddr, +int sock_no_connect(struct socket *sock, struct sockaddr *saddr, int len, int flags) { return -EOPNOTSUPP; @@ -1314,7 +1314,7 @@ int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) return -EOPNOTSUPP; } -int sock_no_getname(struct socket *sock, struct sockaddr *saddr, +int sock_no_getname(struct socket *sock, struct sockaddr *saddr, int *len, int peer) { return -EOPNOTSUPP; @@ -1400,7 +1400,7 @@ static void sock_def_error_report(struct sock *sk) read_lock(&sk->sk_callback_lock); if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) wake_up_interruptible(sk->sk_sleep); - sk_wake_async(sk,0,POLL_ERR); + sk_wake_async(sk,0,POLL_ERR); read_unlock(&sk->sk_callback_lock); } @@ -1473,7 +1473,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) sk->sk_send_head = NULL; init_timer(&sk->sk_timer); - + sk->sk_allocation = GFP_KERNEL; sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_sndbuf = sysctl_wmem_default; @@ -1553,26 +1553,26 @@ void fastcall release_sock(struct sock *sk) EXPORT_SYMBOL(release_sock); int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) -{ +{ if (!sock_flag(sk, SOCK_TIMESTAMP)) sock_enable_timestamp(sk); - if (sk->sk_stamp.tv_sec == -1) + if (sk->sk_stamp.tv_sec == -1) return -ENOENT; if (sk->sk_stamp.tv_sec == 0) do_gettimeofday(&sk->sk_stamp); return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? - -EFAULT : 0; -} + -EFAULT : 0; +} EXPORT_SYMBOL(sock_get_timestamp); void sock_enable_timestamp(struct sock *sk) -{ - if (!sock_flag(sk, SOCK_TIMESTAMP)) { +{ + if (!sock_flag(sk, SOCK_TIMESTAMP)) { sock_set_flag(sk, SOCK_TIMESTAMP); net_enable_timestamp(); } } -EXPORT_SYMBOL(sock_enable_timestamp); +EXPORT_SYMBOL(sock_enable_timestamp); /* * Get a socket option on an socket. @@ -1911,7 +1911,7 @@ static int proto_seq_open(struct inode *inode, struct file *file) return seq_open(file, &proto_seq_ops); } -static struct file_operations proto_seq_fops = { +static const struct file_operations proto_seq_fops = { .owner = THIS_MODULE, .open = proto_seq_open, .read = seq_read, diff --git a/net/core/stream.c b/net/core/stream.c index d1d7decf70b..755bacbcb32 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -69,7 +69,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p) sk->sk_write_pending++; done = sk_wait_event(sk, timeo_p, !sk->sk_err && - !((1 << sk->sk_state) & + !((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))); finish_wait(sk->sk_sleep, &wait); sk->sk_write_pending--; @@ -139,7 +139,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); sk->sk_write_pending++; - sk_wait_event(sk, ¤t_timeo, !sk->sk_err && + sk_wait_event(sk, ¤t_timeo, !sk->sk_err && !(sk->sk_shutdown & SEND_SHUTDOWN) && sk_stream_memory_free(sk) && vm_wait); diff --git a/net/core/user_dma.c b/net/core/user_dma.c index 248a6b666af..0ad1cd57bc3 100644 --- a/net/core/user_dma.c +++ b/net/core/user_dma.c @@ -58,7 +58,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, if (copy > len) copy = len; cookie = dma_memcpy_to_iovec(chan, to, pinned_list, - skb->data + offset, copy); + skb->data + offset, copy); if (cookie < 0) goto fault; len -= copy; @@ -108,8 +108,8 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, if (copy > len) copy = len; cookie = dma_skb_copy_datagram_iovec(chan, list, - offset - start, to, copy, - pinned_list); + offset - start, to, copy, + pinned_list); if (cookie < 0) goto fault; len -= copy; @@ -128,5 +128,5 @@ end: } fault: - return -EFAULT; + return -EFAULT; } diff --git a/net/core/utils.c b/net/core/utils.c index 61556065f07..07236c17fab 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -33,9 +33,9 @@ int net_msg_cost = 5*HZ; int net_msg_burst = 10; -/* +/* * All net warning printk()s should be guarded by this function. - */ + */ int net_ratelimit(void) { return __printk_ratelimit(net_msg_cost, net_msg_burst); diff --git a/net/core/wireless.c b/net/core/wireless.c index f69ab7b4408..9936ab11e6e 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c @@ -369,7 +369,7 @@ static const struct iw_ioctl_description standard_event[] = { .header_type = IW_HEADER_TYPE_ADDR, }, [IWEVEXPIRED - IWEVFIRST] = { - .header_type = IW_HEADER_TYPE_ADDR, + .header_type = IW_HEADER_TYPE_ADDR, }, [IWEVGENIE - IWEVFIRST] = { .header_type = IW_HEADER_TYPE_POINT, @@ -377,7 +377,7 @@ static const struct iw_ioctl_description standard_event[] = { .max_tokens = IW_GENERIC_IE_MAX, }, [IWEVMICHAELMICFAILURE - IWEVFIRST] = { - .header_type = IW_HEADER_TYPE_POINT, + .header_type = IW_HEADER_TYPE_POINT, .token_size = 1, .max_tokens = sizeof(struct iw_michaelmicfailure), }, @@ -630,11 +630,11 @@ static __inline__ void wireless_seq_printf_stats(struct seq_file *seq, dev->name, stats->status, stats->qual.qual, stats->qual.updated & IW_QUAL_QUAL_UPDATED ? '.' : ' ', - ((__s32) stats->qual.level) - + ((__s32) stats->qual.level) - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), stats->qual.updated & IW_QUAL_LEVEL_UPDATED ? '.' : ' ', - ((__s32) stats->qual.noise) - + ((__s32) stats->qual.noise) - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), stats->qual.updated & IW_QUAL_NOISE_UPDATED ? '.' : ' ', @@ -674,7 +674,7 @@ static int wireless_seq_open(struct inode *inode, struct file *file) return seq_open(file, &wireless_seq_ops); } -static struct file_operations wireless_seq_fops = { +static const struct file_operations wireless_seq_fops = { .owner = THIS_MODULE, .open = wireless_seq_open, .read = seq_read, @@ -862,7 +862,7 @@ static int ioctl_standard_call(struct net_device * dev, iwr->u.data.length * descr->token_size); if (err) - ret = -EFAULT; + ret = -EFAULT; #ifdef WE_IOCTL_DEBUG printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n", dev->name, @@ -1040,7 +1040,7 @@ static inline int ioctl_private_call(struct net_device * dev, err = copy_to_user(iwr->u.data.pointer, extra, extra_size); if (err) - ret = -EFAULT; + ret = -EFAULT; #ifdef WE_IOCTL_DEBUG printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n", dev->name, iwr->u.data.length); @@ -1080,7 +1080,7 @@ int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) /* A bunch of special cases, then the generic case... * Note that 'cmd' is already filtered in dev_ioctl() with * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ - switch(cmd) + switch(cmd) { case SIOCGIWSTATS: /* Get Wireless Stats */ @@ -2015,7 +2015,7 @@ void wireless_send_event(struct net_device * dev, * The best the driver could do is to log an error message. * We will do it ourselves instead... */ - printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", + printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", dev->name, cmd); return; } @@ -2029,11 +2029,11 @@ void wireless_send_event(struct net_device * dev, if(descr->header_type == IW_HEADER_TYPE_POINT) { /* Check if number of token fits within bounds */ if(wrqu->data.length > descr->max_tokens) { - printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); + printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); return; } if(wrqu->data.length < descr->min_tokens) { - printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); + printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); return; } /* Calculate extra_len - extra is NULL for restricted events */ |