linux-kernel-module: move keyring-specific
authorChristof Hanke <christof.hanke@rzg.mpg.de>
Tue, 8 Oct 2013 09:53:17 +0000 (11:53 +0200)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 8 Oct 2013 12:48:22 +0000 (05:48 -0700)
function afs_set_session_keyring into
if defined(LINUX_KEYRING_SUPPORT)
block. Otherwise compilation fails.

Change-Id: I44bb015990782793eac9326b983b704b2248b230
Reviewed-on: http://gerrit.openafs.org/10324
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/afs/LINUX/osi_compat.h

index fdddf59..15ea8b4 100644 (file)
@@ -220,6 +220,26 @@ afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type)
     return request_key(type, "_pag", NULL);
 }
 # endif /* STRUCT_TASK_STRUCT_HAS_CRED */
+
+static_inline struct key *
+afs_set_session_keyring(struct key *keyring)
+{
+    struct key *old;
+#if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
+    struct cred *new_creds;
+    old = current_session_keyring();
+    new_creds = prepare_creds();
+    rcu_assign_pointer(new_creds->session_keyring, keyring);
+    commit_creds(new_creds);
+#else
+    spin_lock_irq(&current->sighand->siglock);
+    old = task_session_keyring(current);
+    smp_wmb();
+    task_session_keyring(current) = keyring;
+    spin_unlock_irq(&current->sighand->siglock);
+#endif
+    return old;
+}
 #endif /* LINUX_KEYRING_SUPPORT */
 
 #ifdef STRUCT_TASK_STRUCT_HAS_CRED
@@ -561,26 +581,6 @@ afs_putname(afs_name_t name) {
 }
 #endif
 
-static_inline struct key *
-afs_set_session_keyring(struct key *keyring)
-{
-    struct key *old;
-#if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
-    struct cred *new_creds;
-    old = current_session_keyring();
-    new_creds = prepare_creds();
-    rcu_assign_pointer(new_creds->session_keyring, keyring);
-    commit_creds(new_creds);
-#else
-    spin_lock_irq(&current->sighand->siglock);
-    old = task_session_keyring(current);
-    smp_wmb();
-    task_session_keyring(current) = keyring;
-    spin_unlock_irq(&current->sighand->siglock);
-#endif
-    return old;
-}
-
 static inline int
 afs_truncate(struct inode *inode, int len)
 {