linux-kernel-module: move keyring-specific

function afs_set_session_keyring into
if defined(LINUX_KEYRING_SUPPORT)
block. Otherwise compilation fails.

Reviewed-on: http://gerrit.openafs.org/10324
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit b0d75d0687a3436201411384c570448a49a9db15)

Change-Id: I268a32a09a80865cf127332c079583e5dba1ae67
Reviewed-on: http://gerrit.openafs.org/10325
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Christof Hanke <christof.hanke@rzg.mpg.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Christof Hanke 2013-10-08 11:53:17 +02:00 committed by Stephan Wiesand
parent 6c3adb6db7
commit 994da16692

View 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
@ -518,26 +538,6 @@ afs_set_name(afs_name_t aname, char *string) {
}
#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)
{