* [2.6 patch] net/ipv6/: misc possible cleanups
@ 2004-12-15 0:55 Adrian Bunk
2004-12-15 1:59 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2004-12-15 0:55 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
The patch below contains the following possible cleanups:
- make some needlessly global code static
- remove the following unused functions:
- exthdrs.c: ipv6_build_rthdr
- exthdrs.c: ipv6_build_exthdr
- exthdrs.c: ipv6_build_nfrag_opts
- exthdrs.c: ipv6_build_frag_opts
- remove the following unused global variables:
- addrconf.c: in6addr_any
- remove the following EXPORT_SYMBOL's:
- ipv6_syms.c: addrconf_lock
- ipv6_syms.c: in6addr_any
- ipv6_syms.c: in6addr_loopback
Please comment on which of these changes are correct and which conflict
with pending patches.
diffstat output:
include/linux/in6.h | 5 --
include/net/addrconf.h | 1
include/net/ipv6.h | 10 ----
net/ipv6/addrconf.c | 9 +---
net/ipv6/anycast.c | 4 +
net/ipv6/exthdrs.c | 78 -------------------------------------
net/ipv6/icmp.c | 2
net/ipv6/ip6_output.c | 2
net/ipv6/ipv6_syms.c | 3 -
net/ipv6/mcast.c | 16 +++----
net/ipv6/route.c | 4 -
net/ipv6/sysctl_net_ipv6.c | 2
12 files changed, 21 insertions(+), 115 deletions(-)
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.10-rc3-mm1-full/include/net/ip.h.old 2004-12-14 05:20:46.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/net/ip.h 2004-12-14 05:20:53.000000000 +0100
@@ -295,8 +295,6 @@
extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport,
u32 info);
-extern int ipv4_proc_init(void);
-
/* sysctl helpers - any sysctl which holds a value that ends up being
* fed into the routing cache should use these handlers.
*/
--- linux-2.6.10-rc3-mm1-full/net/ipv4/af_inet.c.old 2004-12-14 05:20:00.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/af_inet.c 2004-12-14 05:20:33.000000000 +0100
@@ -659,7 +659,7 @@
}
-ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
+static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
{
struct sock *sk = sock->sk;
@@ -1011,7 +1011,7 @@
return 0;
}
-int ipv4_proc_init(void);
+static int ipv4_proc_init(void);
extern void ipfrag_init(void);
static int __init inet_init(void)
@@ -1136,7 +1136,7 @@
extern int udp4_proc_init(void);
extern void udp4_proc_exit(void);
-int __init ipv4_proc_init(void)
+static int __init ipv4_proc_init(void)
{
int rc = 0;
@@ -1166,7 +1166,7 @@
}
#else /* CONFIG_PROC_FS */
-int __init ipv4_proc_init(void)
+static int __init ipv4_proc_init(void)
{
return 0;
}
--- linux-2.6.10-rc3-mm1-full/net/ipv4/arp.c.old 2004-12-14 05:21:08.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/arp.c 2004-12-14 05:21:53.000000000 +0100
@@ -704,7 +704,7 @@
* Process an arp request.
*/
-int arp_process(struct sk_buff *skb)
+static int arp_process(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
struct in_device *in_dev = in_dev_get(dev);
@@ -961,7 +961,7 @@
* Set (create) an ARP cache entry.
*/
-int arp_req_set(struct arpreq *r, struct net_device * dev)
+static int arp_req_set(struct arpreq *r, struct net_device * dev)
{
u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
struct neighbour *neigh;
@@ -1075,7 +1075,7 @@
return err;
}
-int arp_req_delete(struct arpreq *r, struct net_device * dev)
+static int arp_req_delete(struct arpreq *r, struct net_device * dev)
{
int err;
u32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
@@ -1207,7 +1207,7 @@
return NOTIFY_DONE;
}
-struct notifier_block arp_netdev_notifier = {
+static struct notifier_block arp_netdev_notifier = {
.notifier_call = arp_netdev_event,
};
--- linux-2.6.10-rc3-mm1-full/net/ipv4/devinet.c.old 2004-12-14 05:22:07.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/devinet.c 2004-12-14 05:22:26.000000000 +0100
@@ -380,7 +380,7 @@
return NULL;
}
-int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct rtattr **rta = arg;
struct in_device *in_dev;
@@ -412,7 +412,7 @@
return -EADDRNOTAVAIL;
}
-int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct rtattr **rta = arg;
struct net_device *dev;
--- linux-2.6.10-rc3-mm1-full/include/net/ip_fib.h.old 2004-12-14 05:22:51.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/net/ip_fib.h 2004-12-14 05:23:53.000000000 +0100
@@ -200,7 +200,6 @@
/* Exported by fib_frontend.c */
extern void ip_fib_init(void);
-extern void fib_flush(void);
extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
@@ -226,7 +225,6 @@
extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
-extern u32 fib_rules_map_destination(u32 daddr, struct fib_result *res);
#ifdef CONFIG_NET_CLS_ROUTE
extern u32 fib_rules_tclass(struct fib_result *res);
#endif
--- linux-2.6.10-rc3-mm1-full/net/ipv4/fib_frontend.c.old 2004-12-14 05:23:09.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/fib_frontend.c 2004-12-14 05:23:33.000000000 +0100
@@ -75,7 +75,7 @@
#endif /* CONFIG_IP_MULTIPLE_TABLES */
-void fib_flush(void)
+static void fib_flush(void)
{
int flushed = 0;
#ifdef CONFIG_IP_MULTIPLE_TABLES
@@ -585,11 +585,11 @@
return NOTIFY_DONE;
}
-struct notifier_block fib_inetaddr_notifier = {
+static struct notifier_block fib_inetaddr_notifier = {
.notifier_call =fib_inetaddr_event,
};
-struct notifier_block fib_netdev_notifier = {
+static struct notifier_block fib_netdev_notifier = {
.notifier_call =fib_netdev_event,
};
--- linux-2.6.10-rc3-mm1-full/net/ipv4/fib_rules.c.old 2004-12-14 05:24:04.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/fib_rules.c 2004-12-14 05:24:22.000000000 +0100
@@ -245,12 +245,6 @@
return 0;
}
-u32 fib_rules_map_destination(u32 daddr, struct fib_result *res)
-{
- u32 mask = inet_make_mask(res->prefixlen);
- return (daddr&~mask)|res->fi->fib_nh->nh_gw;
-}
-
#ifdef CONFIG_NET_CLS_ROUTE
u32 fib_rules_tclass(struct fib_result *res)
{
@@ -368,7 +362,7 @@
}
-struct notifier_block fib_rules_notifier = {
+static struct notifier_block fib_rules_notifier = {
.notifier_call =fib_rules_event,
};
--- linux-2.6.10-rc3-mm1-full/net/ipv4/icmp.c.old 2004-12-14 05:24:38.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/icmp.c 2004-12-14 05:25:02.000000000 +0100
@@ -327,8 +327,8 @@
* Checksum each fragment, and on the first include the headers and final
* checksum.
*/
-int icmp_glue_bits(void *from, char *to, int offset, int len, int odd,
- struct sk_buff *skb)
+static int icmp_glue_bits(void *from, char *to, int offset, int len, int odd,
+ struct sk_buff *skb)
{
struct icmp_bxm *icmp_param = (struct icmp_bxm *)from;
unsigned int csum;
--- linux-2.6.10-rc3-mm1-full/net/ipv4/igmp.c.old 2004-12-14 05:25:26.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/igmp.c 2004-12-14 05:26:44.000000000 +0100
@@ -143,8 +143,8 @@
static void sf_markstate(struct ip_mc_list *pmc);
#endif
static void ip_mc_clear_src(struct ip_mc_list *pmc);
-int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
- int sfcount, __u32 *psfsrc, int delta);
+static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
+ int sfcount, __u32 *psfsrc, int delta);
static void ip_ma_put(struct ip_mc_list *im)
{
@@ -1384,8 +1384,8 @@
#define igmp_ifc_event(x) do { } while (0)
#endif
-int ip_mc_del_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
- int sfcount, __u32 *psfsrc, int delta)
+static int ip_mc_del_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
+ int sfcount, __u32 *psfsrc, int delta)
{
struct ip_mc_list *pmc;
int changerec = 0;
@@ -1520,8 +1520,8 @@
/*
* Add multicast source filter list to the interface list
*/
-int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
- int sfcount, __u32 *psfsrc, int delta)
+static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode,
+ int sfcount, __u32 *psfsrc, int delta)
{
struct ip_mc_list *pmc;
int isexclude;
@@ -1667,8 +1667,8 @@
return err;
}
-int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
- struct in_device *in_dev)
+static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
+ struct in_device *in_dev)
{
int err;
--- linux-2.6.10-rc3-mm1-full/net/ipv4/ip_gre.c.old 2004-12-14 05:29:23.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/ip_gre.c 2004-12-14 05:29:54.000000000 +0100
@@ -304,7 +304,7 @@
}
-void ipgre_err(struct sk_buff *skb, u32 info)
+static void ipgre_err(struct sk_buff *skb, u32 info)
{
#ifndef I_WISH_WORLD_WERE_PERFECT
@@ -552,7 +552,7 @@
return INET_ECN_encapsulate(tos, inner);
}
-int ipgre_rcv(struct sk_buff *skb)
+static int ipgre_rcv(struct sk_buff *skb)
{
struct iphdr *iph;
u8 *h;
@@ -1279,7 +1279,7 @@
goto out;
}
-void ipgre_fini(void)
+static void ipgre_fini(void)
{
if (inet_del_protocol(&ipgre_protocol, IPPROTO_GRE) < 0)
printk(KERN_INFO "ipgre close: can't remove protocol\n");
--- linux-2.6.10-rc3-mm1-full/net/ipv4/ip_sockglue.c.old 2004-12-14 05:30:10.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/ip_sockglue.c 2004-12-14 05:30:17.000000000 +0100
@@ -92,7 +92,7 @@
}
-void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb)
+static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb)
{
unsigned char optbuf[sizeof(struct ip_options) + 40];
struct ip_options * opt = (struct ip_options*)optbuf;
--- linux-2.6.10-rc3-mm1-full/include/net/ipconfig.h.old 2004-12-14 05:30:42.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/net/ipconfig.h 2004-12-14 05:35:02.000000000 +0100
@@ -8,14 +8,10 @@
/* The following are initdata: */
-extern int ic_enable; /* Enable or disable the whole shebang */
-
extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */
-extern int ic_host_name_set; /* Host name set by ipconfig? */
extern int ic_set_manually; /* IPconfig parameters set manually */
extern u32 ic_myaddr; /* My IP address */
-extern u32 ic_netmask; /* Netmask for local subnet */
extern u32 ic_gateway; /* Gateway IP address */
extern u32 ic_servaddr; /* Boot server IP address */
@@ -24,13 +20,6 @@
extern u8 root_server_path[]; /* Path to mount as root */
-
-/* The following are persistent (not initdata): */
-
-extern int ic_proto_used; /* Protocol used, if any */
-extern u32 ic_nameserver; /* DNS server IP address */
-extern u8 ic_domain[]; /* DNS (not NIS) domain name */
-
/* bits in ic_proto_{enabled,used} */
#define IC_PROTO 0xFF /* Protocols mask: */
#define IC_BOOTP 0x01 /* BOOTP (or DHCP, see below) */
--- linux-2.6.10-rc3-mm1-full/net/ipv4/ipconfig.c.old 2004-12-14 05:30:57.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/ipconfig.c 2004-12-14 05:35:10.000000000 +0100
@@ -109,7 +109,7 @@
*/
int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */
-int ic_enable __initdata = 0; /* IP config enabled? */
+static int ic_enable __initdata = 0; /* IP config enabled? */
/* Protocol choice */
int ic_proto_enabled __initdata = 0
@@ -124,10 +124,10 @@
#endif
;
-int ic_host_name_set __initdata = 0; /* Host name set by us? */
+static int ic_host_name_set __initdata = 0; /* Host name set by us? */
u32 ic_myaddr = INADDR_NONE; /* My IP address */
-u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */
+static u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */
u32 ic_gateway = INADDR_NONE; /* Gateway IP address */
u32 ic_servaddr = INADDR_NONE; /* Boot server IP address */
@@ -137,9 +137,9 @@
/* Persistent data: */
-int ic_proto_used; /* Protocol used, if any */
-u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
-u8 ic_domain[64]; /* DNS (not NIS) domain name */
+static int ic_proto_used; /* Protocol used, if any */
+static u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
+static u8 ic_domain[64]; /* DNS (not NIS) domain name */
/*
* Private state.
--- linux-2.6.10-rc3-mm1-full/net/ipv4/raw.c.old 2004-12-14 05:36:04.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/raw.c 2004-12-14 05:36:22.000000000 +0100
@@ -562,8 +562,8 @@
* we return it, otherwise we block.
*/
-int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
- size_t len, int noblock, int flags, int *addr_len)
+static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
+ size_t len, int noblock, int flags, int *addr_len)
{
struct inet_opt *inet = inet_sk(sk);
size_t copied = 0;
--- linux-2.6.10-rc3-mm1-full/net/ipv4/route.c.old 2004-12-14 05:36:47.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/route.c 2004-12-14 05:59:55.000000000 +0100
@@ -108,22 +108,22 @@
#define RT_GC_TIMEOUT (300*HZ)
-int ip_rt_min_delay = 2 * HZ;
-int ip_rt_max_delay = 10 * HZ;
-int ip_rt_max_size;
-int ip_rt_gc_timeout = RT_GC_TIMEOUT;
-int ip_rt_gc_interval = 60 * HZ;
-int ip_rt_gc_min_interval = HZ / 2;
-int ip_rt_redirect_number = 9;
-int ip_rt_redirect_load = HZ / 50;
-int ip_rt_redirect_silence = ((HZ / 50) << (9 + 1));
-int ip_rt_error_cost = HZ;
-int ip_rt_error_burst = 5 * HZ;
-int ip_rt_gc_elasticity = 8;
-int ip_rt_mtu_expires = 10 * 60 * HZ;
-int ip_rt_min_pmtu = 512 + 20 + 20;
-int ip_rt_min_advmss = 256;
-int ip_rt_secret_interval = 10 * 60 * HZ;
+static int ip_rt_min_delay = 2 * HZ;
+static int ip_rt_max_delay = 10 * HZ;
+static int ip_rt_max_size;
+static int ip_rt_gc_timeout = RT_GC_TIMEOUT;
+static int ip_rt_gc_interval = 60 * HZ;
+static int ip_rt_gc_min_interval = HZ / 2;
+static int ip_rt_redirect_number = 9;
+static int ip_rt_redirect_load = HZ / 50;
+static int ip_rt_redirect_silence = ((HZ / 50) << (9 + 1));
+static int ip_rt_error_cost = HZ;
+static int ip_rt_error_burst = 5 * HZ;
+static int ip_rt_gc_elasticity = 8;
+static int ip_rt_mtu_expires = 10 * 60 * HZ;
+static int ip_rt_min_pmtu = 512 + 20 + 20;
+static int ip_rt_min_advmss = 256;
+static int ip_rt_secret_interval = 10 * 60 * HZ;
static unsigned long rt_deadline;
#define RTprint(a...) printk(KERN_DEBUG a)
--- linux-2.6.10-rc3-mm1-full/include/net/tcp.h.old 2004-12-14 05:43:25.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/net/tcp.h 2004-12-14 05:45:41.000000000 +0100
@@ -315,7 +315,6 @@
extern atomic_t tcp_orphan_count;
extern int tcp_tw_count;
extern void tcp_time_wait(struct sock *sk, int state, int timeo);
-extern void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo);
extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw);
@@ -2020,21 +2019,6 @@
tp->westwood.rtt = rtt_seq;
}
-void __tcp_westwood_fast_bw(struct sock *, struct sk_buff *);
-void __tcp_westwood_slow_bw(struct sock *, struct sk_buff *);
-
-static inline void tcp_westwood_fast_bw(struct sock *sk, struct sk_buff *skb)
-{
- if (tcp_is_westwood(tcp_sk(sk)))
- __tcp_westwood_fast_bw(sk, skb);
-}
-
-static inline void tcp_westwood_slow_bw(struct sock *sk, struct sk_buff *skb)
-{
- if (tcp_is_westwood(tcp_sk(sk)))
- __tcp_westwood_slow_bw(sk, skb);
-}
-
static inline __u32 __tcp_westwood_bw_rttmin(const struct tcp_opt *tp)
{
return max((tp->westwood.bw_est) * (tp->westwood.rtt_min) /
--- linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_input.c.old 2004-12-14 05:43:43.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_input.c 2004-12-14 05:44:53.000000000 +0100
@@ -2786,7 +2786,7 @@
* straight forward and doesn't need any particular care.
*/
-void __tcp_westwood_fast_bw(struct sock *sk, struct sk_buff *skb)
+static void __tcp_westwood_fast_bw(struct sock *sk, struct sk_buff *skb)
{
struct tcp_opt *tp = tcp_sk(sk);
@@ -2797,6 +2797,12 @@
tp->westwood.rtt_min = westwood_update_rttmin(sk);
}
+static inline void tcp_westwood_fast_bw(struct sock *sk, struct sk_buff *skb)
+{
+ if (tcp_is_westwood(tcp_sk(sk)))
+ __tcp_westwood_fast_bw(sk, skb);
+}
+
/*
* @westwood_dupack_update
@@ -2867,7 +2873,7 @@
* dupack. But we need to be careful in such case.
*/
-void __tcp_westwood_slow_bw(struct sock *sk, struct sk_buff *skb)
+static void __tcp_westwood_slow_bw(struct sock *sk, struct sk_buff *skb)
{
struct tcp_opt *tp = tcp_sk(sk);
@@ -2877,6 +2883,12 @@
tp->westwood.rtt_min = westwood_update_rttmin(sk);
}
+static inline void tcp_westwood_slow_bw(struct sock *sk, struct sk_buff *skb)
+{
+ if (tcp_is_westwood(tcp_sk(sk)))
+ __tcp_westwood_slow_bw(sk, skb);
+}
+
/* This routine deals with incoming acks, but not outgoing ones. */
static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
{
--- linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_minisocks.c.old 2004-12-14 05:45:57.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_minisocks.c 2004-12-14 05:46:17.000000000 +0100
@@ -41,6 +41,8 @@
int sysctl_tcp_syncookies = SYNC_INIT;
int sysctl_tcp_abort_on_overflow;
+static void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo);
+
static __inline__ int tcp_in_window(u32 seq, u32 end_seq, u32 s_win, u32 e_win)
{
if (seq == s_win)
@@ -551,7 +553,7 @@
TIMER_INITIALIZER(tcp_twcal_tick, 0, 0);
static struct hlist_head tcp_twcal_row[TCP_TW_RECYCLE_SLOTS];
-void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo)
+static void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo)
{
struct hlist_head *list;
int slot;
--- linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_timer.c.old 2004-12-14 05:48:10.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/tcp_timer.c 2004-12-14 13:57:40.000000000 +0100
@@ -653,6 +653,3 @@
EXPORT_SYMBOL(tcp_delete_keepalive_timer);
EXPORT_SYMBOL(tcp_init_xmit_timers);
EXPORT_SYMBOL(tcp_reset_keepalive_timer);
-#ifdef TCP_DEBUG
-EXPORT_SYMBOL(tcp_timer_bug_msg);
-#endif
--- linux-2.6.10-rc3-mm1-full/net/ipv4/udp.c.old 2004-12-14 05:50:04.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/udp.c 2004-12-14 05:51:36.000000000 +0100
@@ -219,7 +219,8 @@
/* UDP is nearly always wildcards out the wazoo, it makes no sense to try
* harder than this. -DaveM
*/
-struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif)
+static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport,
+ u32 daddr, u16 dport, int dif)
{
struct sock *sk, *result = NULL;
struct hlist_node *node;
@@ -263,7 +264,8 @@
return result;
}
-__inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif)
+static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport,
+ u32 daddr, u16 dport, int dif)
{
struct sock *sk;
@@ -667,7 +669,8 @@
goto out;
}
-int udp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags)
+static int udp_sendpage(struct sock *sk, struct page *page, int offset,
+ size_t size, int flags)
{
struct udp_opt *up = udp_sk(sk);
int ret;
@@ -770,8 +773,8 @@
* return it, otherwise we block.
*/
-int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
- size_t len, int noblock, int flags, int *addr_len)
+static int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
+ size_t len, int noblock, int flags, int *addr_len)
{
struct inet_opt *inet = inet_sk(sk);
struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
--- linux-2.6.10-rc3-mm1-full/include/net/xfrm.h.old 2004-12-14 05:51:56.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/net/xfrm.h 2004-12-14 05:52:03.000000000 +0100
@@ -782,7 +782,6 @@
extern void xfrm_init(void);
extern void xfrm4_init(void);
-extern void xfrm4_fini(void);
extern void xfrm6_init(void);
extern void xfrm6_fini(void);
extern void xfrm_state_init(void);
--- linux-2.6.10-rc3-mm1-full/net/ipv4/xfrm4_policy.c.old 2004-12-14 05:52:13.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/ipv4/xfrm4_policy.c 2004-12-14 05:52:22.000000000 +0100
@@ -279,10 +279,3 @@
xfrm4_policy_init();
}
-void __exit xfrm4_fini(void)
-{
- //xfrm4_input_fini();
- xfrm4_policy_fini();
- xfrm4_state_fini();
-}
-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] net/ipv6/: misc possible cleanups
2004-12-15 0:55 [2.6 patch] net/ipv6/: misc possible cleanups Adrian Bunk
@ 2004-12-15 1:59 ` YOSHIFUJI Hideaki / 吉藤英明
2005-01-07 3:00 ` [2.6 patch] net/ipv6/: misc cleanups Adrian Bunk
0 siblings, 1 reply; 5+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-12-15 1:59 UTC (permalink / raw)
To: bunk; +Cc: netdev, linux-kernel, yoshfuji
In article <20041215005546.GA11972@stusta.de> (at Wed, 15 Dec 2004 01:55:46 +0100), Adrian Bunk <bunk@stusta.de> says:
> The patch below contains the following possible cleanups:
> - make some needlessly global code static
> - remove the following unused functions:
> - exthdrs.c: ipv6_build_rthdr
> - exthdrs.c: ipv6_build_exthdr
> - exthdrs.c: ipv6_build_nfrag_opts
> - exthdrs.c: ipv6_build_frag_opts
> - remove the following unused global variables:
> - addrconf.c: in6addr_any
> - remove the following EXPORT_SYMBOL's:
> - ipv6_syms.c: addrconf_lock
> - ipv6_syms.c: in6addr_any
> - ipv6_syms.c: in6addr_loopback
>
> Please comment on which of these changes are correct and which conflict
> with pending patches.
Please keep addrconf_lock (for SCTP).
Please keep in6addr_any in addrconf.c (or enclose by #if 0 ... #endif)
> --- linux-2.6.10-rc3-mm1-full/include/net/ip.h.old 2004-12-14 05:20:46.000000000 +0100
> +++ linux-2.6.10-rc3-mm1-full/include/net/ip.h 2004-12-14 05:20:53.000000000 +0100
:
I think you attatched incorrect patch file.
--yoshfuji
^ permalink raw reply [flat|nested] 5+ messages in thread
* [2.6 patch] net/ipv6/: misc cleanups
2004-12-15 1:59 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2005-01-07 3:00 ` Adrian Bunk
2005-01-07 3:11 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2005-01-07 3:00 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ?$B5HF#1QL@; +Cc: netdev, linux-kernel
On Wed, Dec 15, 2004 at 10:59:00AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
> In article <20041215005546.GA11972@stusta.de> (at Wed, 15 Dec 2004 01:55:46 +0100), Adrian Bunk <bunk@stusta.de> says:
>
> >...
> > Please comment on which of these changes are correct and which conflict
> > with pending patches.
>
> Please keep addrconf_lock (for SCTP).
Ups, sorry, my bad.
> Please keep in6addr_any in addrconf.c (or enclose by #if 0 ... #endif)
>...
OK.
Updated patch:
<-- snip -->
The patch below contains the following possible cleanups:
- make some needlessly global code static
- remove the following unused functions:
- exthdrs.c: ipv6_build_rthdr
- exthdrs.c: ipv6_build_exthdr
- exthdrs.c: ipv6_build_nfrag_opts
- exthdrs.c: ipv6_build_frag_opts
- remove the following write-only global variables:
- addrconf.c: inet6_dev_count
- addrconf.c: inet6_ifa_count
- #if 0 the following unused global variable:
- addrconf.c: in6addr_any
- remove the following EXPORT_SYMBOL's:
- ipv6_syms.c: in6addr_any
- ipv6_syms.c: in6addr_loopback
diffstat output:
include/linux/in6.h | 4 -
include/net/addrconf.h | 1
include/net/ipv6.h | 2
net/ipv6/addrconf.c | 11 +----
net/ipv6/anycast.c | 4 +
net/ipv6/exthdrs.c | 77 -------------------------------------
net/ipv6/icmp.c | 2
net/ipv6/ip6_output.c | 2
net/ipv6/ipv6_syms.c | 2
net/ipv6/mcast.c | 32 ++++++++-------
net/ipv6/route.c | 4 -
net/ipv6/sysctl_net_ipv6.c | 2
12 files changed, 32 insertions(+), 111 deletions(-)
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.10-mm2-full/include/linux/in6.h.old 2005-01-07 02:34:21.000000000 +0100
+++ linux-2.6.10-mm2-full/include/linux/in6.h 2005-01-07 02:36:18.000000000 +0100
@@ -44,10 +44,10 @@
* NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
* in network byte order, not in host byte order as are the IPv4 equivalents
*/
+#if 0
extern const struct in6_addr in6addr_any;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
-extern const struct in6_addr in6addr_loopback;
-#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+#endif
struct sockaddr_in6 {
unsigned short int sin6_family; /* AF_INET6 */
--- linux-2.6.10-mm2-full/net/ipv6/addrconf.c.old 2005-01-07 02:34:57.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/addrconf.c 2005-01-07 02:37:28.000000000 +0100
@@ -99,9 +99,6 @@
static void addrconf_sysctl_unregister(struct ipv6_devconf *p);
#endif
-int inet6_dev_count;
-int inet6_ifa_count;
-
#ifdef CONFIG_IPV6_PRIVACY
static int __ipv6_regen_rndid(struct inet6_dev *idev);
static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
@@ -191,7 +188,11 @@
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
+#if 0
+#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+#endif
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
int ipv6_addr_type(const struct in6_addr *addr)
@@ -310,7 +311,6 @@
return;
}
snmp6_unregister_dev(idev);
- inet6_dev_count--;
kfree(idev);
}
@@ -338,7 +338,6 @@
kfree(ndev);
return NULL;
}
- inet6_dev_count++;
/* We refer to the device */
dev_hold(dev);
@@ -475,7 +474,6 @@
}
dst_release(&ifp->rt->u.dst);
- inet6_ifa_count--;
kfree(ifp);
}
@@ -530,7 +528,6 @@
ifa->flags = flags | IFA_F_TENTATIVE;
ifa->cstamp = ifa->tstamp = jiffies;
- inet6_ifa_count++;
ifa->idev = idev;
in6_dev_hold(idev);
/* For caller */
--- linux-2.6.10-mm2-full/net/ipv6/ipv6_syms.c.old 2005-01-07 02:35:19.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/ipv6_syms.c 2005-01-07 02:36:35.000000000 +0100
@@ -32,8 +32,6 @@
EXPORT_SYMBOL(inet6_ioctl);
EXPORT_SYMBOL(ipv6_get_saddr);
EXPORT_SYMBOL(ipv6_chk_addr);
-EXPORT_SYMBOL(in6addr_any);
-EXPORT_SYMBOL(in6addr_loopback);
EXPORT_SYMBOL(in6_dev_finish_destroy);
#ifdef CONFIG_XFRM
EXPORT_SYMBOL(xfrm6_rcv);
--- linux-2.6.10-mm2-full/include/net/addrconf.h.old 2005-01-07 02:38:03.000000000 +0100
+++ linux-2.6.10-mm2-full/include/net/addrconf.h 2005-01-07 02:38:10.000000000 +0100
@@ -112,7 +112,6 @@
extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr);
extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr);
-extern int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr);
--- linux-2.6.10-mm2-full/net/ipv6/anycast.c.old 2005-01-07 02:38:21.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/anycast.c 2005-01-07 02:38:44.000000000 +0100
@@ -43,6 +43,8 @@
#include <net/checksum.h>
+static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
+
/* Big ac list lock for all the sockets */
static rwlock_t ipv6_sk_ac_lock = RW_LOCK_UNLOCKED;
@@ -413,7 +415,7 @@
return 0;
}
-int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
+static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
{
int ret;
struct inet6_dev *idev = in6_dev_get(dev);
--- linux-2.6.10-mm2-full/net/ipv6/exthdrs.c.old 2005-01-07 02:39:33.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/exthdrs.c 2005-01-07 02:50:24.000000000 +0100
@@ -501,83 +501,6 @@
* for headers.
*/
-static u8 *ipv6_build_rthdr(struct sk_buff *skb, u8 *prev_hdr,
- struct ipv6_rt_hdr *opt, struct in6_addr *addr)
-{
- struct rt0_hdr *phdr, *ihdr;
- int hops;
-
- ihdr = (struct rt0_hdr *) opt;
-
- phdr = (struct rt0_hdr *) skb_put(skb, (ihdr->rt_hdr.hdrlen + 1) << 3);
- memcpy(phdr, ihdr, sizeof(struct rt0_hdr));
-
- hops = ihdr->rt_hdr.hdrlen >> 1;
-
- if (hops > 1)
- memcpy(phdr->addr, ihdr->addr + 1,
- (hops - 1) * sizeof(struct in6_addr));
-
- ipv6_addr_copy(phdr->addr + (hops - 1), addr);
-
- phdr->rt_hdr.nexthdr = *prev_hdr;
- *prev_hdr = NEXTHDR_ROUTING;
- return &phdr->rt_hdr.nexthdr;
-}
-
-static u8 *ipv6_build_exthdr(struct sk_buff *skb, u8 *prev_hdr, u8 type, struct ipv6_opt_hdr *opt)
-{
- struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb_put(skb, ipv6_optlen(opt));
-
- memcpy(h, opt, ipv6_optlen(opt));
- h->nexthdr = *prev_hdr;
- *prev_hdr = type;
- return &h->nexthdr;
-}
-
-u8 *ipv6_build_nfrag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt,
- struct in6_addr *daddr, u32 jumbolen)
-{
- struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb->data;
-
- if (opt && opt->hopopt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_HOP, opt->hopopt);
-
- if (jumbolen) {
- u8 *jumboopt = (u8 *)skb_put(skb, 8);
-
- if (opt && opt->hopopt) {
- *jumboopt++ = IPV6_TLV_PADN;
- *jumboopt++ = 0;
- h->hdrlen++;
- } else {
- h = (struct ipv6_opt_hdr *)jumboopt;
- h->nexthdr = *prev_hdr;
- h->hdrlen = 0;
- jumboopt += 2;
- *prev_hdr = NEXTHDR_HOP;
- prev_hdr = &h->nexthdr;
- }
- jumboopt[0] = IPV6_TLV_JUMBO;
- jumboopt[1] = 4;
- *(u32*)(jumboopt+2) = htonl(jumbolen);
- }
- if (opt) {
- if (opt->dst0opt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst0opt);
- if (opt->srcrt)
- prev_hdr = ipv6_build_rthdr(skb, prev_hdr, opt->srcrt, daddr);
- }
- return prev_hdr;
-}
-
-u8 *ipv6_build_frag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt)
-{
- if (opt->dst1opt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst1opt);
- return prev_hdr;
-}
-
static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto,
struct ipv6_rt_hdr *opt,
struct in6_addr **addr_p)
--- linux-2.6.10-mm2-full/net/ipv6/icmp.c.old 2005-01-07 02:40:12.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/icmp.c 2005-01-07 02:40:20.000000000 +0100
@@ -211,7 +211,7 @@
return (*op & 0xC0) == 0x80;
}
-int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
+static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
{
struct sk_buff *skb;
struct icmp6hdr *icmp6h;
--- linux-2.6.10-mm2-full/include/net/ipv6.h.old 2005-01-07 02:40:56.000000000 +0100
+++ linux-2.6.10-mm2-full/include/net/ipv6.h 2005-01-07 02:41:03.000000000 +0100
@@ -229,8 +229,6 @@
void (*destructor)(struct sock *));
-extern int ip6_call_ra_chain(struct sk_buff *skb, int sel);
-
extern int ipv6_parse_hopopts(struct sk_buff *skb, int);
extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
--- linux-2.6.10-mm2-full/net/ipv6/ip6_output.c.old 2005-01-07 02:41:10.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/ip6_output.c 2005-01-07 02:41:15.000000000 +0100
@@ -311,7 +311,7 @@
return 0;
}
-int ip6_call_ra_chain(struct sk_buff *skb, int sel)
+static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
{
struct ip6_ra_chain *ra;
struct sock *last = NULL;
--- linux-2.6.10-mm2-full/net/ipv6/mcast.c.old 2005-01-07 02:41:35.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/mcast.c 2005-01-07 02:44:44.000000000 +0100
@@ -121,7 +121,7 @@
struct in6_addr srcs[0];
};
-struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
+static struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
/* Big mc list lock for all the sockets */
static rwlock_t ipv6_sk_mc_lock = RW_LOCK_UNLOCKED;
@@ -143,12 +143,14 @@
static int sf_setstate(struct ifmcaddr6 *pmc);
static void sf_markstate(struct ifmcaddr6 *pmc);
static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
-int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta);
-int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta);
-int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
- struct inet6_dev *idev);
+static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta);
+static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta);
+static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
+ struct inet6_dev *idev);
#define IGMP6_UNSOLICITED_IVAL (10*HZ)
@@ -272,7 +274,7 @@
return -ENOENT;
}
-struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
+static struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
{
struct net_device *dev = NULL;
struct inet6_dev *idev = NULL;
@@ -1723,8 +1725,9 @@
return rv;
}
-int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta)
+static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta)
{
struct ifmcaddr6 *pmc;
int changerec = 0;
@@ -1847,8 +1850,9 @@
/*
* Add multicast source filter list to the interface list
*/
-int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta)
+static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta)
{
struct ifmcaddr6 *pmc;
int isexclude;
@@ -1951,8 +1955,8 @@
spin_unlock_bh(&ma->mca_lock);
}
-int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
- struct inet6_dev *idev)
+static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
+ struct inet6_dev *idev)
{
int err;
--- linux-2.6.10-mm2-full/net/ipv6/route.c.old 2005-01-07 02:45:00.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/route.c 2005-01-07 02:45:22.000000000 +0100
@@ -208,8 +208,8 @@
/*
* pointer to the last default router chosen. BH is disabled locally.
*/
-struct rt6_info *rt6_dflt_pointer;
-spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED;
+static struct rt6_info *rt6_dflt_pointer;
+static spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED;
void rt6_reset_dflt_pointer(struct rt6_info *rt)
{
--- linux-2.6.10-mm2-full/net/ipv6/sysctl_net_ipv6.c.old 2005-01-07 02:45:38.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/sysctl_net_ipv6.c 2005-01-07 02:45:46.000000000 +0100
@@ -19,7 +19,7 @@
#ifdef CONFIG_SYSCTL
-ctl_table ipv6_table[] = {
+static ctl_table ipv6_table[] = {
{
.ctl_name = NET_IPV6_ROUTE,
.procname = "route",
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2.6 patch] net/ipv6/: misc cleanups
2005-01-07 3:00 ` [2.6 patch] net/ipv6/: misc cleanups Adrian Bunk
@ 2005-01-07 3:11 ` YOSHIFUJI Hideaki / 吉藤英明
2005-01-08 23:32 ` Adrian Bunk
0 siblings, 1 reply; 5+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-01-07 3:11 UTC (permalink / raw)
To: bunk; +Cc: netdev, linux-kernel, yoshfuji
In article <20050107030017.GF14108@stusta.de> (at Fri, 7 Jan 2005 04:00:17 +0100), Adrian Bunk <bunk@stusta.de> says:
> - #if 0 the following unused global variable:
> - addrconf.c: in6addr_any
> - remove the following EXPORT_SYMBOL's:
> - ipv6_syms.c: in6addr_any
> - ipv6_syms.c: in6addr_loopback
:
> --- linux-2.6.10-mm2-full/include/linux/in6.h.old 2005-01-07 02:34:21.000000000 +0100
> +++ linux-2.6.10-mm2-full/include/linux/in6.h 2005-01-07 02:36:18.000000000 +0100
> @@ -44,10 +44,10 @@
> * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
> * in network byte order, not in host byte order as are the IPv4 equivalents
> */
> +#if 0
> extern const struct in6_addr in6addr_any;
> #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
> -extern const struct in6_addr in6addr_loopback;
> -#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
> +#endif
>
I meant:
#if 0
extern const struct in6_addr in6addr_any;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#endif
extern const struct in6_addr in6addr_loopback;
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
And,
> @@ -191,7 +188,11 @@
> };
>
> /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
> +#if 0
> +#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
> const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
> +#endif
> +#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
> const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
>
#if 0
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
#endif
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
or something like this.
--yoshfuji
^ permalink raw reply [flat|nested] 5+ messages in thread
* [2.6 patch] net/ipv6/: misc cleanups
2005-01-07 3:11 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2005-01-08 23:32 ` Adrian Bunk
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Bunk @ 2005-01-08 23:32 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / ?$B5HF#1QL@; +Cc: netdev, linux-kernel
On Fri, Jan 07, 2005 at 12:11:49PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
> In article <20050107030017.GF14108@stusta.de> (at Fri, 7 Jan 2005 04:00:17 +0100), Adrian Bunk <bunk@stusta.de> says:
>
> > - #if 0 the following unused global variable:
> > - addrconf.c: in6addr_any
> > - remove the following EXPORT_SYMBOL's:
> > - ipv6_syms.c: in6addr_any
> > - ipv6_syms.c: in6addr_loopback
> :
> > --- linux-2.6.10-mm2-full/include/linux/in6.h.old 2005-01-07 02:34:21.000000000 +0100
> > +++ linux-2.6.10-mm2-full/include/linux/in6.h 2005-01-07 02:36:18.000000000 +0100
> > @@ -44,10 +44,10 @@
> > * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
> > * in network byte order, not in host byte order as are the IPv4 equivalents
> > */
> > +#if 0
> > extern const struct in6_addr in6addr_any;
> > #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
> > -extern const struct in6_addr in6addr_loopback;
> > -#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
> > +#endif
> >
>
> I meant:
>
> #if 0
> extern const struct in6_addr in6addr_any;
> #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
> #endif
> extern const struct in6_addr in6addr_loopback;
> #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
>
> And,
>
> > @@ -191,7 +188,11 @@
> > };
> >
> > /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
> > +#if 0
> > +#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
> > const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
> > +#endif
> > +#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
> > const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
> >
>
> #if 0
> const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
> #endif
> const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
>
> or something like this.
OK, updated patch below.
> --yoshfuji
cu
Adrian
<-- snip -->
The patch below contains the following possible cleanups:
- make some needlessly global code static
- remove the following unused functions:
- exthdrs.c: ipv6_build_rthdr
- exthdrs.c: ipv6_build_exthdr
- exthdrs.c: ipv6_build_nfrag_opts
- exthdrs.c: ipv6_build_frag_opts
- remove the following write-only global variables:
- addrconf.c: inet6_dev_count
- addrconf.c: inet6_ifa_count
- #if 0 the following unused global variable:
- addrconf.c: in6addr_any
- remove the following unneeded EXPORT_SYMBOL's:
- ipv6_syms.c: in6addr_any
- ipv6_syms.c: in6addr_loopback
diffstat output:
include/linux/in6.h | 2
include/net/addrconf.h | 1
include/net/ipv6.h | 2
net/ipv6/addrconf.c | 9 ----
net/ipv6/anycast.c | 4 +
net/ipv6/exthdrs.c | 77 -------------------------------------
net/ipv6/icmp.c | 2
net/ipv6/ip6_output.c | 2
net/ipv6/ipv6_syms.c | 2
net/ipv6/mcast.c | 32 ++++++++-------
net/ipv6/route.c | 4 -
net/ipv6/sysctl_net_ipv6.c | 2
12 files changed, 30 insertions(+), 109 deletions(-)
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.10-mm2-full/include/linux/in6.h.old 2005-01-07 02:34:21.000000000 +0100
+++ linux-2.6.10-mm2-full/include/linux/in6.h 2005-01-08 23:37:31.000000000 +0100
@@ -44,8 +44,10 @@
* NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
* in network byte order, not in host byte order as are the IPv4 equivalents
*/
+#if 0
extern const struct in6_addr in6addr_any;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#endif
extern const struct in6_addr in6addr_loopback;
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
--- linux-2.6.10-mm2-full/net/ipv6/addrconf.c.old 2005-01-07 02:34:57.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/addrconf.c 2005-01-08 23:38:34.000000000 +0100
@@ -99,9 +99,6 @@
static void addrconf_sysctl_unregister(struct ipv6_devconf *p);
#endif
-int inet6_dev_count;
-int inet6_ifa_count;
-
#ifdef CONFIG_IPV6_PRIVACY
static int __ipv6_regen_rndid(struct inet6_dev *idev);
static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
@@ -191,7 +188,9 @@
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
+#if 0
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+#endif
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
int ipv6_addr_type(const struct in6_addr *addr)
@@ -310,7 +309,6 @@
return;
}
snmp6_unregister_dev(idev);
- inet6_dev_count--;
kfree(idev);
}
@@ -338,7 +336,6 @@
kfree(ndev);
return NULL;
}
- inet6_dev_count++;
/* We refer to the device */
dev_hold(dev);
@@ -475,7 +472,6 @@
}
dst_release(&ifp->rt->u.dst);
- inet6_ifa_count--;
kfree(ifp);
}
@@ -530,7 +526,6 @@
ifa->flags = flags | IFA_F_TENTATIVE;
ifa->cstamp = ifa->tstamp = jiffies;
- inet6_ifa_count++;
ifa->idev = idev;
in6_dev_hold(idev);
/* For caller */
--- linux-2.6.10-mm2-full/net/ipv6/ipv6_syms.c.old 2005-01-07 02:35:19.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/ipv6_syms.c 2005-01-07 02:36:35.000000000 +0100
@@ -32,8 +32,6 @@
EXPORT_SYMBOL(inet6_ioctl);
EXPORT_SYMBOL(ipv6_get_saddr);
EXPORT_SYMBOL(ipv6_chk_addr);
-EXPORT_SYMBOL(in6addr_any);
-EXPORT_SYMBOL(in6addr_loopback);
EXPORT_SYMBOL(in6_dev_finish_destroy);
#ifdef CONFIG_XFRM
EXPORT_SYMBOL(xfrm6_rcv);
--- linux-2.6.10-mm2-full/include/net/addrconf.h.old 2005-01-07 02:38:03.000000000 +0100
+++ linux-2.6.10-mm2-full/include/net/addrconf.h 2005-01-07 02:38:10.000000000 +0100
@@ -112,7 +112,6 @@
extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr);
extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr);
-extern int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr);
--- linux-2.6.10-mm2-full/net/ipv6/anycast.c.old 2005-01-07 02:38:21.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/anycast.c 2005-01-07 02:38:44.000000000 +0100
@@ -43,6 +43,8 @@
#include <net/checksum.h>
+static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
+
/* Big ac list lock for all the sockets */
static rwlock_t ipv6_sk_ac_lock = RW_LOCK_UNLOCKED;
@@ -413,7 +415,7 @@
return 0;
}
-int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
+static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
{
int ret;
struct inet6_dev *idev = in6_dev_get(dev);
--- linux-2.6.10-mm2-full/net/ipv6/exthdrs.c.old 2005-01-07 02:39:33.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/exthdrs.c 2005-01-07 02:50:24.000000000 +0100
@@ -501,83 +501,6 @@
* for headers.
*/
-static u8 *ipv6_build_rthdr(struct sk_buff *skb, u8 *prev_hdr,
- struct ipv6_rt_hdr *opt, struct in6_addr *addr)
-{
- struct rt0_hdr *phdr, *ihdr;
- int hops;
-
- ihdr = (struct rt0_hdr *) opt;
-
- phdr = (struct rt0_hdr *) skb_put(skb, (ihdr->rt_hdr.hdrlen + 1) << 3);
- memcpy(phdr, ihdr, sizeof(struct rt0_hdr));
-
- hops = ihdr->rt_hdr.hdrlen >> 1;
-
- if (hops > 1)
- memcpy(phdr->addr, ihdr->addr + 1,
- (hops - 1) * sizeof(struct in6_addr));
-
- ipv6_addr_copy(phdr->addr + (hops - 1), addr);
-
- phdr->rt_hdr.nexthdr = *prev_hdr;
- *prev_hdr = NEXTHDR_ROUTING;
- return &phdr->rt_hdr.nexthdr;
-}
-
-static u8 *ipv6_build_exthdr(struct sk_buff *skb, u8 *prev_hdr, u8 type, struct ipv6_opt_hdr *opt)
-{
- struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb_put(skb, ipv6_optlen(opt));
-
- memcpy(h, opt, ipv6_optlen(opt));
- h->nexthdr = *prev_hdr;
- *prev_hdr = type;
- return &h->nexthdr;
-}
-
-u8 *ipv6_build_nfrag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt,
- struct in6_addr *daddr, u32 jumbolen)
-{
- struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb->data;
-
- if (opt && opt->hopopt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_HOP, opt->hopopt);
-
- if (jumbolen) {
- u8 *jumboopt = (u8 *)skb_put(skb, 8);
-
- if (opt && opt->hopopt) {
- *jumboopt++ = IPV6_TLV_PADN;
- *jumboopt++ = 0;
- h->hdrlen++;
- } else {
- h = (struct ipv6_opt_hdr *)jumboopt;
- h->nexthdr = *prev_hdr;
- h->hdrlen = 0;
- jumboopt += 2;
- *prev_hdr = NEXTHDR_HOP;
- prev_hdr = &h->nexthdr;
- }
- jumboopt[0] = IPV6_TLV_JUMBO;
- jumboopt[1] = 4;
- *(u32*)(jumboopt+2) = htonl(jumbolen);
- }
- if (opt) {
- if (opt->dst0opt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst0opt);
- if (opt->srcrt)
- prev_hdr = ipv6_build_rthdr(skb, prev_hdr, opt->srcrt, daddr);
- }
- return prev_hdr;
-}
-
-u8 *ipv6_build_frag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt)
-{
- if (opt->dst1opt)
- prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst1opt);
- return prev_hdr;
-}
-
static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto,
struct ipv6_rt_hdr *opt,
struct in6_addr **addr_p)
--- linux-2.6.10-mm2-full/net/ipv6/icmp.c.old 2005-01-07 02:40:12.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/icmp.c 2005-01-07 02:40:20.000000000 +0100
@@ -211,7 +211,7 @@
return (*op & 0xC0) == 0x80;
}
-int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
+static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
{
struct sk_buff *skb;
struct icmp6hdr *icmp6h;
--- linux-2.6.10-mm2-full/include/net/ipv6.h.old 2005-01-07 02:40:56.000000000 +0100
+++ linux-2.6.10-mm2-full/include/net/ipv6.h 2005-01-07 02:41:03.000000000 +0100
@@ -229,8 +229,6 @@
void (*destructor)(struct sock *));
-extern int ip6_call_ra_chain(struct sk_buff *skb, int sel);
-
extern int ipv6_parse_hopopts(struct sk_buff *skb, int);
extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
--- linux-2.6.10-mm2-full/net/ipv6/ip6_output.c.old 2005-01-07 02:41:10.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/ip6_output.c 2005-01-07 02:41:15.000000000 +0100
@@ -311,7 +311,7 @@
return 0;
}
-int ip6_call_ra_chain(struct sk_buff *skb, int sel)
+static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
{
struct ip6_ra_chain *ra;
struct sock *last = NULL;
--- linux-2.6.10-mm2-full/net/ipv6/mcast.c.old 2005-01-07 02:41:35.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/mcast.c 2005-01-07 02:44:44.000000000 +0100
@@ -121,7 +121,7 @@
struct in6_addr srcs[0];
};
-struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
+static struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
/* Big mc list lock for all the sockets */
static rwlock_t ipv6_sk_mc_lock = RW_LOCK_UNLOCKED;
@@ -143,12 +143,14 @@
static int sf_setstate(struct ifmcaddr6 *pmc);
static void sf_markstate(struct ifmcaddr6 *pmc);
static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
-int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta);
-int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta);
-int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
- struct inet6_dev *idev);
+static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta);
+static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta);
+static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
+ struct inet6_dev *idev);
#define IGMP6_UNSOLICITED_IVAL (10*HZ)
@@ -272,7 +274,7 @@
return -ENOENT;
}
-struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
+static struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
{
struct net_device *dev = NULL;
struct inet6_dev *idev = NULL;
@@ -1723,8 +1725,9 @@
return rv;
}
-int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta)
+static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta)
{
struct ifmcaddr6 *pmc;
int changerec = 0;
@@ -1847,8 +1850,9 @@
/*
* Add multicast source filter list to the interface list
*/
-int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
- int sfcount, struct in6_addr *psfsrc, int delta)
+static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
+ int sfmode, int sfcount, struct in6_addr *psfsrc,
+ int delta)
{
struct ifmcaddr6 *pmc;
int isexclude;
@@ -1951,8 +1955,8 @@
spin_unlock_bh(&ma->mca_lock);
}
-int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
- struct inet6_dev *idev)
+static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
+ struct inet6_dev *idev)
{
int err;
--- linux-2.6.10-mm2-full/net/ipv6/route.c.old 2005-01-07 02:45:00.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/route.c 2005-01-07 02:45:22.000000000 +0100
@@ -208,8 +208,8 @@
/*
* pointer to the last default router chosen. BH is disabled locally.
*/
-struct rt6_info *rt6_dflt_pointer;
-spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED;
+static struct rt6_info *rt6_dflt_pointer;
+static spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED;
void rt6_reset_dflt_pointer(struct rt6_info *rt)
{
--- linux-2.6.10-mm2-full/net/ipv6/sysctl_net_ipv6.c.old 2005-01-07 02:45:38.000000000 +0100
+++ linux-2.6.10-mm2-full/net/ipv6/sysctl_net_ipv6.c 2005-01-07 02:45:46.000000000 +0100
@@ -19,7 +19,7 @@
#ifdef CONFIG_SYSCTL
-ctl_table ipv6_table[] = {
+static ctl_table ipv6_table[] = {
{
.ctl_name = NET_IPV6_ROUTE,
.procname = "route",
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-08 23:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15 0:55 [2.6 patch] net/ipv6/: misc possible cleanups Adrian Bunk
2004-12-15 1:59 ` YOSHIFUJI Hideaki / 吉藤英明
2005-01-07 3:00 ` [2.6 patch] net/ipv6/: misc cleanups Adrian Bunk
2005-01-07 3:11 ` YOSHIFUJI Hideaki / 吉藤英明
2005-01-08 23:32 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).