Whamcloud - gitweb
LU-1735 ptlrpc: only set jobid if not already set
[fs/lustre-release.git] / lustre / obdclass / capa.c
index f34a543..4fc3fff 100644 (file)
  * Author: Lai Siyao<lsy@clusterfs.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-
 #define DEBUG_SUBSYSTEM S_SEC
 
 #ifdef __KERNEL__
@@ -69,7 +65,7 @@ cfs_mem_cache_t *capa_cachep = NULL;
 
 #ifdef __KERNEL__
 /* lock for capa hash/capa_list/fo_capa_keys */
-cfs_spinlock_t capa_lock = CFS_SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(capa_lock);
 
 cfs_list_t capa_list[CAPA_SITE_MAX];
 
@@ -101,6 +97,7 @@ cfs_hlist_head_t *init_capa_hash(void)
                 CFS_INIT_HLIST_HEAD(hash + i);
         return hash;
 }
+EXPORT_SYMBOL(init_capa_hash);
 
 #ifdef __KERNEL__
 static inline int capa_on_server(struct obd_capa *ocapa)
@@ -134,6 +131,7 @@ void cleanup_capa_hash(cfs_hlist_head_t *hash)
 
         OBD_FREE(hash, CFS_PAGE_SIZE);
 }
+EXPORT_SYMBOL(cleanup_capa_hash);
 
 static inline int capa_hashfn(struct lu_fid *fid)
 {
@@ -223,6 +221,7 @@ struct obd_capa *capa_add(cfs_hlist_head_t *hash, struct lustre_capa *capa)
                 return old;
         }
 }
+EXPORT_SYMBOL(capa_add);
 
 struct obd_capa *capa_lookup(cfs_hlist_head_t *hash, struct lustre_capa *capa,
                              int alive)
@@ -240,6 +239,7 @@ struct obd_capa *capa_lookup(cfs_hlist_head_t *hash, struct lustre_capa *capa,
 
         return ocapa;
 }
+EXPORT_SYMBOL(capa_lookup);
 
 int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
 {
@@ -272,6 +272,7 @@ int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
 
         return 0;
 }
+EXPORT_SYMBOL(capa_hmac);
 
 int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
 {
@@ -284,13 +285,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) {
@@ -324,6 +325,7 @@ out:
         ll_crypto_free_blkcipher(tfm);
         return rc;
 }
+EXPORT_SYMBOL(capa_encrypt_id);
 
 int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
 {
@@ -336,13 +338,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) {
@@ -377,6 +379,7 @@ out:
         ll_crypto_free_blkcipher(tfm);
         return rc;
 }
+EXPORT_SYMBOL(capa_decrypt_id);
 #endif
 
 void capa_cpy(void *capa, struct obd_capa *ocapa)
@@ -385,6 +388,7 @@ void capa_cpy(void *capa, struct obd_capa *ocapa)
         *(struct lustre_capa *)capa = ocapa->c_capa;
         cfs_spin_unlock(&ocapa->c_lock);
 }
+EXPORT_SYMBOL(capa_cpy);
 
 void _debug_capa(struct lustre_capa *c,
                  struct libcfs_debug_msg_data *msgdata,
@@ -402,12 +406,3 @@ void _debug_capa(struct lustre_capa *c,
         va_end(args);
 }
 EXPORT_SYMBOL(_debug_capa);
-
-EXPORT_SYMBOL(init_capa_hash);
-EXPORT_SYMBOL(cleanup_capa_hash);
-EXPORT_SYMBOL(capa_add);
-EXPORT_SYMBOL(capa_lookup);
-EXPORT_SYMBOL(capa_hmac);
-EXPORT_SYMBOL(capa_encrypt_id);
-EXPORT_SYMBOL(capa_decrypt_id);
-EXPORT_SYMBOL(capa_cpy);