X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fgss%2Fgss_internal.h;h=f0b9d2827571d3f135aa0228e6392a3c315748e5;hb=0a773f04b28860c3748f9f1460818b8461c96ad1;hp=65fc5f8289f6c73e74ec248a274badd8f2e9ba9e;hpb=d10200a80770f0029d1d665af954187b9ad883df;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/gss/gss_internal.h b/lustre/ptlrpc/gss/gss_internal.h index 65fc5f8..f0b9d28 100644 --- a/lustre/ptlrpc/gss/gss_internal.h +++ b/lustre/ptlrpc/gss/gss_internal.h @@ -11,7 +11,8 @@ #ifndef __PTLRPC_GSS_GSS_INTERNAL_H_ #define __PTLRPC_GSS_GSS_INTERNAL_H_ -#include +#include +#include #include /* @@ -72,17 +73,16 @@ int buffer_extract_bytes(const void **buf, __u32 *buflen, */ #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; } /* @@ -124,18 +124,24 @@ enum ptlrpc_gss_header_flags { 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; + } } /* @@ -548,4 +554,13 @@ void __dbg_memdump(char *name, void *ptr, int size) 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_ */