linux26-i-security-20040621
authorRainer Schöpf <rainer.schoepf@proteosys.com>
Mon, 21 Jun 2004 22:54:15 +0000 (22:54 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 21 Jun 2004 22:54:15 +0000 (22:54 +0000)
configure test is shadow@dementia.org's fault
test for i_security inode field and init if exists

acinclude.m4
src/afs/afs_vcache.c
src/afs/sysincludes.h
src/cf/linux-test4.m4

index 2b99532..67ee5d2 100644 (file)
@@ -181,6 +181,7 @@ case $system in
                 LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
                 LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
                 LINUX_FS_STRUCT_INODE_HAS_I_DEVICES
+                LINUX_FS_STRUCT_INODE_HAS_I_SECURITY
                 LINUX_INODE_SETATTR_RETURN_TYPE
                 LINUX_KERNEL_LINUX_SYSCALL_H
                 LINUX_KERNEL_SELINUX
@@ -274,6 +275,9 @@ case $system in
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_devices" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
                 fi
+                if test "x$ac_cv_linux_fs_struct_inode_has_i_security" = "xyes"; then 
+                 AC_DEFINE(STRUCT_INODE_HAS_I_SECURITY, 1, [define if you struct inode has i_security])
+                fi
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if your struct inode has data_buffers])
                 fi
index 6f56d46..a4c1130 100644 (file)
@@ -1051,6 +1051,12 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp)
 #if !defined(AFS_LINUX26_ENV)
     if (afs_globalVFS)
        ip->i_dev = afs_globalVFS->s_dev;
+#else
+#ifdef STRUCT_INODE_HAS_I_SECURITY
+    ip->i_security = NULL;
+    if (security_inode_alloc(ip))
+        panic("Cannot allocate inode security");
+#endif
 #endif
     ip->i_sb = afs_globalVFS;
     put_inode_on_dummy_list(ip);
index d12b240..c87b2a9 100644 (file)
@@ -64,6 +64,9 @@
 #include <linux/backing-dev.h>
 #include <linux/pagemap.h>
 #include <linux/namei.h>
+#ifdef STRUCT_INODE_HAS_I_SECURITY
+#include <linux/security.h>
+#endif
 #include <linux/suspend.h>
 #endif
 /* Avoid conflicts with coda overloading AFS type namespace. Must precede
index dc4b79d..08e0c97 100644 (file)
@@ -285,6 +285,22 @@ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
 CPPFLAGS="$save_CPPFLAGS"])
 
 
+AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_SECURITY], [
+AC_MSG_CHECKING(for i_security in struct inode)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_security, 
+[
+AC_TRY_COMPILE(
+[#include <linux/fs.h>],
+[struct inode _inode;
+printf("%d\n", _inode.i_security);], 
+ac_cv_linux_fs_struct_inode_has_i_security=yes,
+ac_cv_linux_fs_struct_inode_has_i_security=no)])
+AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_security)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
 AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE],[
 AC_MSG_CHECKING(for recalc_sigpending arg type)
 save_CPPFLAGS="$CPPFLAGS"