Pass two of removing "__KERNEL__" tests from unexported headers.
Subsystems (19)
PATCH 1/1 Pass two of removing "__KERNEL__" tests from unexported headers.
This is the second pass of removing superfluous "__KERNEL__" preprocessor tests from headers under include/linux that aren't exported to userspace. The first pass (the "no-brainer" pass) dealt with headers whose *entire* contents were wrapped in a __KERNEL__ test, while this pass goes on to handle those headers that had at least a *little* content outside of the __KERNEL__ tests. (Thus, there is no overlap between the patches.)
This pass doesn't deal with any of the ext*.h or jbd*.h headers, since those headers had a little too much __KERNEL__ testing for my comfort level.
---
compile tested after "make defconfig" on x86.
include/linux/a.out.h | 8 -------- include/linux/arcdevice.h | 3 --- include/linux/bitops.h | 2 -- include/linux/blktrace_api.h | 2 -- include/linux/bsg.h | 4 ---- include/linux/compiler.h | 7 ------- include/linux/cyclomx.h | 4 ---- include/linux/dio.h | 3 --- include/linux/dnotify.h | 5 ----- include/linux/etherdevice.h | 3 --- include/linux/fcdevice.h | 2 -- include/linux/fddidevice.h | 2 -- include/linux/hid.h | 3 --- include/linux/hidraw.h | 6 ------ include/linux/hippidevice.h | 3 --- include/linux/inetdevice.h | 4 ---- include/linux/isapnp.h | 3 --- include/linux/ivtv.h | 4 ---- include/linux/ivtvfb.h | 4 ---- include/linux/key.h | 3 --- include/linux/kvm_para.h | 2 -- include/linux/mc146818rtc.h | 2 -- include/linux/mm.h | 3 --- include/linux/mnt_namespace.h | 2 -- include/linux/ncp_fs_sb.h | 4 ---- include/linux/notifier.h | 3 --- include/linux/phonedev.h | 3 --- include/linux/ppp_channel.h | 2 -- include/linux/reiserfs_fs_sb.h | 2 -- include/linux/rwsem-spinlock.h | 3 --- include/linux/sctp.h | 2 -- include/linux/skbuff.h | 6 +----- include/linux/sony-laptop.h | 4 ---- include/linux/swap.h | 3 --- include/linux/thread_info.h | 4 ---- include/linux/trdevice.h | 3 --- include/linux/usb.h | 4 ---- include/linux/virtio_console.h | 2 -- include/linux/virtio_ring.h | 3 +-- include/linux/zorro.h | 5 ----- 41 files changed, 2 insertions(+), 150 deletions(-)
include/linux/a.out.h +0 -8
@@ -132,20 +132,12 @@ enum machine_type {#endif #ifdef linux -#ifdef __KERNEL__#include <asm/page.h> -#else -#include <unistd.h> -#endif #if defined(__i386__) || defined(__mc68000__)#define SEGMENT_SIZE 1024#else #ifndef SEGMENT_SIZE -#ifdef __KERNEL__#define SEGMENT_SIZE PAGE_SIZE -#else -#define SEGMENT_SIZE getpagesize() -#endif #endif #endif #endif
include/linux/arcdevice.h +0 -3
@@ -19,8 +19,6 @@#include <asm/timex.h> #include <linux/if_arcnet.h> -#ifdef __KERNEL__ -#ifndef bool#define bool int#endif
@@ -337,5 +335,4 @@ void arcnet_unregister_proto(struct ArcProto *proto);irqreturn_t arcnet_interrupt (int irq,void *dev_id);struct net_device *alloc_arcdev (char *name); -#endif /* __KERNEL__ */ #endif /* _LINUX_ARCDEVICE_H */
include/linux/bitops.h +0 -2
@@ -2,13 +2,11 @@#define _LINUX_BITOPS_H#include <asm/types.h> -#ifdef __KERNEL__#define BIT (nr) (1UL << (nr))#define BIT_MASK (nr) (1UL << ((nr) % BITS_PER_LONG))#define BIT_WORD (nr) ((nr) / BITS_PER_LONG)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_LONG)#define BITS_PER_BYTE 8 -#endif /* * Include this here because some architectures need generic_ffs/fls in
include/linux/blktrace_api.h +0 -2
@@ -142,7 +142,6 @@ struct blk_user_trace_setup {u32 pid; }; -#ifdef __KERNEL__#if defined(CONFIG_BLK_DEV_IO_TRACE )extern int blk_trace_ioctl (struct block_device *,unsigned ,char __user *);extern void blk_trace_shutdown (struct request_queue *);
@@ -300,5 +299,4 @@ extern int blk_trace_remove(struct request_queue *q);#define blk_trace_startstop (q, start) (-ENOTTY)#define blk_trace_remove (q) (-ENOTTY)#endif /* CONFIG_BLK_DEV_IO_TRACE */ -#endif /* __KERNEL__ */ #endif
include/linux/bsg.h +0 -4
@@ -51,8 +51,6 @@ struct sg_io_v4 {__u32 padding; }; -#ifdef __KERNEL__ - #if defined(CONFIG_BLK_DEV_BSG) struct bsg_class_device { struct class_device *class_dev;
@@ -73,6 +71,4 @@ static inline void bsg_unregister_queue(struct request_queue *rq) }#endif -#endif /* __KERNEL__ */ -#endif
include/linux/compiler.h +0 -7
@@ -34,8 +34,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);# define __cond_lock (x,c) (c)#endif -#ifdef __KERNEL__ -#if __GNUC__ >=4 # include <linux/compiler-gcc4.h> #elif __GNUC__ ==3 && __GNUC_MINOR__ >=2
@@ -72,11 +70,8 @@ extern void __chk_io_ptr(const volatile void __iomem *); (typeof(ptr)) (__ptr + (off)); })#endif -#endif /* __KERNEL__ */ -#endif /* __ASSEMBLY__ */ -#ifdef __KERNEL__/* * Allow us to mark functions as 'deprecated' and have gcc emit a nice * warning for each use, in hopes of speeding the functions removal.
@@ -148,8 +143,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);#define __always_inline inline#endif -#endif /* __KERNEL__ */ -/* * From the GCC manual: *
include/linux/cyclomx.h +0 -4
@@ -27,9 +27,6 @@#include <linux/wanrouter.h> #include <linux/spinlock.h> -#ifdef __KERNEL__ -/* Kernel Interface */ -#include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */ #include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */ #ifdef CONFIG_CYCLOMX_X25
@@ -73,5 +70,4 @@ void cycx_set_state(struct cycx_device *card, int state);#ifdef CONFIG_CYCLOMX_X25 int cycx_x25_wan_init (struct cycx_device *card,wandev_conf_t *conf);#endif -#endif /* __KERNEL__ */ #endif /* _CYCLOMX_H */
include/linux/dio.h +0 -3
@@ -31,8 +31,6 @@#include <linux/device.h> -#ifdef __KERNEL__ -#include <asm/hp300hw.h> typedef __u16 dio_id ;
@@ -276,5 +274,4 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data) dev_set_drvdata(&d->dev, data); } -#endif /* __KERNEL__ */ #endif /* ndef _LINUX_DIO_H */
include/linux/dnotify.h +0 -5
@@ -16,9 +16,6 @@ struct dnotify_struct {fl_owner_t dn_owner; }; -#ifdef __KERNEL__ - -#ifdef CONFIG_DNOTIFY extern void __inode_dir_notify (struct inode *,unsigned long );
@@ -57,6 +54,4 @@ static inline void inode_dir_notify(struct inode *inode, unsigned long event)#endif /* CONFIG_DNOTIFY */ -#endif /* __KERNEL __ */ -#endif /* _LINUX_DNOTIFY_H */
include/linux/etherdevice.h +0 -3
@@ -28,7 +28,6 @@#include <linux/netdevice.h> #include <linux/random.h> -#ifdef __KERNEL__extern __be16 eth_type_trans (struct sk_buff *skb,struct net_device *dev);extern const struct header_ops eth_header_ops;
@@ -136,6 +135,4 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)BUILD_BUG_ON (ETH_ALEN !=6 ); return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; } -#endif /* __KERNEL__ */ -#endif /* _LINUX_ETHERDEVICE_H */
include/linux/fcdevice.h +0 -2
@@ -26,8 +26,6 @@#include <linux/if_fc.h> -#ifdef __KERNEL__extern struct net_device *alloc_fcdev (int sizeof_priv); -#endif #endif /* _LINUX_FCDEVICE_H */
include/linux/fddidevice.h +0 -2
@@ -24,10 +24,8 @@#include <linux/if_fddi.h> -#ifdef __KERNEL__extern __be16 fddi_type_trans (struct sk_buff *skb,struct net_device *dev);extern struct net_device *alloc_fddidev (int sizeof_priv); -#endif #endif /* _LINUX_FDDIDEVICE_H */
include/linux/hid.h +0 -3
@@ -64,8 +64,6 @@#define HID_MAX_DESCRIPTOR_SIZE 4096 -#ifdef __KERNEL__ -#include <linux/types.h> #include <linux/slab.h> #include <linux/list.h>
@@ -573,5 +571,4 @@ static inline int hid_ff_init(struct hid_device *hid) { return -1; } #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ __FILE__ , ## arg)#endif -#endif
include/linux/hidraw.h +0 -6
@@ -38,10 +38,6 @@ struct hidraw_devinfo {/* number of reports to buffer */ #define HIDRAW_BUFFER_SIZE 64 - -/* kernel-only API declarations */ -#ifdef __KERNEL__ -struct hidraw {unsigned int minor;int exist;
@@ -82,5 +78,3 @@ static inline void hidraw_disconnect(struct hid_device *hid) { }#endif #endif - -#endif
include/linux/hippidevice.h +0 -3
@@ -25,8 +25,6 @@#include <linux/if_hippi.h> -#ifdef __KERNEL__ -struct hippi_cb {__u32 ifield; };
@@ -34,6 +32,5 @@ struct hippi_cb {extern __be16 hippi_type_trans (struct sk_buff *skb,struct net_device *dev);extern struct net_device *alloc_hippi_dev (int sizeof_priv); -#endif #endif /* _LINUX_HIPPIDEVICE_H */
include/linux/inetdevice.h +0 -4
@@ -1,8 +1,6 @@#ifndef _LINUX_INETDEVICE_H#define _LINUX_INETDEVICE_H -#ifdef __KERNEL__ -#include <linux/bitmap.h> #include <linux/if.h> #include <linux/netdevice.h>
@@ -203,8 +201,6 @@ static inline void in_dev_put(struct in_device *idev)#define __in_dev_put (idev) atomic_dec(&(idev)->refcnt)#define in_dev_hold (idev) atomic_inc(&(idev)->refcnt) -#endif /* __KERNEL__ */ -static __inline____be32 inet_make_mask (int logmask) {if (logmask)
include/linux/isapnp.h +0 -3
@@ -52,8 +52,6 @@* */ -#ifdef __KERNEL__ -#define DEVICE_COUNT_COMPATIBLE 4#define ISAPNP_ANY_ID 0xffff
@@ -137,5 +135,4 @@ static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,#endif /* CONFIG_ISAPNP */ -#endif /* __KERNEL__ */ #endif /* LINUX_ISAPNP_H */
include/linux/ivtv.h +0 -4
@@ -21,11 +21,7 @@#ifndef __LINUX_IVTV_H__#define __LINUX_IVTV_H__ -#ifdef __KERNEL__#include <linux/compiler.h> /* need __user */ -#else -#define __user -#endif #include <linux/types.h> /* ivtv knows several distinct output modes: MPEG streaming,
include/linux/ivtvfb.h +0 -4
@@ -21,11 +21,7 @@#ifndef __LINUX_IVTVFB_H__#define __LINUX_IVTVFB_H__ -#ifdef __KERNEL__#include <linux/compiler.h> /* need __user */ -#else -#define __user -#endif #include <linux/types.h> /* Framebuffer external API */
include/linux/key.h +0 -3
@@ -21,8 +21,6 @@#include <linux/rcupdate.h> #include <asm/atomic.h> -#ifdef __KERNEL__ -/* key handle serial number */ typedef int32_t key_serial_t ;
@@ -311,5 +309,4 @@ extern struct key root_user_keyring;extern struct key root_session_keyring;#endif /* CONFIG_KEYS */ -#endif /* __KERNEL__ */ #endif /* _LINUX_KEY_H */
include/linux/kvm_para.h +0 -2
@@ -19,13 +19,11 @@*/ #include <asm/kvm_para.h> -#ifdef __KERNEL__static inline int kvm_para_has_feature (unsigned int feature) {if (kvm_arch_para_features () & (1UL << feature))return 1 ;return 0 ; } -#endif /* __KERNEL__ */ #endif /* __LINUX_KVM_PARA_H */
include/linux/mc146818rtc.h +0 -2
@@ -15,7 +15,6 @@#include <linux/rtc.h> /* get the user-level API */ #include <asm/mc146818rtc.h> /* register access macros */ -#ifdef __KERNEL__#include <linux/spinlock.h> /* spinlock_t */ extern spinlock_t rtc_lock;/* serialize CMOS RAM access */
@@ -35,7 +34,6 @@ struct cmos_rtc_board_info {u8 rtc_mon_alarm;/* zero, or register index */ u8 rtc_century;/* zero, or register index */ }; -#endif /********************************************************************** * register summary
include/linux/mm.h +0 -3
@@ -3,8 +3,6 @@#include <linux/errno.h> -#ifdef __KERNEL__ -#include <linux/gfp.h> #include <linux/list.h> #include <linux/mmzone.h>
@@ -1230,5 +1228,4 @@ int vmemmap_populate_basepages(struct page *start_page, unsigned long pages, int node);int vmemmap_populate (struct page *start_page,unsigned long pages,int node); -#endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */
include/linux/mnt_namespace.h +0 -2
@@ -1,6 +1,5 @@#ifndef _NAMESPACE_H_#define _NAMESPACE_H_ -#ifdef __KERNEL__#include <linux/mount.h> #include <linux/sched.h>
@@ -38,4 +37,3 @@ static inline void get_mnt_ns(struct mnt_namespace *ns) }#endif -#endif
include/linux/ncp_fs_sb.h +0 -4
@@ -13,8 +13,6 @@#include <linux/net.h> #include <linux/mutex.h> -#ifdef __KERNEL__ -#include <linux/workqueue.h> #define NCP_DEFAULT_OPTIONS 0/* 2 for packet signatures */
@@ -154,7 +152,5 @@ static inline void ncp_invalidate_conn(struct ncp_server *server) server->conn_status |= 0x01; } -#endif /* __KERNEL__ */ -#endif
include/linux/notifier.h +0 -3
@@ -110,8 +110,6 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);struct raw_notifier_head name = \ RAW_NOTIFIER_INIT(name) -#ifdef __KERNEL__ -extern int atomic_notifier_chain_register (struct atomic_notifier_head *nh,struct notifier_block *nb); extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
@@ -248,5 +246,4 @@ extern struct blocking_notifier_head reboot_notifier_list;#define VT_WRITE 0x0003/* A char got output */ #define VT_UPDATE 0x0004/* A bigger update occurred */ -#endif /* __KERNEL__ */ #endif /* _LINUX_NOTIFIER_H */
include/linux/phonedev.h +0 -3
@@ -3,8 +3,6 @@#include <linux/types.h> -#ifdef __KERNEL__ -#include <linux/poll.h> struct phone_device {
@@ -22,4 +20,3 @@ extern int phone_register_device(struct phone_device *, int unit);extern void phone_unregister_device (struct phone_device *);#endif -#endif
include/linux/ppp_channel.h +0 -2
@@ -44,7 +44,6 @@ struct ppp_channel {int latency;/* overhead time in milliseconds */ }; -#ifdef __KERNEL__/* Called by the channel when it can send some more data. */ extern void ppp_output_wakeup (struct ppp_channel *);
@@ -77,5 +76,4 @@ extern int ppp_unit_number(struct ppp_channel *);* that ppp_unregister_channel returns. */ -#endif /* __KERNEL__ */ #endif
include/linux/reiserfs_fs_sb.h +0 -2
@@ -4,10 +4,8 @@ #ifndef _LINUX_REISER_FS_SB #define _LINUX_REISER_FS_SB -#ifdef __KERNEL__ #include <linux/workqueue.h> #include <linux/rwsem.h> -#endif typedef enum { reiserfs_attrs_cleared = 0x00000001,
include/linux/rwsem-spinlock.h +0 -3
@@ -15,8 +15,6 @@#include <linux/spinlock.h> #include <linux/list.h> -#ifdef __KERNEL__ -#include <linux/types.h> struct rwsem_waiter ;
@@ -74,5 +72,4 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) return (sem->activity != 0); } -#endif /* __KERNEL__ */ #endif /* _LINUX_RWSEM_SPINLOCK_H */
include/linux/sctp.h +0 -2
@@ -63,14 +63,12 @@ typedef struct sctphdr {__be32 checksum; } __attribute__((packed)) sctp_sctphdr_t; -#ifdef __KERNEL__#include <linux/skbuff.h> static inline struct sctphdr *sctp_hdr (const struct sk_buff *skb) {return (struct sctphdr *)skb_transport_header (skb); } -#endif /* Section 3.2. Chunk Field Descriptions. */ typedef struct sctp_chunkhdr {
include/linux/skbuff.h +1 -5
@@ -333,10 +333,6 @@ struct sk_buff {atomic_t users; }; -#ifdef __KERNEL__ -/* -* Handling routines are only of interest to the kernel -*/ #include <linux/slab.h> #include <asm/system.h>
@@ -1813,5 +1809,5 @@ static inline void skb_forward_csum(struct sk_buff *skb) }bool skb_partial_csum_set (struct sk_buff *skb,u16 start,u16 off); -#endif /* __KERNEL__ */ +#endif /* _LINUX_SKBUFF_H */
include/linux/sony-laptop.h +0 -4
@@ -3,8 +3,6 @@#include <linux/types.h> -#ifdef __KERNEL__ -/* used only for communication between v4l and sony-laptop */ #define SONY_PIC_COMMAND_GETCAMERA 1/* obsolete */
@@ -29,6 +27,4 @@int sony_pic_camera_command (int command,u8 value); -#endif /* __KERNEL__ */ -#endif /* _SONYLAPTOP_H_ */
include/linux/swap.h +0 -3
@@ -87,8 +87,6 @@ struct reclaim_state {unsigned long reclaimed_slab; }; -#ifdef __KERNEL__ -struct address_space ;struct sysinfo ;struct writeback_control ;
@@ -356,5 +354,4 @@ static inline swp_entry_t get_swap_page(void)#define disable_swap_token () do { } while(0)#endif /* CONFIG_SWAP */ -#endif /* __KERNEL__*/ #endif /* _LINUX_SWAP_H */
include/linux/thread_info.h +0 -4
@@ -34,8 +34,6 @@ extern long do_no_restart_syscall(struct restart_block *parm);#include <linux/bitops.h> #include <asm/thread_info.h> -#ifdef __KERNEL__ -/* * flag set/clear/test wrappers * - pass TIF_xxxx constants to these functions
@@ -80,6 +78,4 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)#define set_need_resched () set_thread_flag(TIF_NEED_RESCHED)#define clear_need_resched () clear_thread_flag(TIF_NEED_RESCHED) -#endif -#endif /* _LINUX_THREAD_INFO_H */
include/linux/trdevice.h +0 -3
@@ -27,11 +27,8 @@#include <linux/if_tr.h> -#ifdef __KERNEL__extern __be16 tr_type_trans (struct sk_buff *skb,struct net_device *dev);extern void tr_source_route (struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev);extern struct net_device *alloc_trdev (int sizeof_priv); -#endif -#endif /* _LINUX_TRDEVICE_H */
include/linux/usb.h +0 -4
@@ -8,8 +8,6 @@#define USB_DEVICE_MAJOR 189 -#ifdef __KERNEL__ -#include <linux/errno.h> /* for -ENODEV */ #include <linux/delay.h> /* for mdelay() */ #include <linux/interrupt.h> /* for in_interrupt() */
@@ -1669,6 +1667,4 @@ extern void usb_unregister_notify(struct notifier_block *nb); __FILE__ , ## arg) -#endif /* __KERNEL__ */ -#endif
include/linux/virtio_console.h +0 -2
@@ -5,8 +5,6 @@/* The ID for virtio console */ #define VIRTIO_ID_CONSOLE 3 -#ifdef __KERNEL__int __init virtio_cons_early_init (int (*put_chars)(u32 ,const char *,int )); -#endif /* __KERNEL__ */ #endif /* _LINUX_VIRTIO_CONSOLE_H */
include/linux/virtio_ring.h +1 -2
@@ -109,7 +109,6 @@ static inline unsigned vring_size(unsigned int num, unsigned long pagesize) +sizeof (__u16) *2 +sizeof (struct vring_used_elem ) * num; } -#ifdef __KERNEL__#include <linux/irqreturn.h> struct virtio_device ;struct virtqueue ;
@@ -122,5 +121,5 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,void vring_del_virtqueue (struct virtqueue *vq);irqreturn_t vring_interrupt (int irq,void *_vq); -#endif /* __KERNEL__ */ +#endif /* _LINUX_VIRTIO_RING_H */
include/linux/zorro.h +0 -5
@@ -112,8 +112,6 @@ struct ConfigDev {#define ZORRO_NUM_AUTO 16 -#ifdef __KERNEL__ -#include <linux/init.h> #include <linux/ioport.h>
@@ -248,7 +246,4 @@ extern DECLARE_BITMAP(zorro_unused_z2ram, 128);#define Z2RAM_CHUNKMASK (0x0000ffff)#define Z2RAM_CHUNKSHIFT (16) - -#endif /* __KERNEL__ */ -#endif /* _LINUX_ZORRO_H */
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
========================================================================