diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-09-29 05:00:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:11 -0400 |
commit | 50462062a02226a698a211d5bd535376c89b8603 (patch) | |
tree | 07a34af458b338c609a35072b8c6fd1ed2a235a1 /include | |
parent | cfe14677f286c9be5d683b88214def8f4b8a6f24 (diff) |
[PATCH] fs.h: ifdef security fields
[assuming BSD security levels are deleted]
The only user of i_security, f_security, s_security fields is SELinux,
however, quite a few security modules are trying to get into kernel.
So, wrap them under CONFIG_SECURITY. Adding config option for each
security field is likely an overkill.
Following Stephen Smalley's suggestion, i_security initialization is
moved to security_inode_alloc() to not clutter core code with ifdefs
and make alloc_inode() codepath tiny little bit smaller and faster.
The user of (highly greppable) struct fown_struct::security field is
still to be found. I've checked every "fown_struct" and every "f_owner"
occurence. Additionally it's removal doesn't break i386 allmodconfig
build.
struct inode, struct file, struct super_block, struct fown_struct
become smaller.
P.S. Combined with two reiserfs inode shrinking patches sent to
linux-fsdevel, I can finally suck 12 reiserfs inodes into one page.
/proc/slabinfo
-ext2_inode_cache 388 10
+ext2_inode_cache 384 10
-inode_cache 280 14
+inode_cache 276 14
-proc_inode_cache 296 13
+proc_inode_cache 292 13
-reiser_inode_cache 336 11
+reiser_inode_cache 332 12 <=
-shmem_inode_cache 372 10
+shmem_inode_cache 368 10
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 8 | ||||
-rw-r--r-- | include/linux/security.h | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 4caec6cebc42..6eafbe309483 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -553,7 +553,9 @@ struct inode { | |||
553 | unsigned int i_flags; | 553 | unsigned int i_flags; |
554 | 554 | ||
555 | atomic_t i_writecount; | 555 | atomic_t i_writecount; |
556 | #ifdef CONFIG_SECURITY | ||
556 | void *i_security; | 557 | void *i_security; |
558 | #endif | ||
557 | void *i_private; /* fs or device private pointer */ | 559 | void *i_private; /* fs or device private pointer */ |
558 | #ifdef __NEED_I_SIZE_ORDERED | 560 | #ifdef __NEED_I_SIZE_ORDERED |
559 | seqcount_t i_size_seqcount; | 561 | seqcount_t i_size_seqcount; |
@@ -645,7 +647,6 @@ struct fown_struct { | |||
645 | rwlock_t lock; /* protects pid, uid, euid fields */ | 647 | rwlock_t lock; /* protects pid, uid, euid fields */ |
646 | int pid; /* pid or -pgrp where SIGIO should be sent */ | 648 | int pid; /* pid or -pgrp where SIGIO should be sent */ |
647 | uid_t uid, euid; /* uid/euid of process setting the owner */ | 649 | uid_t uid, euid; /* uid/euid of process setting the owner */ |
648 | void *security; | ||
649 | int signum; /* posix.1b rt signal to be delivered on IO */ | 650 | int signum; /* posix.1b rt signal to be delivered on IO */ |
650 | }; | 651 | }; |
651 | 652 | ||
@@ -688,8 +689,9 @@ struct file { | |||
688 | struct file_ra_state f_ra; | 689 | struct file_ra_state f_ra; |
689 | 690 | ||
690 | unsigned long f_version; | 691 | unsigned long f_version; |
692 | #ifdef CONFIG_SECURITY | ||
691 | void *f_security; | 693 | void *f_security; |
692 | 694 | #endif | |
693 | /* needed for tty driver, and maybe others */ | 695 | /* needed for tty driver, and maybe others */ |
694 | void *private_data; | 696 | void *private_data; |
695 | 697 | ||
@@ -877,7 +879,9 @@ struct super_block { | |||
877 | int s_syncing; | 879 | int s_syncing; |
878 | int s_need_sync_fs; | 880 | int s_need_sync_fs; |
879 | atomic_t s_active; | 881 | atomic_t s_active; |
882 | #ifdef CONFIG_SECURITY | ||
880 | void *s_security; | 883 | void *s_security; |
884 | #endif | ||
881 | struct xattr_handler **s_xattr; | 885 | struct xattr_handler **s_xattr; |
882 | 886 | ||
883 | struct list_head s_inodes; /* all inodes */ | 887 | struct list_head s_inodes; /* all inodes */ |
diff --git a/include/linux/security.h b/include/linux/security.h index 9f56fb8a4a6c..9b5fea81f55e 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1595,6 +1595,7 @@ static inline void security_sb_post_pivotroot (struct nameidata *old_nd, | |||
1595 | 1595 | ||
1596 | static inline int security_inode_alloc (struct inode *inode) | 1596 | static inline int security_inode_alloc (struct inode *inode) |
1597 | { | 1597 | { |
1598 | inode->i_security = NULL; | ||
1598 | return security_ops->inode_alloc_security (inode); | 1599 | return security_ops->inode_alloc_security (inode); |
1599 | } | 1600 | } |
1600 | 1601 | ||