Skip to content

Commit

Permalink
[PATCH] move capable() to capability.h
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rddunlap authored and Linus Torvalds committed Jan 12, 2006
1 parent e16885c commit c59ede7
Show file tree
Hide file tree
Showing 41 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion block/ioctl.c
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
1 change: 1 addition & 0 deletions block/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions drivers/acorn/char/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
*/

#include <linux/capability.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/init.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
* v0.01 release to [email protected]
*/

#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>
Expand Down
1 change: 1 addition & 0 deletions drivers/oprofile/event_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions drivers/parisc/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion drivers/parisc/pdc_stable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 3 additions & 1 deletion fs/xfs/linux-2.6/xfs_cred.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef __XFS_CRED_H__
#define __XFS_CRED_H__

#include <linux/capability.h>

/*
* Credentials
*/
Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions include/linux/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */
1 change: 1 addition & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/capability.h>

#ifdef __KERNEL__

Expand Down
4 changes: 0 additions & 4 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 1 addition & 0 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions ipc/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* (c) 1999 Manfred Spraul <[email protected]>
*/

#include <linux/capability.h>
#include <linux/config.h>
#include <linux/slab.h>
#include <linux/msg.h>
Expand Down
1 change: 1 addition & 0 deletions ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions ipc/shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* 30 May 2002: Cleanup, Robert M. Love <[email protected]>
*/

#include <linux/capability.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/security.h>
Expand Down
1 change: 1 addition & 0 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions kernel/uid16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions mm/mremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
*/

#include <linux/capability.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
Expand Down
1 change: 1 addition & 0 deletions security/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#undef DEBUG

#include <linux/capability.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
Expand Down
1 change: 1 addition & 0 deletions security/keys/keyctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions sound/pci/emu10k1/emufx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c59ede7

Please sign in to comment.