From: Chris Wright Currently touching audit.h triggers a large rebuild because it's sucked in via fs.h. It's there because of the getname()/putname() requirements that come with CONFIG_AUDITSYSCALL. Remove header dependency by pushing relevant putname() implementation into fs/namei.c. It adds function call overhead for putname() callers when CONFIG_AUDITSYSCALL is set, quite minor cost for detangled source. Signed-off-by: Chris Wright Signed-off-by: Andrew Morton --- 25-akpm/fs/namei.c | 15 +++++++++++++-- 25-akpm/fs/proc/base.c | 1 + 25-akpm/include/linux/fs.h | 9 +-------- 25-akpm/kernel/auditsc.c | 5 +++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff -puN fs/namei.c~detangle-audith-from-fsh fs/namei.c --- 25/fs/namei.c~detangle-audith-from-fsh 2005-02-28 14:46:53.000000000 -0800 +++ 25-akpm/fs/namei.c 2005-02-28 14:46:53.000000000 -0800 @@ -148,11 +148,22 @@ char * getname(const char __user * filen result = ERR_PTR(retval); } } - if (unlikely(current->audit_context) && !IS_ERR(result) && result) - audit_getname(result); + audit_getname(result); return result; } +#ifdef CONFIG_AUDITSYSCALL +void putname(const char *name) +{ + if (unlikely(current->audit_context)) + audit_putname(name); + else + __putname(name); +} +EXPORT_SYMBOL(putname); +#endif + + /** * generic_permission - check for access rights on a Posix-like filesystem * @inode: inode to check access rights for diff -puN fs/proc/base.c~detangle-audith-from-fsh fs/proc/base.c --- 25/fs/proc/base.c~detangle-audith-from-fsh 2005-02-28 14:46:53.000000000 -0800 +++ 25-akpm/fs/proc/base.c 2005-02-28 14:47:10.000000000 -0800 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff -puN include/linux/fs.h~detangle-audith-from-fsh include/linux/fs.h --- 25/include/linux/fs.h~detangle-audith-from-fsh 2005-02-28 14:46:53.000000000 -0800 +++ 25-akpm/include/linux/fs.h 2005-02-28 14:46:53.000000000 -0800 @@ -210,7 +210,6 @@ extern int dir_notify_enable; #include #include #include -#include #include #include @@ -1268,13 +1267,7 @@ extern void __init vfs_caches_init(unsig #ifndef CONFIG_AUDITSYSCALL #define putname(name) __putname(name) #else -#define putname(name) \ - do { \ - if (unlikely(current->audit_context)) \ - audit_putname(name); \ - else \ - __putname(name); \ - } while (0) +extern void putname(const char *name); #endif extern int register_blkdev(unsigned int, const char *); diff -puN kernel/auditsc.c~detangle-audith-from-fsh kernel/auditsc.c --- 25/kernel/auditsc.c~detangle-audith-from-fsh 2005-02-28 14:46:53.000000000 -0800 +++ 25-akpm/kernel/auditsc.c 2005-02-28 14:46:53.000000000 -0800 @@ -800,7 +800,9 @@ void audit_getname(const char *name) { struct audit_context *context = current->audit_context; - BUG_ON(!context); + if (!context || IS_ERR(name) || !name) + return; + if (!context->in_syscall) { #if AUDIT_DEBUG == 2 printk(KERN_ERR "%s:%d(:%d): ignoring getname(%p)\n", @@ -855,7 +857,6 @@ void audit_putname(const char *name) } #endif } -EXPORT_SYMBOL(audit_putname); /* Store the inode and device from a lookup. Called from * fs/namei.c:path_lookup(). */ _