}
#ifdef LINUX_KEYRING_SUPPORT
-#ifdef EXPORTS_KEY_TYPE_KEYRING
+extern struct key_type key_type_keyring __attribute__((weak));
static struct key_type *__key_type_keyring = &key_type_keyring;
-#else
-static struct key_type *__key_type_keyring;
-#endif
static int
install_session_keyring(struct task_struct *task, struct key *keyring)
void osi_keyring_init(void)
{
-#ifndef EXPORTS_KEY_TYPE_KEYRING
struct task_struct *p;
+
+ if (__key_type_keyring == NULL) {
#ifdef EXPORTED_TASKLIST_LOCK
- if (&tasklist_lock)
- read_lock(&tasklist_lock);
+ if (&tasklist_lock)
+ read_lock(&tasklist_lock);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#ifdef EXPORTED_TASKLIST_LOCK
- else
-#endif
- rcu_read_lock();
+# ifdef EXPORTED_TASKLIST_LOCK
+ else
+# endif
+ rcu_read_lock();
#endif
- p = find_task_by_pid(1);
- if (p && p->user->session_keyring)
- __key_type_keyring = p->user->session_keyring->type;
+ p = find_task_by_pid(1);
+ if (p && p->user->session_keyring)
+ __key_type_keyring = p->user->session_keyring->type;
#ifdef EXPORTED_TASKLIST_LOCK
- if (&tasklist_lock)
- read_unlock(&tasklist_lock);
+ if (&tasklist_lock)
+ read_unlock(&tasklist_lock);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#ifdef EXPORTED_TASKLIST_LOCK
- else
-#endif
- rcu_read_unlock();
-#endif
+# ifdef EXPORTED_TASKLIST_LOCK
+ else
+# endif
+ rcu_read_unlock();
#endif
+ }
register_key_type(&key_type_afs_pag);
}
AC_DEFINE([LINUX_KEYRING_SUPPORT], 1, [define if your kernel has keyring support])
fi])
-
-AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
- AC_MSG_CHECKING([for exported key_type_keyring])
- AC_CACHE_VAL([ac_cv_linux_exports_key_type_keyring], [
- AC_TRY_KBUILD(
-[
-#include <linux/kernel.h>
-#include <linux/rwsem.h>
-#ifdef KEY_TYPE_H_EXISTS
-#include <linux/key-type.h>
-#endif
-#include <linux/key.h>
-],
-[
-printk("%x\n", key_type_keyring);
-],
- ac_cv_linux_exports_key_type_keyring=yes,
- ac_cv_linux_exports_key_type_keyring=no)])
- AC_MSG_RESULT($ac_cv_linux_exports_key_type_keyring)
- if test "x$ac_cv_linux_exports_key_type_keyring" = "xyes"; then
- AC_DEFINE([EXPORTS_KEY_TYPE_KEYRING], 1, [define if key_type_keyring is exported])
- fi])
-
-
AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
AC_MSG_CHECKING([if key_alloc() takes a struct task *])
AC_CACHE_VAL([ac_cv_key_alloc_needs_struct_task], [