Whamcloud - gitweb
LU-1030 clio: reimplement ll_fsync in clio way
[fs/lustre-release.git] / lustre / obdclass / capa.c
index 81a9ec5..539910c 100644 (file)
@@ -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.
  * Author: Lai Siyao<lsy@clusterfs.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-
 #define DEBUG_SUBSYSTEM S_SEC
 
 #ifdef __KERNEL__
@@ -286,13 +280,13 @@ int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
         char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
         ENTRY;
 
-        /* passing "aes" in a variable instead of a constant string keeps gcc
-         * 4.3.2 happy */
-        tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
-        if (tfm == NULL) {
-                CERROR("failed to load transform for aes\n");
-                RETURN(-EFAULT);
-        }
+       /* passing "aes" in a variable instead of a constant string keeps gcc
+        * 4.3.2 happy */
+       tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
+       if (IS_ERR(tfm)) {
+               CERROR("failed to load transform for aes\n");
+               RETURN(PTR_ERR(tfm));
+       }
 
         min = ll_crypto_tfm_alg_min_keysize(tfm);
         if (keylen < min) {
@@ -338,13 +332,13 @@ int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
         char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
         ENTRY;
 
-        /* passing "aes" in a variable instead of a constant string keeps gcc
-         * 4.3.2 happy */
-        tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
-        if (tfm == NULL) {
-                CERROR("failed to load transform for aes\n");
-                RETURN(-EFAULT);
-        }
+       /* passing "aes" in a variable instead of a constant string keeps gcc
+        * 4.3.2 happy */
+       tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
+       if (IS_ERR(tfm)) {
+               CERROR("failed to load transform for aes\n");
+               RETURN(PTR_ERR(tfm));
+       }
 
         min = ll_crypto_tfm_alg_min_keysize(tfm);
         if (keylen < min) {
@@ -388,6 +382,23 @@ void capa_cpy(void *capa, struct obd_capa *ocapa)
         cfs_spin_unlock(&ocapa->c_lock);
 }
 
+void _debug_capa(struct lustre_capa *c,
+                 struct libcfs_debug_msg_data *msgdata,
+                 const char *fmt, ... )
+{
+        va_list args;
+        va_start(args, fmt);
+        libcfs_debug_vmsg2(msgdata, fmt, args,
+                           " capability@%p fid "DFID" opc "LPX64" uid "LPU64
+                           " gid "LPU64" flags %u alg %d keyid %u timeout %u "
+                           "expiry %u\n", c, PFID(capa_fid(c)), capa_opc(c),
+                           capa_uid(c), capa_gid(c), capa_flags(c),
+                           capa_alg(c), capa_keyid(c), capa_timeout(c),
+                           capa_expiry(c));
+        va_end(args);
+}
+EXPORT_SYMBOL(_debug_capa);
+
 EXPORT_SYMBOL(init_capa_hash);
 EXPORT_SYMBOL(cleanup_capa_hash);
 EXPORT_SYMBOL(capa_add);