diff options
author | Randy.Dunlap | 2006-01-11 12:17:46 -0800 |
---|---|---|
committer | Linus Torvalds | 2006-01-11 18:42:13 -0800 |
commit | c59ede7b78db329949d9cdcd7064e22d357560ef (patch) | |
tree | f9dc9d464fdad5bfd464d983e77c1af031389dda | |
parent | e16885c5ad624a6efe1b1bf764e075d75f65a788 (diff) |
[PATCH] move capable() to capability.h
- Move capable() from sched.h to capability.h;
- Use <linux/capability.h> 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 <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
41 files changed, 44 insertions, 9 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index 82030e1dfd63..e1109491c234 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -1,4 +1,4 @@ -#include <linux/sched.h> /* for capable() */ +#include <linux/capability.h> #include <linux/blkdev.h> #include <linux/blkpg.h> #include <linux/hdreg.h> diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 18de84c8ccd8..cc72210687eb 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -21,6 +21,7 @@ #include <linux/string.h> #include <linux/module.h> #include <linux/blkdev.h> +#include <linux/capability.h> #include <linux/completion.h> #include <linux/cdrom.h> #include <linux/slab.h> diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c index c22bb9dca1ec..c26c08b36829 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 <linux/capability.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/time.h> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 5b3d5e9ddcb6..3d384e3d34de 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -7,6 +7,7 @@ * */ +#include <linux/capability.h> #include <linux/device.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 58801d718cc2..d1a05224627e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -13,8 +13,8 @@ #include <linux/sysdev.h> #include <linux/module.h> #include <linux/init.h> -#include <linux/sched.h> /* capable() */ #include <linux/topology.h> +#include <linux/capability.h> #include <linux/device.h> #include <linux/memory.h> #include <linux/kobject.h> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index bda5bce681b6..343379f23a53 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -65,11 +65,11 @@ * v0.01 release to linux-ia64@linuxia64.org */ +#include <linux/capability.h> #include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/init.h> -#include <linux/sched.h> /* for capable() */ #include <linux/mm.h> #include <linux/module.h> #include <linux/string.h> diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 166bca790133..b80318f03420 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c @@ -15,6 +15,7 @@ #include <linux/vmalloc.h> #include <linux/oprofile.h> #include <linux/sched.h> +#include <linux/capability.h> #include <linux/dcookies.h> #include <linux/fs.h> #include <asm/uaccess.h> diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index f357d3f60360..3627a2d7f79f 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -30,6 +30,7 @@ #include <linux/types.h> #include <linux/ioport.h> #include <linux/utsname.h> +#include <linux/capability.h> #include <linux/delay.h> #include <linux/netdevice.h> #include <linux/inetdevice.h> diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 38bdca2fac6b..42a3c54e8e6c 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -42,9 +42,9 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/sched.h> /* for capable() */ #include <linux/kernel.h> #include <linux/string.h> +#include <linux/capability.h> #include <linux/ctype.h> #include <linux/sysfs.h> #include <linux/kobject.h> diff --git a/fs/xfs/linux-2.6/xfs_cred.h b/fs/xfs/linux-2.6/xfs_cred.h index 4af491024727..e7f3da61c6c3 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 <linux/capability.h> + /* * 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 6b4618902d3d..5a23ce752629 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct { #ifdef __KERNEL__ #include <linux/spinlock.h> +#include <asm/current.h> /* #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 e53d2c6fd5f4..c643016499a1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #include <linux/sched.h> #include <linux/errno.h> +#include <linux/capability.h> #ifdef __KERNEL__ diff --git a/include/linux/sched.h b/include/linux/sched.h index 2ae8711bfba1..3b74c4bf2934 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 a8aa6152eea6..4e776f9c80e7 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -11,6 +11,7 @@ * This file is released under the GPL. */ +#include <linux/capability.h> #include <linux/init.h> #include <linux/pagemap.h> #include <linux/file.h> diff --git a/ipc/msg.c b/ipc/msg.c index d035bd2aba96..a91b64763b86 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -15,6 +15,7 @@ * (c) 1999 Manfred Spraul <manfreds@colorfullife.com> */ +#include <linux/capability.h> #include <linux/config.h> #include <linux/slab.h> #include <linux/msg.h> diff --git a/ipc/sem.c b/ipc/sem.c index cb5bb2a5df96..46bb8a678dec 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -73,6 +73,7 @@ #include <linux/security.h> #include <linux/syscalls.h> #include <linux/audit.h> +#include <linux/capability.h> #include <linux/seq_file.h> #include <asm/uaccess.h> #include "util.h" diff --git a/ipc/shm.c b/ipc/shm.c index 0b92e874fc06..4c28d2d8e305 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -27,6 +27,7 @@ #include <linux/security.h> #include <linux/syscalls.h> #include <linux/audit.h> +#include <linux/capability.h> #include <linux/ptrace.h> #include <linux/seq_file.h> diff --git a/ipc/util.c b/ipc/util.c index 23f1cec150c1..38b9a0af3bd8 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -20,6 +20,7 @@ #include <linux/smp_lock.h> #include <linux/vmalloc.h> #include <linux/slab.h> +#include <linux/capability.h> #include <linux/highuid.h> #include <linux/security.h> #include <linux/rcupdate.h> diff --git a/kernel/acct.c b/kernel/acct.c index 38d57fa6b78f..065d8b4e51ef 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -47,6 +47,7 @@ #include <linux/mm.h> #include <linux/slab.h> #include <linux/acct.h> +#include <linux/capability.h> #include <linux/file.h> #include <linux/tty.h> #include <linux/security.h> diff --git a/kernel/capability.c b/kernel/capability.c index 8986a37a67ea..bfa3c92e16f2 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -7,6 +7,7 @@ * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net> */ +#include <linux/capability.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/security.h> diff --git a/kernel/exit.c b/kernel/exit.c index 802722814925..f8e609ff1893 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -10,6 +10,7 @@ #include <linux/interrupt.h> #include <linux/smp_lock.h> #include <linux/module.h> +#include <linux/capability.h> #include <linux/completion.h> #include <linux/personality.h> #include <linux/tty.h> diff --git a/kernel/fork.c b/kernel/fork.c index 3bdcab49998d..16a776ec2c0b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -28,6 +28,7 @@ #include <linux/binfmts.h> #include <linux/mman.h> #include <linux/fs.h> +#include <linux/capability.h> #include <linux/cpu.h> #include <linux/cpuset.h> #include <linux/security.h> diff --git a/kernel/kexec.c b/kernel/kexec.c index de1441656efd..bf39d28e4c0e 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -6,6 +6,7 @@ * Version 2. See the file COPYING for more details. */ +#include <linux/capability.h> #include <linux/mm.h> #include <linux/file.h> #include <linux/slab.h> diff --git a/kernel/module.c b/kernel/module.c index e4276046a1b6..618ed6e23ecc 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -28,6 +28,7 @@ #include <linux/syscalls.h> #include <linux/fcntl.h> #include <linux/rcupdate.h> +#include <linux/capability.h> #include <linux/cpu.h> #include <linux/moduleparam.h> #include <linux/errno.h> diff --git a/kernel/ptrace.c b/kernel/ptrace.c index cceaf09ac413..5f33cdb6fff5 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -7,6 +7,7 @@ * to continually duplicate across every architecture. */ +#include <linux/capability.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/errno.h> diff --git a/kernel/sched.c b/kernel/sched.c index 34a945bcc022..d129e560cc0d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -27,6 +27,7 @@ #include <linux/smp_lock.h> #include <asm/mmu_context.h> #include <linux/interrupt.h> +#include <linux/capability.h> #include <linux/completion.h> #include <linux/kernel_stat.h> #include <linux/security.h> diff --git a/kernel/signal.c b/kernel/signal.c index 08aa5b263f36..1da2e74beb97 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -25,6 +25,7 @@ #include <linux/posix-timers.h> #include <linux/signal.h> #include <linux/audit.h> +#include <linux/capability.h> #include <asm/param.h> #include <asm/uaccess.h> #include <asm/unistd.h> diff --git a/kernel/sys.c b/kernel/sys.c index 9ccf713491f9..d09cac23fdfd 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -19,6 +19,7 @@ #include <linux/kernel.h> #include <linux/kexec.h> #include <linux/workqueue.h> +#include <linux/capability.h> #include <linux/device.h> #include <linux/key.h> #include <linux/times.h> diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 03b0598f2369..62d4d9566876 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -25,6 +25,7 @@ #include <linux/slab.h> #include <linux/sysctl.h> #include <linux/proc_fs.h> +#include <linux/capability.h> #include <linux/ctype.h> #include <linux/utsname.h> #include <linux/capability.h> diff --git a/kernel/time.c b/kernel/time.c index 169e8329e0b6..7477b1d2079e 100644 --- a/kernel/time.c +++ b/kernel/time.c @@ -29,6 +29,7 @@ #include <linux/module.h> #include <linux/timex.h> +#include <linux/capability.h> #include <linux/errno.h> #include <linux/smp_lock.h> #include <linux/syscalls.h> diff --git a/kernel/uid16.c b/kernel/uid16.c index f669941e8b26..aa25605027c8 100644 --- a/kernel/uid16.c +++ b/kernel/uid16.c @@ -10,6 +10,7 @@ #include <linux/notifier.h> #include <linux/reboot.h> #include <linux/prctl.h> +#include <linux/capability.h> #include <linux/init.h> #include <linux/highuid.h> #include <linux/security.h> diff --git a/mm/filemap.c b/mm/filemap.c index 96de772be487..a965b6b35f26 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -15,6 +15,7 @@ #include <linux/compiler.h> #include <linux/fs.h> #include <linux/aio.h> +#include <linux/capability.h> #include <linux/kernel_stat.h> #include <linux/mm.h> #include <linux/swap.h> diff --git a/mm/mlock.c b/mm/mlock.c index 4ae3a46ff768..b90c59573abf 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -5,6 +5,7 @@ * (C) Copyright 2002 Christoph Hellwig */ +#include <linux/capability.h> #include <linux/mman.h> #include <linux/mm.h> #include <linux/mempolicy.h> diff --git a/mm/mmap.c b/mm/mmap.c index 64ba4dbcb7de..47556d2b3e90 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -13,6 +13,7 @@ #include <linux/pagemap.h> #include <linux/swap.h> #include <linux/syscalls.h> +#include <linux/capability.h> #include <linux/init.h> #include <linux/file.h> #include <linux/fs.h> diff --git a/mm/mremap.c b/mm/mremap.c index ddaeee9a0b69..1903bdf65e42 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -13,6 +13,7 @@ #include <linux/shm.h> #include <linux/mman.h> #include <linux/swap.h> +#include <linux/capability.h> #include <linux/fs.h> #include <linux/highmem.h> #include <linux/security.h> diff --git a/mm/swapfile.c b/mm/swapfile.c index d8a5afc8b2a3..957fef43fa60 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -25,6 +25,7 @@ #include <linux/rmap.h> #include <linux/security.h> #include <linux/backing-dev.h> +#include <linux/capability.h> #include <linux/syscalls.h> #include <asm/pgtable.h> diff --git a/security/commoncap.c b/security/commoncap.c index 04c12f58d656..8a6e097f99ea 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -7,6 +7,7 @@ * */ +#include <linux/capability.h> #include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/security/dummy.c b/security/dummy.c index a15c54709fde..f1a5bd98bf10 100644 --- a/security/dummy.c +++ b/security/dummy.c @@ -14,6 +14,7 @@ #undef DEBUG +#include <linux/capability.h> #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 3d2ebae029c1..90db5c76cf6e 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -16,6 +16,7 @@ #include <linux/syscalls.h> #include <linux/keyctl.h> #include <linux/fs.h> +#include <linux/capability.h> #include <linux/err.h> #include <asm/uaccess.h> #include "internal.h" diff --git a/security/security.c b/security/security.c index ed5fb80769c3..f693e1f66b98 100644 --- a/security/security.c +++ b/security/security.c @@ -11,6 +11,7 @@ * (at your option) any later version. */ +#include <linux/capability.h> #include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 1a903390ad6d..509837252735 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -27,6 +27,7 @@ #include <sound/driver.h> #include <linux/pci.h> +#include <linux/capability.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/vmalloc.h> |