]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
#
+# LC_KEY_MATCH_DATA
+#
+# 3.17 replaces key_type::match with match_preparse
+# and has new struct key_match_data
+#
+AC_DEFUN([LC_KEY_MATCH_DATA], [
+LB_CHECK_COMPILE([if struct key_match field exist],
+key_match, [
+ #include <linux/key-type.h>
+],[
+ struct key_match_data data;
+],[
+ AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
+ [struct key_match_data exist])
+])
+]) # LC_KEY_MATCH_DATA
+
+#
# LC_NFS_FILLDIR_USE_CTX
#
# 3.18 kernel moved from void cookie to struct dir_context
LC_HAVE_IOV_ITER_INIT_DIRECTION
LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
+ # 3.17
+ LC_KEY_MATCH_DATA
+
# 3.18
LC_NFS_FILLDIR_USE_CTX
/*
* the timeout is only for the case that upcall child process die abnormally.
* in any other cases it should finally update kernel key.
- *
+ *
* FIXME we'd better to incorporate the client & server side upcall timeouts
* into the framework of Adaptive Timeouts, but we need to figure out how to
* make sure that kernel knows the upcall processes is in-progress or died
RETURN(0);
}
-static
-int gss_kt_match(const struct key *key, const void *desc)
+#ifndef HAVE_KEY_MATCH_DATA
+static int
+gss_kt_match(const struct key *key, const void *desc)
+{
+ return (strcmp(key->description, (const char *) desc) == 0);
+}
+#else /* ! HAVE_KEY_MATCH_DATA */
+static bool
+gss_kt_match(const struct key *key, const struct key_match_data *match_data)
+{
+ const char *desc = match_data->raw_data;
+
+ return (strcmp(key->description, desc) == 0);
+}
+
+/*
+ * Preparse the match criterion.
+ */
+static int gss_kt_match_preparse(struct key_match_data *match_data)
{
- return (strcmp(key->description, (const char *) desc) == 0);
+ match_data->lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT;
+ match_data->cmp = gss_kt_match;
+ return 0;
}
+#endif /* HAVE_KEY_MATCH_DATA */
static
void gss_kt_destroy(struct key *key)
static struct key_type gss_key_type =
{
- .name = "lgssc",
- .def_datalen = 0,
- .instantiate = gss_kt_instantiate,
- .update = gss_kt_update,
- .match = gss_kt_match,
- .destroy = gss_kt_destroy,
- .describe = gss_kt_describe,
+ .name = "lgssc",
+ .def_datalen = 0,
+ .instantiate = gss_kt_instantiate,
+ .update = gss_kt_update,
+#ifdef HAVE_KEY_MATCH_DATA
+ .match_preparse = gss_kt_match_preparse,
+#else
+ .match = gss_kt_match,
+#endif
+ .destroy = gss_kt_destroy,
+ .describe = gss_kt_describe,
};
/****************************************