From c59ede7b78db329949d9cdcd7064e22d357560ef Mon Sep 17 00:00:00 2001 From: "Randy.Dunlap" Date: Wed, 11 Jan 2006 12:17:46 -0800 Subject: [PATCH] move capable() to capability.h - Move capable() from sched.h to capability.h; - Use where capable() is used (in include/, block/, ipc/, kernel/, a few drivers/, mm/, security/, & sound/; many more drivers/ to go) Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- block/ioctl.c | 2 +- block/scsi_ioctl.c | 1 + drivers/acorn/char/i2c.c | 1 + drivers/base/firmware_class.c | 1 + drivers/base/memory.c | 2 +- drivers/firmware/efivars.c | 2 +- drivers/oprofile/event_buffer.c | 1 + drivers/parisc/led.c | 1 + drivers/parisc/pdc_stable.c | 2 +- fs/xfs/linux-2.6/xfs_cred.h | 4 +++- include/linux/capability.h | 3 +++ include/linux/mm.h | 1 + include/linux/sched.h | 4 ---- ipc/mqueue.c | 1 + ipc/msg.c | 1 + ipc/sem.c | 1 + ipc/shm.c | 1 + ipc/util.c | 1 + kernel/acct.c | 1 + kernel/capability.c | 1 + kernel/exit.c | 1 + kernel/fork.c | 1 + kernel/kexec.c | 1 + kernel/module.c | 1 + kernel/ptrace.c | 1 + kernel/sched.c | 1 + kernel/signal.c | 1 + kernel/sys.c | 1 + kernel/sysctl.c | 1 + kernel/time.c | 1 + kernel/uid16.c | 1 + mm/filemap.c | 1 + mm/mlock.c | 1 + mm/mmap.c | 1 + mm/mremap.c | 1 + mm/swapfile.c | 1 + security/commoncap.c | 1 + security/dummy.c | 1 + security/keys/keyctl.c | 1 + security/security.c | 1 + sound/pci/emu10k1/emufx.c | 1 + 41 files changed, 44 insertions(+), 9 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 82030e1dfd6..e1109491c23 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -1,4 +1,4 @@ -#include /* for capable() */ +#include #include #include #include diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 18de84c8ccd..cc72210687e 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c index c22bb9dca1e..c26c08b3682 100644 --- a/drivers/acorn/char/i2c.c +++ b/drivers/acorn/char/i2c.c @@ -12,6 +12,7 @@ * On Acorn machines, the following i2c devices are on the bus: * - PCF8583 real time clock & static RAM */ +#include #include #include #include diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 5b3d5e9ddcb..3d384e3d34d 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -7,6 +7,7 @@ * */ +#include #include #include #include diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 58801d718cc..d1a05224627 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -13,8 +13,8 @@ #include #include #include -#include /* capable() */ #include +#include #include #include #include diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index bda5bce681b..343379f23a5 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -65,11 +65,11 @@ * v0.01 release to linux-ia64@linuxia64.org */ +#include #include #include #include #include -#include /* for capable() */ #include #include #include diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 166bca79013..b80318f0342 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index f357d3f6036..3627a2d7f79 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 38bdca2fac6..42a3c54e8e6 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -42,9 +42,9 @@ #include #include -#include /* for capable() */ #include #include +#include #include #include #include diff --git a/fs/xfs/linux-2.6/xfs_cred.h b/fs/xfs/linux-2.6/xfs_cred.h index 4af49102472..e7f3da61c6c 100644 --- a/fs/xfs/linux-2.6/xfs_cred.h +++ b/fs/xfs/linux-2.6/xfs_cred.h @@ -18,6 +18,8 @@ #ifndef __XFS_CRED_H__ #define __XFS_CRED_H__ +#include + /* * Credentials */ @@ -27,7 +29,7 @@ typedef struct cred { extern struct cred *sys_cred; -/* this is a hack.. (assums sys_cred is the only cred_t in the system) */ +/* this is a hack.. (assumes sys_cred is the only cred_t in the system) */ static __inline int capable_cred(cred_t *cr, int cid) { return (cr == sys_cred) ? 1 : capable(cid); diff --git a/include/linux/capability.h b/include/linux/capability.h index 6b4618902d3..5a23ce75262 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct { #ifdef __KERNEL__ #include +#include /* #define STRICT_CAP_T_TYPECHECKS */ @@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c) #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) +extern int capable(int cap); + #endif /* __KERNEL__ */ #endif /* !_LINUX_CAPABILITY_H */ diff --git a/include/linux/mm.h b/include/linux/mm.h index e53d2c6fd5f..c643016499a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #include #include +#include #ifdef __KERNEL__ diff --git a/include/linux/sched.h b/include/linux/sched.h index 2ae8711bfba..3b74c4bf293 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1112,10 +1112,6 @@ static inline int sas_ss_flags(unsigned long sp) : on_sig_stack(sp) ? SS_ONSTACK : 0); } - -/* code is in security.c or kernel/sys.c if !SECURITY */ -extern int capable(int cap); - /* * Routines for handling mm_structs */ diff --git a/ipc/mqueue.c b/ipc/mqueue.c index a8aa6152eea..4e776f9c80e 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -11,6 +11,7 @@ * This file is released under the GPL. */ +#include #include #include #include diff --git a/ipc/msg.c b/ipc/msg.c index d035bd2aba9..a91b64763b8 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -15,6 +15,7 @@ * (c) 1999 Manfred Spraul */ +#include #include #include #include diff --git a/ipc/sem.c b/ipc/sem.c index cb5bb2a5df9..46bb8a678de 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include "util.h" diff --git a/ipc/shm.c b/ipc/shm.c index 0b92e874fc0..4c28d2d8e30 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/ipc/util.c b/ipc/util.c index 23f1cec150c..38b9a0af3bd 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/acct.c b/kernel/acct.c index 38d57fa6b78..065d8b4e51e 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/capability.c b/kernel/capability.c index 8986a37a67e..bfa3c92e16f 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -7,6 +7,7 @@ * 30 May 2002: Cleanup, Robert M. Love */ +#include #include #include #include diff --git a/kernel/exit.c b/kernel/exit.c index 80272281492..f8e609ff189 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/fork.c b/kernel/fork.c index 3bdcab49998..16a776ec2c0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/kexec.c b/kernel/kexec.c index de1441656ef..bf39d28e4c0 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -6,6 +6,7 @@ * Version 2. See the file COPYING for more details. */ +#include #include #include #include diff --git a/kernel/module.c b/kernel/module.c index e4276046a1b..618ed6e23ec 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/ptrace.c b/kernel/ptrace.c index cceaf09ac41..5f33cdb6fff 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -7,6 +7,7 @@ * to continually duplicate across every architecture. */ +#include #include #include #include diff --git a/kernel/sched.c b/kernel/sched.c index 34a945bcc02..d129e560cc0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/signal.c b/kernel/signal.c index 08aa5b263f3..1da2e74beb9 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/sys.c b/kernel/sys.c index 9ccf713491f..d09cac23fdf 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 03b0598f236..62d4d956687 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/kernel/time.c b/kernel/time.c index 169e8329e0b..7477b1d2079 100644 --- a/kernel/time.c +++ b/kernel/time.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/kernel/uid16.c b/kernel/uid16.c index f669941e8b2..aa25605027c 100644 --- a/kernel/uid16.c +++ b/kernel/uid16.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/mm/filemap.c b/mm/filemap.c index 96de772be48..a965b6b35f2 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/mm/mlock.c b/mm/mlock.c index 4ae3a46ff76..b90c59573ab 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -5,6 +5,7 @@ * (C) Copyright 2002 Christoph Hellwig */ +#include #include #include #include diff --git a/mm/mmap.c b/mm/mmap.c index 64ba4dbcb7d..47556d2b3e9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/mm/mremap.c b/mm/mremap.c index ddaeee9a0b6..1903bdf65e4 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/mm/swapfile.c b/mm/swapfile.c index d8a5afc8b2a..957fef43fa6 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/security/commoncap.c b/security/commoncap.c index 04c12f58d65..8a6e097f99e 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -7,6 +7,7 @@ * */ +#include #include #include #include diff --git a/security/dummy.c b/security/dummy.c index a15c54709fd..f1a5bd98bf1 100644 --- a/security/dummy.c +++ b/security/dummy.c @@ -14,6 +14,7 @@ #undef DEBUG +#include #include #include #include diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 3d2ebae029c..90db5c76cf6 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include "internal.h" diff --git a/security/security.c b/security/security.c index ed5fb80769c..f693e1f66b9 100644 --- a/security/security.c +++ b/security/security.c @@ -11,6 +11,7 @@ * (at your option) any later version. */ +#include #include #include #include diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 1a903390ad6..50983725273 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3