[ipv4] move proc init to newly created net/ipv4/ip_proc.c

This is the start of the seq_file work, so that I can see if anybody
will cough too much on the choosen path...

Also convert some unneeded __constat_htons to plain htons, that results
in the same code being generated.
parent ff64a6e3
...@@ -174,7 +174,7 @@ static inline ...@@ -174,7 +174,7 @@ static inline
int ip_decrease_ttl(struct iphdr *iph) int ip_decrease_ttl(struct iphdr *iph)
{ {
u32 check = iph->check; u32 check = iph->check;
check += __constant_htons(0x0100); check += htons(0x0100);
iph->check = check + (check>=0xFFFF); iph->check = check + (check>=0xFFFF);
return --iph->ttl; return --iph->ttl;
} }
...@@ -191,7 +191,7 @@ extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more ...@@ -191,7 +191,7 @@ extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more
static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, struct sock *sk) static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, struct sock *sk)
{ {
if (iph->frag_off&__constant_htons(IP_DF)) { if (iph->frag_off & htons(IP_DF)) {
/* This is only to work around buggy Windows95/2000 /* This is only to work around buggy Windows95/2000
* VJ compression implementations. If the ID field * VJ compression implementations. If the ID field
* does not change, they drop every other packet in * does not change, they drop every other packet in
...@@ -205,7 +205,7 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str ...@@ -205,7 +205,7 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more)
{ {
if (iph->frag_off&__constant_htons(IP_DF)) { if (iph->frag_off & htons(IP_DF)) {
if (sk && inet_sk(sk)->daddr) { if (sk && inet_sk(sk)->daddr) {
iph->id = htons(inet_sk(sk)->id); iph->id = htons(inet_sk(sk)->id);
inet_sk(sk)->id += 1 + more; inet_sk(sk)->id += 1 + more;
...@@ -280,4 +280,6 @@ extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, ...@@ -280,4 +280,6 @@ extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport, extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport,
u32 info); u32 info);
extern int ipv4_proc_init(void);
#endif /* _IP_H */ #endif /* _IP_H */
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
obj-y := utils.o route.o inetpeer.o proc.o protocol.o \ obj-y := utils.o route.o inetpeer.o proc.o protocol.o \
ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \ ip_output.o ip_sockglue.o ip_proc.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \ tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \ tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o
......
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/proc_fs.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/poll.h> #include <linux/poll.h>
...@@ -124,12 +123,6 @@ struct linux_mib net_statistics[NR_CPUS * 2]; ...@@ -124,12 +123,6 @@ struct linux_mib net_statistics[NR_CPUS * 2];
atomic_t inet_sock_nr; atomic_t inet_sock_nr;
#endif #endif
extern int raw_get_info(char *, char **, off_t, int);
extern int snmp_get_info(char *, char **, off_t, int);
extern int netstat_get_info(char *, char **, off_t, int);
extern int afinet_get_info(char *, char **, off_t, int);
extern int tcp_get_info(char *, char **, off_t, int);
extern int udp_get_info(char *, char **, off_t, int);
extern void ip_mc_drop_socket(struct sock *sk); extern void ip_mc_drop_socket(struct sock *sk);
#ifdef CONFIG_DLCI #ifdef CONFIG_DLCI
...@@ -1211,17 +1204,8 @@ static int __init inet_init(void) ...@@ -1211,17 +1204,8 @@ static int __init inet_init(void)
ip_mr_init(); ip_mr_init();
#endif #endif
/* ipv4_proc_init();
* Create all the /proc entries.
*/
#ifdef CONFIG_PROC_FS
proc_net_create ("raw", 0, raw_get_info);
proc_net_create ("netstat", 0, netstat_get_info);
proc_net_create ("snmp", 0, snmp_get_info);
proc_net_create ("sockstat", 0, afinet_get_info);
proc_net_create ("tcp", 0, tcp_get_info);
proc_net_create ("udp", 0, udp_get_info);
#endif /* CONFIG_PROC_FS */
return 0; return 0;
} }
module_init(inet_init); module_init(inet_init);
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* ipv4 proc support
*
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 2002/10/10
*
* 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; version 2 of the
* License
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
extern int raw_get_info(char *, char **, off_t, int);
extern int snmp_get_info(char *, char **, off_t, int);
extern int netstat_get_info(char *, char **, off_t, int);
extern int afinet_get_info(char *, char **, off_t, int);
extern int tcp_get_info(char *, char **, off_t, int);
extern int udp_get_info(char *, char **, off_t, int);
#ifdef CONFIG_PROC_FS
int __init ipv4_proc_init(void)
{
int rc = 0;
if (!proc_net_create("raw", 0, raw_get_info))
goto out_raw;
if (!proc_net_create("netstat", 0, netstat_get_info))
goto out_netstat;
if (!proc_net_create("snmp", 0, snmp_get_info))
goto out_snmp;
if (!proc_net_create("sockstat", 0, afinet_get_info))
goto out_sockstat;
if (!proc_net_create("tcp", 0, tcp_get_info))
goto out_tcp;
if (!proc_net_create("udp", 0, udp_get_info))
goto out_udp;
out:
return rc;
out_udp:
proc_net_remove("tcp");
out_tcp:
proc_net_remove("sockstat");
out_sockstat:
proc_net_remove("snmp");
out_snmp:
proc_net_remove("netstat");
out_netstat:
proc_net_remove("raw");
out_raw:
rc = -ENOMEM;
goto out;
}
#else /* CONFIG_PROC_FS */
int __init ipv4_proc_init(void)
{
return 0;
}
#endif /* CONFIG_PROC_FS */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment