static inline void
afs_linux_pag_to_groups(afs_uint32 newpag,
- struct group_info *old, struct group_info *new) {
+ struct group_info *old, struct group_info **new) {
int need_space = 0;
int i;
gid_t g0;
}
/* install the keyring */
- spin_lock_irq(¤t->sighand->siglock);
- old = task_session_keyring(current);
- smp_wmb();
- task_session_keyring(current) = keyring;
- spin_unlock_irq(¤t->sighand->siglock);
-
+ old = afs_set_session_keyring(keyring);
if (old)
- key_put(old);
+ key_put(old);
out:
return code;
key = afs_linux_key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm, KEY_ALLOC_NOT_IN_QUOTA);
if (!IS_ERR(key)) {
- key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
+ code = key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
current_session_keyring(), NULL);
key_put(key);
} else {
seq_printf(m, ": %u", key->datalen);
}
+#if defined(STRUCT_KEY_TYPE_HAS_PREPARSE)
+static int afs_pag_instantiate(struct key *key, struct key_preparsed_payload *prep)
+#else
static int afs_pag_instantiate(struct key *key, const void *data, size_t datalen)
+#endif
{
int code;
afs_uint32 *userpag, pag = NOPAG;
code = -EINVAL;
get_group_info(current_group_info());
+#if defined(STRUCT_KEY_TYPE_HAS_PREPARSE)
+ if (prep->datalen != sizeof(afs_uint32) || !prep->data)
+#else
if (datalen != sizeof(afs_uint32) || !data)
+#endif
goto error;
/* ensure key being set matches current pag */
if (pag == NOPAG)
goto error;
- userpag = (afs_uint32 *) data;
+#if defined(STRUCT_KEY_TYPE_HAS_PREPARSE)
+ userpag = (afs_uint32 *)prep->data;
+#else
+ userpag = (afs_uint32 *)data;
+#endif
if (*userpag != pag)
goto error;
{
.name = "afs_pag",
.describe = afs_pag_describe,
+#if defined(STRUCT_KEY_TYPE_HAS_INSTANTIATE_PREP)
+ .instantiate_prep = afs_pag_instantiate,
+ .instantiate = NULL,
+#else
.instantiate = afs_pag_instantiate,
+#endif
.match = afs_pag_match,
.destroy = afs_pag_destroy,
};