From 697389f90c945e46badd4a17fa310d93e29e1faa Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 13 Apr 2005 09:49:50 +0000 Subject: [PATCH] - compile fixes for --enable-liblustre --- lustre/llite/llite_lib.c | 2 +- lustre/lmv/lmv_intent.c | 3 +- lustre/sec/gss/gss_internal.h | 75 ++++++++++++++++++++++++++++++++++++++++ lustre/sec/gss/gss_krb5_crypto.c | 16 ++++++--- lustre/sec/gss/gss_krb5_seal.c | 2 +- lustre/sec/gss/gss_krb5_seqnum.c | 2 +- lustre/sec/gss/gss_krb5_unseal.c | 2 +- lustre/sec/gss/sec_gss.c | 19 +++++----- 8 files changed, 103 insertions(+), 18 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f75a66a..4b85446 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -487,7 +487,7 @@ static int lustre_process_log(struct lustre_mount_data *lmd, char *profile, class_uuid_t uuid; struct obd_uuid lmv_uuid; struct llog_ctxt *ctxt; - int rc, err = 0; + int rc = 0, err = 0; ENTRY; if (lmd_bad_magic(lmd)) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 205d4a7..3ff3fbb 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -31,6 +31,7 @@ #include #include #include +#include #else #include #endif @@ -46,11 +47,9 @@ #include #include #include -#include #include #include "lmv_internal.h" - static inline void lmv_drop_intent_lock(struct lookup_intent *it) { if (LUSTRE_IT(it)->it_lock_mode != 0) diff --git a/lustre/sec/gss/gss_internal.h b/lustre/sec/gss/gss_internal.h index 9b1b76a..6b46e7e 100644 --- a/lustre/sec/gss/gss_internal.h +++ b/lustre/sec/gss/gss_internal.h @@ -10,6 +10,81 @@ #ifndef __SEC_GSS_GSS_INTERNAL_H_ #define __SEC_GSS_GSS_INTERNAL_H_ +/* remove this mess when libkcrypt is ready --umka */ +#ifndef __KERNEL__ +/* + * Algorithm masks and types. + */ +#define CRYPTO_ALG_TYPE_MASK 0x000000ff +#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 +#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 +#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 + +/* + * Transform masks and values (for crt_flags). + */ +#define CRYPTO_TFM_MODE_MASK 0x000000ff +#define CRYPTO_TFM_REQ_MASK 0x000fff00 +#define CRYPTO_TFM_RES_MASK 0xfff00000 + +#define CRYPTO_TFM_MODE_ECB 0x00000001 +#define CRYPTO_TFM_MODE_CBC 0x00000002 +#define CRYPTO_TFM_MODE_CFB 0x00000004 +#define CRYPTO_TFM_MODE_CTR 0x00000008 + +#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 +#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 +#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 +#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 +#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 +#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 + +/* + * Miscellaneous stuff. + */ +#define CRYPTO_UNSPEC 0 +#define CRYPTO_MAX_ALG_NAME 64 + +struct scatterlist { + struct page *page; + unsigned int offset; + __u32 dma_address; + unsigned int length; +}; + +static inline struct crypto_tfm * +crypto_alloc_tfm(const char *name, __u32 flags) +{ + return NULL; +} + +static inline void +crypto_free_tfm(struct crypto_tfm *tfm) +{ + return; +} + +static inline int +crypto_digest_setkey(struct crypto_tfm *tfm, + const __u8 *key, unsigned int keylen) +{ + return -ENOSYS; +} + +static inline unsigned int +crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) +{ + return 0; +} + +static inline unsigned int +crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) +{ + return 0; +} + +#endif /* __KERNEL__ */ + struct ptlrpc_sec; struct ptlrpc_cred; diff --git a/lustre/sec/gss/gss_krb5_crypto.c b/lustre/sec/gss/gss_krb5_crypto.c index a0358fe..2991431 100644 --- a/lustre/sec/gss/gss_krb5_crypto.c +++ b/lustre/sec/gss/gss_krb5_crypto.c @@ -54,7 +54,7 @@ #include #else #include -#include "../kcrypto/libcrypto.h" +//#include "../kcrypto/libcrypto.h" #endif #include @@ -79,6 +79,7 @@ krb5_encrypt(struct crypto_tfm *tfm, int length) { __u32 ret = -EINVAL; +#ifdef __KERNEL__ struct scatterlist sg[1]; __u8 local_iv[16] = {0}; @@ -101,6 +102,7 @@ krb5_encrypt(struct crypto_tfm *tfm, ret = crypto_cipher_encrypt_iv(tfm, sg, sg, length, local_iv); out: +#endif return(ret); } @@ -114,6 +116,7 @@ krb5_decrypt(struct crypto_tfm *tfm, int length) { __u32 ret = -EINVAL; +#ifdef __KERNEL__ struct scatterlist sg[1]; __u8 local_iv[16] = {0}; @@ -135,11 +138,13 @@ krb5_decrypt(struct crypto_tfm *tfm, ret = crypto_cipher_decrypt_iv(tfm, sg, sg, length, local_iv); out: +#endif return(ret); } //EXPORT_SYMBOL(krb5_decrypt); +#ifdef __KERNEL__ void buf_to_sg(struct scatterlist *sg, char *ptr, int len) { @@ -212,15 +217,17 @@ void obj_to_scatter_list(rawobj_t *obj, struct scatterlist *list, list++; } } +#endif int gss_encrypt_rawobj(struct crypto_tfm *tfm, rawobj_t *inobj, rawobj_t *outobj, int enc) { + int rc = -EINVAL; +#ifdef __KERNEL__ struct scatterlist *src_list, *dst_list; __u8 local_iv[16] = {0}; int list_len; - __u32 rc; ENTRY; LASSERT(outobj->len >= inobj->len); @@ -249,8 +256,9 @@ int gss_encrypt_rawobj(struct crypto_tfm *tfm, } outobj->len = inobj->len; - + EXIT; out_free: OBD_FREE(src_list, sizeof(*src_list) * list_len * 2); - RETURN(rc); +#endif + return rc; } diff --git a/lustre/sec/gss/gss_krb5_seal.c b/lustre/sec/gss/gss_krb5_seal.c index 3037a54..388a94a 100644 --- a/lustre/sec/gss/gss_krb5_seal.c +++ b/lustre/sec/gss/gss_krb5_seal.c @@ -78,7 +78,7 @@ #include #else #include -#include "../kcrypto/libcrypto.h" +//#include "../kcrypto/libcrypto.h" #include #endif diff --git a/lustre/sec/gss/gss_krb5_seqnum.c b/lustre/sec/gss/gss_krb5_seqnum.c index c80fc0f..7d327af 100644 --- a/lustre/sec/gss/gss_krb5_seqnum.c +++ b/lustre/sec/gss/gss_krb5_seqnum.c @@ -51,7 +51,7 @@ #include #else #include -#include "../kcrypto/libcrypto.h" +//#include "../kcrypto/libcrypto.h" #endif #include diff --git a/lustre/sec/gss/gss_krb5_unseal.c b/lustre/sec/gss/gss_krb5_unseal.c index ba6e058..96e6822 100644 --- a/lustre/sec/gss/gss_krb5_unseal.c +++ b/lustre/sec/gss/gss_krb5_unseal.c @@ -77,7 +77,7 @@ #include #else #include -#include "../kcrypto/libcrypto.h" +//#include "../kcrypto/libcrypto.h" #endif #include diff --git a/lustre/sec/gss/sec_gss.c b/lustre/sec/gss/sec_gss.c index e96d75b..81ebfc8 100644 --- a/lustre/sec/gss/sec_gss.c +++ b/lustre/sec/gss/sec_gss.c @@ -43,7 +43,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sec_gss.c,v 1.3 2005/04/04 13:12:39 yury Exp $ + * $Id: sec_gss.c,v 1.4 2005/04/13 09:49:50 yury Exp $ */ #ifndef EXPORT_SYMTAB @@ -366,10 +366,10 @@ struct gss_sec { #endif }; -static rwlock_t gss_ctx_lock = RW_LOCK_UNLOCKED; - #ifdef __KERNEL__ +static rwlock_t gss_ctx_lock = RW_LOCK_UNLOCKED; + struct gss_upcall_msg { struct rpc_pipe_msg gum_base; atomic_t gum_refcount; @@ -634,12 +634,12 @@ int gss_parse_init_downcall(struct gss_api_mech *gm, rawobj_t *buf, GOTO(err_free_ctx, err); GOTO(err_free_ctx, err = 0); } - if (rawobj_extract_local(&tmp_buf, (__u32 **) &p, &len)) + if (rawobj_extract_local(&tmp_buf, (__u32 **) ((void *)&p), &len)) GOTO(err_free_ctx, err); if (rawobj_dup(&ctx->gc_wire_ctx, &tmp_buf)) { GOTO(err_free_ctx, err = -ENOMEM); } - if (rawobj_extract_local(&tmp_buf, (__u32 **) &p, &len)) + if (rawobj_extract_local(&tmp_buf, (__u32 **) ((void *)&p), &len)) GOTO(err_free_wire_ctx, err); if (len) { CERROR("unexpected trailing %u bytes\n", len); @@ -1520,7 +1520,9 @@ struct ptlrpc_sec* gss_create_sec(ptlrpcs_flavor_t *flavor, { struct gss_sec *gsec; struct ptlrpc_sec *sec; +#ifdef __KERNEL__ char *pos; +#endif ENTRY; LASSERT(flavor->flavor == PTLRPC_SEC_GSS); @@ -1600,7 +1602,9 @@ static void gss_destroy_sec(struct ptlrpc_sec *sec) { struct gss_sec *gsec; +#ifdef __KERNEL__ char *pos; +#endif ENTRY; gsec = container_of(sec, struct gss_sec, gs_base); @@ -1778,18 +1782,17 @@ int __init ptlrpcs_gss_init(void) return rc; } +#ifdef __KERNEL__ static void __exit ptlrpcs_gss_exit(void) { lustre_secinit_downcall_handler = NULL; cleanup_kerberos_module(); -#ifndef __KERNEL__ -#else rpc_rmdir(LUSTRE_PIPEDIR); gss_svc_exit(); -#endif ptlrpcs_unregister(&gss_type); } +#endif MODULE_AUTHOR("Cluster File Systems, Inc. "); MODULE_DESCRIPTION("GSS Security module for Lustre"); -- 1.8.3.1