mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 17:54:13 +08:00
5a0e3ad6af
percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
163 lines
3.8 KiB
C
163 lines
3.8 KiB
C
#ifndef _NET_INET_IPX_H_
|
|
#define _NET_INET_IPX_H_
|
|
/*
|
|
* The following information is in its entirety obtained from:
|
|
*
|
|
* Novell 'IPX Router Specification' Version 1.10
|
|
* Part No. 107-000029-001
|
|
*
|
|
* Which is available from ftp.novell.com
|
|
*/
|
|
|
|
#include <linux/netdevice.h>
|
|
#include <net/datalink.h>
|
|
#include <linux/ipx.h>
|
|
#include <linux/list.h>
|
|
#include <linux/slab.h>
|
|
|
|
struct ipx_address {
|
|
__be32 net;
|
|
__u8 node[IPX_NODE_LEN];
|
|
__be16 sock;
|
|
};
|
|
|
|
#define ipx_broadcast_node "\377\377\377\377\377\377"
|
|
#define ipx_this_node "\0\0\0\0\0\0"
|
|
|
|
#define IPX_MAX_PPROP_HOPS 8
|
|
|
|
struct ipxhdr {
|
|
__be16 ipx_checksum __attribute__ ((packed));
|
|
#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
|
|
__be16 ipx_pktsize __attribute__ ((packed));
|
|
__u8 ipx_tctrl;
|
|
__u8 ipx_type;
|
|
#define IPX_TYPE_UNKNOWN 0x00
|
|
#define IPX_TYPE_RIP 0x01 /* may also be 0 */
|
|
#define IPX_TYPE_SAP 0x04 /* may also be 0 */
|
|
#define IPX_TYPE_SPX 0x05 /* SPX protocol */
|
|
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
|
|
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
|
|
struct ipx_address ipx_dest __attribute__ ((packed));
|
|
struct ipx_address ipx_source __attribute__ ((packed));
|
|
};
|
|
|
|
static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
|
|
{
|
|
return (struct ipxhdr *)skb_transport_header(skb);
|
|
}
|
|
|
|
struct ipx_interface {
|
|
/* IPX address */
|
|
__be32 if_netnum;
|
|
unsigned char if_node[IPX_NODE_LEN];
|
|
atomic_t refcnt;
|
|
|
|
/* physical device info */
|
|
struct net_device *if_dev;
|
|
struct datalink_proto *if_dlink;
|
|
__be16 if_dlink_type;
|
|
|
|
/* socket support */
|
|
unsigned short if_sknum;
|
|
struct hlist_head if_sklist;
|
|
spinlock_t if_sklist_lock;
|
|
|
|
/* administrative overhead */
|
|
int if_ipx_offset;
|
|
unsigned char if_internal;
|
|
unsigned char if_primary;
|
|
|
|
struct list_head node; /* node in ipx_interfaces list */
|
|
};
|
|
|
|
struct ipx_route {
|
|
__be32 ir_net;
|
|
struct ipx_interface *ir_intrfc;
|
|
unsigned char ir_routed;
|
|
unsigned char ir_router_node[IPX_NODE_LEN];
|
|
struct list_head node; /* node in ipx_routes list */
|
|
atomic_t refcnt;
|
|
};
|
|
|
|
#ifdef __KERNEL__
|
|
struct ipx_cb {
|
|
u8 ipx_tctrl;
|
|
__be32 ipx_dest_net;
|
|
__be32 ipx_source_net;
|
|
struct {
|
|
__be32 netnum;
|
|
int index;
|
|
} last_hop;
|
|
};
|
|
|
|
#include <net/sock.h>
|
|
|
|
struct ipx_sock {
|
|
/* struct sock has to be the first member of ipx_sock */
|
|
struct sock sk;
|
|
struct ipx_address dest_addr;
|
|
struct ipx_interface *intrfc;
|
|
__be16 port;
|
|
#ifdef CONFIG_IPX_INTERN
|
|
unsigned char node[IPX_NODE_LEN];
|
|
#endif
|
|
unsigned short type;
|
|
/*
|
|
* To handle special ncp connection-handling sockets for mars_nwe,
|
|
* the connection number must be stored in the socket.
|
|
*/
|
|
unsigned short ipx_ncp_conn;
|
|
};
|
|
|
|
static inline struct ipx_sock *ipx_sk(struct sock *sk)
|
|
{
|
|
return (struct ipx_sock *)sk;
|
|
}
|
|
|
|
#define IPX_SKB_CB(__skb) ((struct ipx_cb *)&((__skb)->cb[0]))
|
|
#endif
|
|
|
|
#define IPX_MIN_EPHEMERAL_SOCKET 0x4000
|
|
#define IPX_MAX_EPHEMERAL_SOCKET 0x7fff
|
|
|
|
extern struct list_head ipx_routes;
|
|
extern rwlock_t ipx_routes_lock;
|
|
|
|
extern struct list_head ipx_interfaces;
|
|
extern struct ipx_interface *ipx_interfaces_head(void);
|
|
extern spinlock_t ipx_interfaces_lock;
|
|
|
|
extern struct ipx_interface *ipx_primary_net;
|
|
|
|
extern int ipx_proc_init(void);
|
|
extern void ipx_proc_exit(void);
|
|
|
|
extern const char *ipx_frame_name(__be16);
|
|
extern const char *ipx_device_name(struct ipx_interface *intrfc);
|
|
|
|
static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
|
|
{
|
|
atomic_inc(&intrfc->refcnt);
|
|
}
|
|
|
|
extern void ipxitf_down(struct ipx_interface *intrfc);
|
|
|
|
static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
|
|
{
|
|
if (atomic_dec_and_test(&intrfc->refcnt))
|
|
ipxitf_down(intrfc);
|
|
}
|
|
|
|
static __inline__ void ipxrtr_hold(struct ipx_route *rt)
|
|
{
|
|
atomic_inc(&rt->refcnt);
|
|
}
|
|
|
|
static __inline__ void ipxrtr_put(struct ipx_route *rt)
|
|
{
|
|
if (atomic_dec_and_test(&rt->refcnt))
|
|
kfree(rt);
|
|
}
|
|
#endif /* _NET_INET_IPX_H_ */
|