Whamcloud - gitweb
LU-9859 libcfs: replace cfs_get_random_bytes calls with get_random_byte() 34/35234/4
authorNeilBrown <neilb@suse.com>
Sat, 15 Jun 2019 01:21:15 +0000 (21:21 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2019 01:55:47 +0000 (01:55 +0000)
The cfs_get_random_bytes() interface adds nothing of value
to get_random_byte() (which it uses internally).  So just use the
standard interface.

Linux-commit: e904f839cdb04d1b314753a83a6e58146e315c66

Change-Id: I48e153d7658f0f616afe4e884faeb09c2dbdcd03
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/35234
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/scripts/spelling.txt
lustre/lod/lod_object.c
lustre/obdclass/lustre_handles.c
lustre/ptlrpc/client.c
lustre/ptlrpc/gss/gss_krb5_mech.c
lustre/ptlrpc/gss/gss_svc_upcall.c

index 9d9da6c..14c07ba 100644 (file)
@@ -22,6 +22,7 @@ cfs_atomic_sub||atomic_sub
 cfs_atomic_sub_and_test||atomic_sub_and_test
 cfs_atomic_sub_return||atomic_sub_return
 cfs_atomic_t||atomic_t
+cfs_get_random_bytes/get_random_bytes
 cfs_hash_bd_t||struct cfs_hash_bd
 cfs_hash_bucket_t||struct cfs_hash_bucket
 cfs_hash_cond_arg_t||struct cfs_hash_cond_arg
index 50b40b8..789a4a1 100644 (file)
@@ -6555,7 +6555,7 @@ static int lod_declare_update_rdonly(const struct lu_env *env,
        if (lo->ldo_layout_gen > (LCME_ID_MAX >> 1)) {
                __u32 layout_version;
 
-               cfs_get_random_bytes(&layout_version, sizeof(layout_version));
+               get_random_bytes(&layout_version, sizeof(layout_version));
                lo->ldo_layout_gen = layout_version & 0xffff;
        }
 
index fabd20b..6122f34 100644 (file)
@@ -36,6 +36,8 @@
 
 #define DEBUG_SUBSYSTEM S_CLASS
 
+#include <linux/random.h>
+
 #include <obd_support.h>
 #include <lustre_handles.h>
 #include <lustre_lib.h>
@@ -215,7 +217,7 @@ int class_handle_init(void)
                spin_lock_init(&bucket->lock);
        }
 
-       cfs_get_random_bytes(&handle_base, sizeof(handle_base));
+       get_random_bytes(&handle_base, sizeof(handle_base));
        LASSERT(handle_base != 0ULL);
 
        return 0;
index a0eade5..bc983ac 100644 (file)
@@ -35,6 +35,8 @@
 #define DEBUG_SUBSYSTEM S_RPC
 
 #include <linux/delay.h>
+#include <linux/random.h>
+
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_lib.h>
@@ -3334,7 +3336,7 @@ void ptlrpc_init_xid(void)
 
        spin_lock_init(&ptlrpc_last_xid_lock);
        if (now < YEAR_2004) {
-               cfs_get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
+               get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
                ptlrpc_last_xid >>= 2;
                ptlrpc_last_xid |= (1ULL << 61);
        } else {
index 4f4e0f2..39ef0c2 100644 (file)
@@ -51,6 +51,7 @@
 #define DEBUG_SUBSYSTEM S_SEC
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/random.h>
 #include <linux/slab.h>
 #include <linux/crypto.h>
 #include <linux/mutex.h>
@@ -987,7 +988,7 @@ __u32 gss_wrap_kerberos(struct gss_ctx *gctx,
         fill_krb5_header(kctx, khdr, 1);
 
         /* generate confounder */
-        cfs_get_random_bytes(conf, ke->ke_conf_size);
+       get_random_bytes(conf, ke->ke_conf_size);
 
         /* get encryption blocksize. note kc_keye might not associated with
          * a tfm, currently only for arcfour-hmac */
@@ -1160,7 +1161,7 @@ __u32 gss_wrap_bulk_kerberos(struct gss_ctx *gctx,
         fill_krb5_header(kctx, khdr, 1);
 
         /* generate confounder */
-        cfs_get_random_bytes(conf, ke->ke_conf_size);
+       get_random_bytes(conf, ke->ke_conf_size);
 
         /* get encryption blocksize. note kc_keye might not associated with
          * a tfm, currently only for arcfour-hmac */
index bc9f269..6392e76 100644 (file)
@@ -51,6 +51,7 @@
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/random.h>
 #include <linux/slab.h>
 #include <linux/hash.h>
 #include <linux/mutex.h>
@@ -1088,7 +1089,7 @@ int __init gss_init_svc_upcall(void)
         * sequence number checking, thus no chance to sent error notification
         * back to clients.
         */
-       cfs_get_random_bytes(&__ctx_index, sizeof(__ctx_index));
+       get_random_bytes(&__ctx_index, sizeof(__ctx_index));
 
        rc = _cache_register_net(&rsi_cache, &init_net);
        if (rc != 0)