From c59ede7b78db329949d9cdcd7064e22d357560ef Mon Sep 17 00:00:00 2001 From: "Randy.Dunlap" Date: Wed, 11 Jan 2006 12:17:46 -0800 Subject: [PATCH] [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 82030e1dfd..e1109491c2 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 18de84c8cc..cc72210687 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 c22bb9dca1..c26c08b368 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 5b3d5e9ddc..3d384e3d34 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 58801d718c..d1a0522462 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 bda5bce681..343379f23a 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 166bca7901..b80318f034 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 f357d3f603..3627a2d7f7 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 38bdca2fac..42a3c54e8e 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 4af4910247..e7f3da61c6 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 6b4618902d..5a23ce7526 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 e53d2c6fd5..c643016499 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 2ae8711bfb..3b74c4bf29 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 a8aa6152ee..4e776f9c80 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 d035bd2aba..a91b64763b 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 cb5bb2a5df..46bb8a678d 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 0b92e874fc..4c28d2d8e3 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 23f1cec150..38b9a0af3b 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 38d57fa6b7..065d8b4e51 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 8986a37a67..bfa3c92e16 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 8027228149..f8e609ff18 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 3bdcab4999..16a776ec2c 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 de1441656e..bf39d28e4c 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 e4276046a1..618ed6e23e 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 cceaf09ac4..5f33cdb6ff 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 34a945bcc0..d129e560cc 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 08aa5b263f..1da2e74beb 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 9ccf713491..d09cac23fd 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 03b0598f23..62d4d95668 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 169e8329e0..7477b1d207 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 f669941e8b..aa25605027 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 96de772be4..a965b6b35f 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 4ae3a46ff7..b90c59573a 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 64ba4dbcb7..47556d2b3e 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 ddaeee9a0b..1903bdf65e 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 d8a5afc8b2..957fef43fa 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 04c12f58d6..8a6e097f99 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 a15c54709f..f1a5bd98bf 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 3d2ebae029..90db5c76cf 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 ed5fb80769..f693e1f66b 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 1a903390ad..5098372527 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include -- 2.39.5