Linux 4.4: key_payload has no member 'value'

In Linux 4.4 (146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc) type-specific and
payload data have been merged. The payload is now accessed directly and has
no 'value' member anymore.

FIXES 132677

Change-Id: Id26c40c80314a0087ecc0735029412787058ef07
Reviewed-on: https://gerrit.openafs.org/12169
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Michael Laß 2016-01-18 18:29:00 +01:00 committed by Benjamin Kaduk
parent 279f9c54b4
commit 5067ee3ae1
2 changed files with 16 additions and 1 deletions

View File

@ -948,6 +948,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h])
AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h])
AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h])
AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])

View File

@ -489,7 +489,11 @@ static int afs_pag_instantiate(struct key *key, const void *data, size_t datalen
if (*userpag != pag)
goto error;
#if defined(STRUCT_KEY_HAS_PAYLOAD_VALUE)
key->payload.value = (unsigned long) *userpag;
#else
memcpy(&key->payload, userpag, sizeof(afs_uint32));
#endif
key->datalen = sizeof(afs_uint32);
code = 0;
@ -513,9 +517,15 @@ static int afs_pag_match(const struct key *key, const void *description)
static void afs_pag_destroy(struct key *key)
{
afs_uint32 pag = key->payload.value;
afs_uint32 pag;
int locked = ISAFS_GLOCK();
#if defined(STRUCT_KEY_HAS_PAYLOAD_VALUE)
pag = key->payload.value;
#else
memcpy(&pag, &key->payload, sizeof(afs_uint32));
#endif
if (!locked)
AFS_GLOCK();
@ -609,7 +619,11 @@ osi_get_keyring_pag(afs_ucred_t *cred)
if (!IS_ERR(key)) {
if (key_validate(key) == 0 && uid_eq(key->uid, GLOBAL_ROOT_UID)) { /* also verify in the session keyring? */
#if defined(STRUCT_KEY_HAS_PAYLOAD_VALUE)
keyring_pag = key->payload.value;
#else
memcpy(&keyring_pag, &key->payload, sizeof(afs_int32));
#endif
/* Only set PAG in groups if needed,
* and the creds are from the current process */
if (afs_linux_cred_is_current(cred) &&