#ifndef __PTLRPC_GSS_GSS_INTERNAL_H_
#define __PTLRPC_GSS_GSS_INTERNAL_H_
-#include <linux/crypto.h>
+#include <crypto/hash.h>
+#include <libcfs/libcfs_crypto.h>
#include <lustre_sec.h>
/*
*/
#define GSS_GC_INTERVAL (60 * 60) /* 60 minutes */
-static inline
-unsigned long gss_round_ctx_expiry(unsigned long expiry,
- unsigned long sec_flags)
+static inline time64_t gss_round_ctx_expiry(time64_t expiry,
+ unsigned long sec_flags)
{
- if (sec_flags & PTLRPC_SEC_FL_REVERSE)
- return expiry;
+ if (sec_flags & PTLRPC_SEC_FL_REVERSE)
+ return expiry;
- if (get_seconds() + __TIMEOUT_DELTA <= expiry)
- return expiry - __TIMEOUT_DELTA;
+ if (ktime_get_real_seconds() + __TIMEOUT_DELTA <= expiry)
+ return expiry - __TIMEOUT_DELTA;
- return expiry;
+ return expiry;
}
/*
static inline
__u32 import_to_gss_svc(struct obd_import *imp)
{
- const char *name = imp->imp_obd->obd_type->typ_name;
+ int cl_sp_to = LUSTRE_SP_ANY;
- if (!strcmp(name, LUSTRE_MGC_NAME))
- return LUSTRE_GSS_TGT_MGS;
- if (!strcmp(name, LUSTRE_MDC_NAME) ||
- !strcmp(name, LUSTRE_LWP_NAME))
+ if (imp->imp_obd)
+ cl_sp_to = imp->imp_obd->u.cli.cl_sp_to;
+
+ switch (cl_sp_to) {
+ case LUSTRE_SP_MDT:
return LUSTRE_GSS_TGT_MDS;
- if (!strcmp(name, LUSTRE_OSC_NAME) ||
- !strcmp(name, LUSTRE_OSP_NAME))
+ case LUSTRE_SP_OST:
return LUSTRE_GSS_TGT_OSS;
-
- return 0;
+ case LUSTRE_SP_MGC:
+ case LUSTRE_SP_MGS:
+ return LUSTRE_GSS_TGT_MGS;
+ case LUSTRE_SP_CLI:
+ case LUSTRE_SP_ANY:
+ default:
+ return 0;
+ }
}
/*
OBD_FREE(buf, bufsize);
}
+static inline unsigned int ll_read_key_usage(struct key *key)
+{
+#ifdef HAVE_KEY_USAGE_REFCOUNT
+ return refcount_read(&key->usage);
+#else
+ return atomic_read(&key->usage);
+#endif
+}
+
#endif /* __PTLRPC_GSS_GSS_INTERNAL_H_ */