Linux 4.4: key_payload has no member 'value' 69/12169/3
authorMichael Laß <lass@mail.uni-paderborn.de>
Mon, 18 Jan 2016 17:29:00 +0000 (18:29 +0100)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 21 Mar 2016 16:19:04 +0000 (12:19 -0400)
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>

acinclude.m4
src/afs/LINUX/osi_groups.c

index f8a0e23..9b4d94e 100644 (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])
index 3b068e5..a83bcb9 100644 (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) &&