X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_sec.h;h=23652c27569850ceab2cf646a7afd05f8a9bb954;hb=04e7562f872092c7a94e6d77fb5d2a7f97594bcf;hp=6a0da6792cbb2a429dcf6f13d6ccd164421f8c3a;hpb=1f0e2723f37eb86f3a88807d1200e78c10ab9565;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 6a0da67..23652c2 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +26,8 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -170,6 +170,8 @@ enum sptlrpc_bulk_service { ((__u32)(mech) | \ ((__u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) +#define SPTLRPC_SUBFLVR_GSSNULL \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_NULL, SPTLRPC_SVC_NULL) #define SPTLRPC_SUBFLVR_KRB5N \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_NULL) #define SPTLRPC_SUBFLVR_KRB5A \ @@ -194,6 +196,12 @@ enum sptlrpc_bulk_service { SPTLRPC_SVC_NULL, \ SPTLRPC_BULK_HASH, \ SPTLRPC_BULK_SVC_INTG) +#define SPTLRPC_FLVR_GSSNULL \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_NULL, \ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_NULL) #define SPTLRPC_FLVR_KRB5N \ MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \ @@ -506,15 +514,15 @@ struct ptlrpc_ctx_ops { PTLRPC_CTX_ERROR) struct ptlrpc_cli_ctx { - cfs_hlist_node_t cc_cache; /* linked into ctx cache */ - cfs_atomic_t cc_refcount; - struct ptlrpc_sec *cc_sec; - struct ptlrpc_ctx_ops *cc_ops; + cfs_hlist_node_t cc_cache; /* linked into ctx cache */ + atomic_t cc_refcount; + struct ptlrpc_sec *cc_sec; + struct ptlrpc_ctx_ops *cc_ops; cfs_time_t cc_expire; /* in seconds */ unsigned int cc_early_expire:1; unsigned long cc_flags; struct vfs_cred cc_vcred; - cfs_spinlock_t cc_lock; + spinlock_t cc_lock; cfs_list_t cc_req_list; /* waiting reqs linked here */ cfs_list_t cc_gc_chain; /* linked to gc chain */ }; @@ -796,11 +804,11 @@ struct ptlrpc_sec_sops { }; struct ptlrpc_sec_policy { - cfs_module_t *sp_owner; - char *sp_name; - __u16 sp_policy; /* policy number */ - struct ptlrpc_sec_cops *sp_cops; /* client ops */ - struct ptlrpc_sec_sops *sp_sops; /* server ops */ + struct module *sp_owner; + char *sp_name; + __u16 sp_policy; /* policy number */ + struct ptlrpc_sec_cops *sp_cops; /* client ops */ + struct ptlrpc_sec_sops *sp_sops; /* server ops */ }; #define PTLRPC_SEC_FL_REVERSE 0x0001 /* reverse sec */ @@ -817,19 +825,19 @@ struct ptlrpc_sec_policy { * \see sptlrpc_import_sec_adapt(). */ struct ptlrpc_sec { - struct ptlrpc_sec_policy *ps_policy; - cfs_atomic_t ps_refcount; - /** statistic only */ - cfs_atomic_t ps_nctx; - /** unique identifier */ - int ps_id; + struct ptlrpc_sec_policy *ps_policy; + atomic_t ps_refcount; + /** statistic only */ + atomic_t ps_nctx; + /** unique identifier */ + int ps_id; struct sptlrpc_flavor ps_flvr; enum lustre_sec_part ps_part; /** after set, no more new context will be created */ unsigned int ps_dying:1; /** owning import */ struct obd_import *ps_import; - cfs_spinlock_t ps_lock; + spinlock_t ps_lock; /* * garbage collection @@ -851,8 +859,8 @@ static inline int sec_is_rootonly(struct ptlrpc_sec *sec) struct ptlrpc_svc_ctx { - cfs_atomic_t sc_refcount; - struct ptlrpc_sec_policy *sc_policy; + atomic_t sc_refcount; + struct ptlrpc_sec_policy *sc_policy; }; /* @@ -885,13 +893,6 @@ enum sptlrpc_bulk_hash_alg { BULK_HASH_ALG_MAX }; -struct sptlrpc_hash_type { - char *sht_name; - char *sht_tfm_name; - unsigned int sht_size; -}; - -const struct sptlrpc_hash_type *sptlrpc_get_hash_type(__u8 hash_alg); const char * sptlrpc_get_hash_name(__u8 hash_alg); __u8 sptlrpc_get_hash_alg(const char *algname); @@ -950,17 +951,17 @@ char *sptlrpc_flavor2name_bulk(struct sptlrpc_flavor *sf, char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize); char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize); -static inline -struct ptlrpc_sec_policy *sptlrpc_policy_get(struct ptlrpc_sec_policy *policy) +static inline struct ptlrpc_sec_policy * +sptlrpc_policy_get(struct ptlrpc_sec_policy *policy) { - __cfs_module_get(policy->sp_owner); - return policy; + __module_get(policy->sp_owner); + return policy; } -static inline -void sptlrpc_policy_put(struct ptlrpc_sec_policy *policy) +static inline void +sptlrpc_policy_put(struct ptlrpc_sec_policy *policy) { - cfs_module_put(policy->sp_owner); + module_put(policy->sp_owner); } /* @@ -1119,12 +1120,14 @@ int sptlrpc_cli_unwrap_bulk_read(struct ptlrpc_request *req, int nob); int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); +#ifdef HAVE_SERVER_SUPPORT int sptlrpc_svc_prep_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); int sptlrpc_svc_wrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); int sptlrpc_svc_unwrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); +#endif /* bulk helpers (internal use only by policies) */ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,