Whamcloud - gitweb
b=18751 Move prng.c to libcfs
authorMaxim Patlasov <Maxim.Patlasov@sun.com>
Fri, 6 Aug 2010 13:21:46 +0000 (17:21 +0400)
committerMikhail Pershin <tappro@sun.com>
Sat, 7 Aug 2010 05:06:27 +0000 (09:06 +0400)
i=adilger
i=maxim

Note that some function names were changed:
  cfs_get_random_bytes --> cfs_get_random_bytes_prim
  ll_get_random_bytes --> cfs_get_random_bytes
  ll_rand --> cfs_rand
  ll_srand --> cfs_srand

39 files changed:
libcfs/include/libcfs/darwin/darwin-utils.h
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/linux/linux-prim.h
libcfs/include/libcfs/user-prim.h
libcfs/include/libcfs/winnt/portals_utils.h
libcfs/libcfs/Makefile.in
libcfs/libcfs/autoMakefile.am
libcfs/libcfs/prng.c [moved from lustre/lvfs/prng.c with 66% similarity]
lnet/klnds/o2iblnd/o2iblnd.h
lustre/include/linux/lustre_handles.h
lustre/include/lustre_lib.h
lustre/include/obd_class.h
lustre/liblustre/lutil.c
lustre/llite/llite_lib.c
lustre/llite/remote_perm.c
lustre/llite/super25.c
lustre/lov/lov_qos.c
lustre/lvfs/Makefile.in
lustre/lvfs/autoMakefile.am
lustre/lvfs/lvfs_lib.c
lustre/lvfs/quotafmt_test.c
lustre/mds/handler.c
lustre/mds/mds_fs.c
lustre/mdt/mdt_capa.c
lustre/mgc/mgc_request.c
lustre/obdclass/llog_test.c
lustre/obdclass/lustre_handles.c
lustre/obdclass/mea.c
lustre/obdecho/echo_client.c
lustre/osd-ldiskfs/osd_handler.c
lustre/ptlrpc/client.c
lustre/ptlrpc/gss/gss_bulk.c
lustre/ptlrpc/gss/gss_cli_upcall.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/gss/gss_krb5_mech.c
lustre/ptlrpc/gss/gss_pipefs.c
lustre/ptlrpc/gss/gss_svc_upcall.c
lustre/ptlrpc/gss/lproc_gss.c
lustre/ptlrpc/gss/sec_gss.c

index 508db7f..f91b298 100644 (file)
@@ -61,7 +61,7 @@ char * ul2dstr(unsigned long address, char *buf, int len);
 #define set_bit(i, a)                           setbit(a, i)
 #define clear_bit(i, a)                         clrbit(a, i)
 
-#define get_random_bytes(buf, len)              read_random(buf, len)
+#define cfs_get_random_bytes_prim(buf, len)     read_random(buf, len)
 
 #endif  /* __KERNEL__ */
 
index 549dab6..5ec895a 100644 (file)
@@ -284,6 +284,16 @@ int cfs_oflags2univ(int flags);
 /* convert universal open flags to local open flags */
 int cfs_univ2oflags(int flags);
 
+/*
+ * Random number handling
+ */
+
+/* returns a random 32-bit integer */
+unsigned int cfs_rand(void);
+/* seed the generator */
+void cfs_srand(unsigned int, unsigned int);
+void cfs_get_random_bytes(void *buf, int size);
+
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
 #include <libcfs/libcfs_ioctl.h>
index de374e5..b4612ad 100644 (file)
@@ -62,6 +62,9 @@
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
+#ifdef HAVE_LINUX_RANDOM_H
+#include <linux/random.h>
+#endif
 
 #include <linux/miscdevice.h>
 #include <libcfs/linux/portals_compat25.h>
@@ -378,5 +381,5 @@ typedef struct group_info cfs_group_info_t;
 /*
  * Random bytes
  */
-#define cfs_get_random_bytes(buf, nbytes)  get_random_bytes(buf, nbytes)
+#define cfs_get_random_bytes_prim(buf, nbytes)  get_random_bytes(buf, nbytes)
 #endif
index 9b2755c..8605d37 100644 (file)
@@ -200,6 +200,8 @@ typedef struct cfs_group_info {
 # define max(x,y) ((x)>(y) ? (x) : (y))
 #endif
 
+#define cfs_get_random_bytes_prim(val, size)     (*val) = 0
+
 /* utility libcfs init/fini entries */
 #ifdef __WINNT__
 extern int libcfs_arch_init(void);
index e0572b9..27a554c 100644 (file)
@@ -240,7 +240,7 @@ static inline void read_random(char *buf, int len)
     }
 }
 
-#define cfs_get_random_bytes(buf, len)  read_random(buf, len)
+#define cfs_get_random_bytes_prim(buf, len)  read_random(buf, len)
 
 /* do NOT use function or expression as parameters ... */
 
index 0f7913b..fbeefdd 100644 (file)
@@ -25,7 +25,7 @@ sources:
 endif
 
 libcfs-all-objs := debug.o nidstrings.o lwt.o module.o tracefile.o watchdog.o \
-       libcfs_string.o hash.o kernel_user_comm.o
+       libcfs_string.o hash.o kernel_user_comm.o prng.o
 
 libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
 
index 644cd57..e15394a 100644 (file)
@@ -43,7 +43,7 @@ DIST_SUBDIRS := linux util posix darwin
 if LIBLUSTRE
 noinst_LIBRARIES= libcfs.a
 libcfs_a_SOURCES= posix/posix-debug.c user-prim.c user-lock.c user-tcpip.c \
-                 user-bitops.c user-mem.c hash.c kernel_user_comm.c
+                  prng.c user-bitops.c user-mem.c hash.c kernel_user_comm.c
 libcfs_a_CPPFLAGS = $(LLCPPFLAGS)
 libcfs_a_CFLAGS = $(LLCFLAGS)
 endif
@@ -88,6 +88,6 @@ install-data-hook: $(install_data_hook)
 EXTRA_DIST := Info.plist
 
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ linux-*.c linux/*.o darwin/*.o libcfs
-DIST_SOURCES := $(libcfs-all-objs:%.o=%.c) tracefile.h user-prim.c \
+DIST_SOURCES := $(libcfs-all-objs:%.o=%.c) tracefile.h user-prim.c prng.c \
       user-lock.c user-tcpip.c user-bitops.c\
       user-mem.c kernel_user_comm.c linux/linux-tracefile.h
similarity index 66%
rename from lustre/lvfs/prng.c
rename to libcfs/libcfs/prng.c
index c07730e..f1568f4 100644 (file)
@@ -33,7 +33,7 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * lustre/lvfs/prng.c
+ * libcfs/libcfs/prng.c
  *
  * concatenation of following two 16-bit multiply with carry generators
  * x(n)=a*x(n-1)+carry mod 2^16 and y(n)=b*y(n-1)+carry mod 2^16,
 # define EXPORT_SYMTAB
 #endif
 
-#ifndef __KERNEL__
-#include <liblustre.h>
-#define cfs_get_random_bytes(val, size)     (*val) = 0
-#endif
-#include <obd_class.h>
-#if defined(HAVE_LINUX_RANDOM_H)
-#include <linux/random.h>
-#endif
+#include <libcfs/libcfs.h>
 
 /*
 From: George Marsaglia <geo@stat.fsu.edu>
@@ -78,32 +71,49 @@ Date: Tue, 30 Sep 1997 05:29:35 -0700
 
 static unsigned int seed_x = 521288629;
 static unsigned int seed_y = 362436069;
-unsigned int ll_rand(void)
-{
 
-       seed_x = RANDOM_CONST_A * (seed_x & 65535) + (seed_x >> 16);
-       seed_y = RANDOM_CONST_B * (seed_y & 65535) + (seed_y >> 16);
+/**
+ * cfs_rand - creates new seeds
+ *
+ * First it creates new seeds from the previous seeds. Then it generates a
+ * new psuedo random number for use.
+ *
+ * Returns a pseudo-random 32-bit integer
+ */
+unsigned int cfs_rand(void)
+{
+        seed_x = RANDOM_CONST_A * (seed_x & 65535) + (seed_x >> 16);
+        seed_y = RANDOM_CONST_B * (seed_y & 65535) + (seed_y >> 16);
 
-       return ((seed_x << 16) + (seed_y & 65535));
+        return ((seed_x << 16) + (seed_y & 65535));
 }
-EXPORT_SYMBOL(ll_rand);
+CFS_EXPORT_SYMBOL(cfs_rand);
 
-/* Note that if the input seeds are not completely random, then there is
- * a preferred location for the entropy in the two seeds, in order to avoid
- * the initial values from the PRNG to be the same each time.
+/**
+ * cfs_srand - sets the inital seed
+ * @seed1 : (seed_x) should have the most entropy in the low bits of the word
+ * @seed2 : (seed_y) should have the most entropy in the high bits of the word
  *
- * seed1 (seed_x) should have the most entropy in the low bits of the word
- * seed2 (seed_y) should have the most entropy in the high bits of the word */
-void ll_srand(unsigned int seed1, unsigned int seed2)
+ * Replaces the original seeds with new values. Used to generate a new pseudo
+ * random numbers.
+ */
+void cfs_srand(unsigned int seed1, unsigned int seed2)
 {
-       if (seed1)
-               seed_x = seed1; /* use default seeds if parameter is 0 */
-       if (seed2)
-               seed_y = seed2;
+        if (seed1)
+                seed_x = seed1; /* use default seeds if parameter is 0 */
+        if (seed2)
+                seed_y = seed2;
 }
-EXPORT_SYMBOL(ll_srand);
+CFS_EXPORT_SYMBOL(cfs_srand);
 
-void ll_get_random_bytes(void *buf, int size)
+/**
+ * cfs_get_random_bytes - generate a bunch of random numbers
+ * @buf : buffer to fill with random numbers
+ * @size: size of passed in buffer
+ *
+ * Fills a buffer with random bytes
+ */
+void cfs_get_random_bytes(void *buf, int size)
 {
         int *p = buf;
         int rem, tmp;
@@ -112,30 +122,24 @@ void ll_get_random_bytes(void *buf, int size)
 
         rem = min((int)((unsigned long)buf & (sizeof(int) - 1)), size);
         if (rem) {
-                cfs_get_random_bytes(&tmp, sizeof(tmp));
-                tmp ^= ll_rand();
+                cfs_get_random_bytes_prim(&tmp, sizeof(tmp));
+                tmp ^= cfs_rand();
                 memcpy(buf, &tmp, rem);
                 p = buf + rem;
                 size -= rem;
         }
 
         while (size >= sizeof(int)) {
-                cfs_get_random_bytes(&tmp, sizeof(tmp));
-                *p = ll_rand() ^ tmp;
+                cfs_get_random_bytes_prim(&tmp, sizeof(tmp));
+                *p = cfs_rand() ^ tmp;
                 size -= sizeof(int);
                 p++;
         }
         buf = p;
         if (size) {
-                cfs_get_random_bytes(&tmp, sizeof(tmp));
-                tmp ^= ll_rand();
+                cfs_get_random_bytes_prim(&tmp, sizeof(tmp));
+                tmp ^= cfs_rand();
                 memcpy(buf, &tmp, size);
         }
 }
-EXPORT_SYMBOL(ll_get_random_bytes); 
-
-void ll_generate_random_uuid(class_uuid_t uuid_out)
-{
-        ll_get_random_bytes(uuid_out, sizeof(class_uuid_t));
-}
-EXPORT_SYMBOL(ll_generate_random_uuid);
+CFS_EXPORT_SYMBOL(cfs_get_random_bytes);
index a78fa53..9122f2a 100644 (file)
@@ -65,7 +65,6 @@
 #include <linux/list.h>
 #include <linux/kmod.h>
 #include <linux/sysctl.h>
-#include <linux/random.h>
 #include <linux/pci.h>
 
 #include <net/sock.h>
index 29eec05..7393383 100644 (file)
@@ -45,7 +45,6 @@
 #include <asm/types.h>
 #include <asm/atomic.h>
 #include <linux/list.h>
-#include <linux/random.h>
 #include <linux/version.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
index f4ebfb6..02cc979 100644 (file)
 #error Unsupported operating system.
 #endif
 
-/* prng.c */
-unsigned int ll_rand(void);        /* returns a random 32-bit integer */
-void ll_srand(unsigned int, unsigned int);     /* seed the generator */
-void ll_get_random_bytes(void *buf, int size);
-
 /* target.c */
 struct ptlrpc_request;
 struct obd_export;
index dbf25cc..22fda83 100644 (file)
@@ -2229,6 +2229,6 @@ int mea_name2idx(struct lmv_stripe_md *mea, const char *name, int namelen);
 int raw_name2idx(int hashtype, int count, const char *name, int namelen);
 
 /* prng.c */
-void ll_generate_random_uuid(class_uuid_t uuid_out);
+#define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
 
 #endif /* __LINUX_OBD_CLASS_H */
index 8ff4248..dead71b 100644 (file)
@@ -128,7 +128,7 @@ void liblustre_init_random()
         if (_rand_dev_fd >= 0) {
                 if (syscall(SYS_read, _rand_dev_fd,
                             &seed, sizeof(seed)) == sizeof(seed)) {
-                        ll_srand(seed[0], seed[1]);
+                        cfs_srand(seed[0], seed[1]);
                         syscall(SYS_close, _rand_dev_fd);
                         return;
                 }
@@ -142,7 +142,7 @@ void liblustre_init_random()
         seed[0] = _my_pnid;
 #endif
         gettimeofday(&tv, NULL);
-        ll_srand(tv.tv_sec ^ __swab32(seed[0]), tv.tv_usec ^__swab32(getpid()));
+        cfs_srand(tv.tv_sec ^ __swab32(seed[0]), tv.tv_usec ^__swab32(getpid()));
 }
 
 static void init_capability(__u32 *res)
index 512d1e2..b395e2b 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/random.h>
 #include <linux/version.h>
 #include <linux/mm.h>
 
index ab34659..f90de1f 100644 (file)
@@ -45,7 +45,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/random.h>
 #include <linux/version.h>
 
 #include <lustre_lite.h>
index 1d11708..358b769 100644 (file)
@@ -38,7 +38,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/random.h>
 #include <linux/version.h>
 #include <lustre_lite.h>
 #include <lustre_ha.h>
@@ -162,7 +161,7 @@ static int __init init_lustre_lite(void)
 
         lustre_register_client_process_config(ll_process_config);
 
-        ll_get_random_bytes(seed, sizeof(seed));
+        cfs_get_random_bytes(seed, sizeof(seed));
 
         /* Nodes with small feet have little entropy
          * the NID for this node gives the most entropy in the low bits */
@@ -176,7 +175,7 @@ static int __init init_lustre_lite(void)
         }
 
         cfs_gettimeofday(&tv);
-        ll_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
         init_timer(&ll_capa_timer);
         ll_capa_timer.function = ll_capa_timer_callback;
index 2262c50..8c40022 100644 (file)
@@ -609,7 +609,7 @@ static int alloc_rr(struct lov_obd *lov, int *idx_arr, int *stripe_cnt,
                 GOTO(out, rc);
 
         if (--lqr->lqr_start_count <= 0) {
-                lqr->lqr_start_idx = ll_rand() % osts->op_count;
+                lqr->lqr_start_idx = cfs_rand() % osts->op_count;
                 lqr->lqr_start_count =
                         (LOV_CREATE_RESEED_MIN / max(osts->op_count, 1U) +
                          LOV_CREATE_RESEED_MULT) * max(osts->op_count, 1U);
@@ -880,23 +880,23 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
 
                 if (total_weight) {
 #if BITS_PER_LONG == 32
-                        rand = ll_rand() % (unsigned)total_weight;
+                        rand = cfs_rand() % (unsigned)total_weight;
                         /* If total_weight > 32-bit, first generate the high
                          * 32 bits of the random number, then add in the low
                          * 32 bits (truncated to the upper limit, if needed) */
                         if (total_weight > 0xffffffffULL)
-                                rand = (__u64)(ll_rand() %
+                                rand = (__u64)(cfs_rand() %
                                           (unsigned)(total_weight >> 32)) << 32;
                         else
                                 rand = 0;
 
                         if (rand == (total_weight & 0xffffffff00000000ULL))
-                                rand |= ll_rand() % (unsigned)total_weight;
+                                rand |= cfs_rand() % (unsigned)total_weight;
                         else
-                                rand |= ll_rand();
+                                rand |= cfs_rand();
 
 #else
-                        rand = ((__u64)ll_rand() << 32 | ll_rand()) %
+                        rand = ((__u64)cfs_rand() << 32 | cfs_rand()) %
                                 total_weight;
 #endif
                 } else {
index 5c5ea61..4321250 100644 (file)
@@ -2,7 +2,7 @@ MODULES := lvfs
 @SERVER_TRUE@MODULES += fsfilt_@BACKINGFS@
 @QUOTA_TRUE@MODULES += quotafmt_test
 
-lvfs-objs := lvfs_common.o lvfs_linux.o fsfilt.o upcall_cache.o prng.o lvfs_lib.o
+lvfs-objs := lvfs_common.o lvfs_linux.o fsfilt.o upcall_cache.o lvfs_lib.o
 
 @QUOTA_TRUE@quotafmt-objs := quotafmt_test.o
 
index 001fc7e..861a71b 100644 (file)
@@ -36,7 +36,7 @@
 
 if LIBLUSTRE
 noinst_LIBRARIES = liblvfs.a
-liblvfs_a_SOURCES = lvfs_userfs.c prng.c lvfs_lib.c
+liblvfs_a_SOURCES = lvfs_userfs.c lvfs_lib.c
 liblvfs_a_CFLAGS = $(LLCFLAGS)
 liblvfs_a_CPPFLAGS = $(LLCPPFLAGS)
 
index 9b0f367..9ec5e6f 100644 (file)
@@ -41,7 +41,6 @@
  */
 #ifdef __KERNEL__
 #include <linux/module.h>
-#include <linux/random.h>
 #else
 #include <liblustre.h>
 #endif
@@ -56,7 +55,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
                    size_t size, const char *file, int line)
 {
         if (ptr == NULL ||
-            (ll_rand() & OBD_ALLOC_FAIL_MASK) < obd_alloc_fail_rate) {
+            (cfs_rand() & OBD_ALLOC_FAIL_MASK) < obd_alloc_fail_rate) {
                 CERROR("%s%salloc of %s ("LPU64" bytes) failed at %s:%d\n",
                        ptr ? "force " :"", type, name, (__u64)size, file,
                        line);
@@ -87,7 +86,7 @@ int __obd_fail_check_set(__u32 id, __u32 value, int set)
 
         /* Fail 1/obd_fail_val times */
         if (obd_fail_loc & OBD_FAIL_RAND) {
-                if (obd_fail_val < 2 || ll_rand() % obd_fail_val > 0)
+                if (obd_fail_val < 2 || cfs_rand() % obd_fail_val > 0)
                         return 0;
         }
 
index 2fa315d..f9e3c95 100644 (file)
@@ -50,7 +50,6 @@
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
-#include <linux/random.h>
 
 #include <lustre_quota.h>
 #include <obd_class.h>
@@ -230,7 +229,7 @@ static struct lustre_dquot *get_rand_dquot(struct lustre_quota_info *lqi)
         if (dquot == NULL)
                 return NULL;
 
-        ll_get_random_bytes(&rand, sizeof(rand));
+        cfs_get_random_bytes(&rand, sizeof(rand));
         if (!rand)
                 rand = 1000;
 
index 7430bb6..d4c4dc4 100644 (file)
@@ -46,7 +46,6 @@
 #include <lustre_mds.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/random.h>
 #include <linux/fs.h>
 #include <linux/jbd.h>
 #include <linux/smp_lock.h>
index eba7427..af66fc1 100644 (file)
@@ -66,7 +66,7 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
 {
         struct mds_obd *mds = &exp->exp_obd->u.mds;
         struct inode *parent_inode = mds->mds_objects_dir->d_inode;
-        unsigned int tmpname = ll_rand();
+        unsigned int tmpname = cfs_rand();
         struct file *filp;
         struct dentry *new_child;
         struct lvfs_run_ctxt saved;
index 9ab150c..71e8434 100644 (file)
@@ -57,7 +57,7 @@ static void make_capa_key(struct lustre_capa_key *key,
 {
         key->lk_seq = mdsnum;
         key->lk_keyid = keyid + 1;
-        ll_get_random_bytes(key->lk_key, sizeof(key->lk_key));
+        cfs_get_random_bytes(key->lk_key, sizeof(key->lk_key));
 }
 
 static inline void lck_cpu_to_le(struct lustre_capa_key *tgt,
index 47eb2bf..18c2106 100644 (file)
@@ -419,7 +419,7 @@ static int mgc_requeue_thread(void *data)
                 /* Always wait a few seconds to allow the server who
                    caused the lock revocation to finish its setup, plus some
                    random so everyone doesn't try to reconnect at once. */
-                lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (ll_rand() & 0xff) * \
+                lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (cfs_rand() & 0xff) * \
                                       (CFS_HZ / 100),
                                       NULL, NULL);
                 l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi_now);
index 4dcda3b..d03f0bd 100644 (file)
@@ -726,7 +726,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         if (rc)
                 RETURN(rc);
 
-        llog_test_rand = ll_rand();
+        llog_test_rand = cfs_rand();
 
         rc = llog_run_tests(obd);
         if (rc)
index ec8e51d..9c91df3 100644 (file)
@@ -238,11 +238,11 @@ int class_handle_init(void)
         }
 
         /** bug 21430: add randomness to the initial base */
-        ll_get_random_bytes(seed, sizeof(seed));
+        cfs_get_random_bytes(seed, sizeof(seed));
         cfs_gettimeofday(&tv);
-        ll_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
-        ll_get_random_bytes(&handle_base, sizeof(handle_base));
+        cfs_get_random_bytes(&handle_base, sizeof(handle_base));
         LASSERT(handle_base != 0ULL);
 
         return 0;
index e5eda8e..d3f06ee 100644 (file)
@@ -39,7 +39,6 @@
 #ifdef __KERNEL__
 #include <linux/kmod.h>   /* for request_module() */
 #include <linux/module.h>
-#include <linux/random.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #else
index 883b311..9d548e0 100644 (file)
@@ -1308,7 +1308,7 @@ static int echo_create_object(struct echo_device *ed, int on_target,
                 if (lsm->lsm_stripe_size == 0)
                         lsm->lsm_stripe_size = CFS_PAGE_SIZE;
 
-                idx = ll_rand();
+                idx = cfs_rand();
 
                 /* setup stripes: indices + default ids if required */
                 for (i = 0; i < lsm->lsm_stripe_count; i++) {
index 2a6b90a..2999143 100644 (file)
@@ -2055,9 +2055,9 @@ static struct obd_capa *osd_capa_get(const struct lu_env *env,
                 __u32 d[4], s[4];
 
                 s[0] = obj->oo_inode->i_uid;
-                ll_get_random_bytes(&(s[1]), sizeof(__u32));
+                cfs_get_random_bytes(&(s[1]), sizeof(__u32));
                 s[2] = obj->oo_inode->i_gid;
-                ll_get_random_bytes(&(s[3]), sizeof(__u32));
+                cfs_get_random_bytes(&(s[3]), sizeof(__u32));
                 rc = capa_encrypt_id(d, s, key->lk_key, CAPA_HMAC_KEY_MAX_LEN);
                 if (unlikely(rc))
                         RETURN(ERR_PTR(rc));
index 3c94ed2..60d6206 100644 (file)
@@ -2727,7 +2727,7 @@ void ptlrpc_init_xid(void)
 
         cfs_spin_lock_init(&ptlrpc_last_xid_lock);
         if (now < YEAR_2004) {
-                ll_get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
+                cfs_get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
                 ptlrpc_last_xid >>= 2;
                 ptlrpc_last_xid |= (1ULL << 61);
         } else {
index 2f10dca..5e90010 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #include <linux/crypto.h>
 #else
index b7f4560..ed2f672 100644 (file)
@@ -49,7 +49,6 @@
 #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/mutex.h>
-#include <linux/random.h>
 #else
 #include <liblustre.h>
 #endif
index 181c739..1aa2f6f 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/crypto.h>
 #include <linux/key.h>
 #include <linux/keyctl.h>
index 9148f71..4b7900f 100644 (file)
@@ -57,7 +57,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/crypto.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #else
 #include <liblustre.h>
@@ -1248,7 +1247,7 @@ __u32 gss_wrap_kerberos(struct gss_ctx *gctx,
         fill_krb5_header(kctx, khdr, 1);
 
         /* generate confounder */
-        ll_get_random_bytes(conf, ke->ke_conf_size);
+        cfs_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 */
@@ -1418,7 +1417,7 @@ __u32 gss_wrap_bulk_kerberos(struct gss_ctx *gctx,
         fill_krb5_header(kctx, khdr, 1);
 
         /* generate confounder */
-        ll_get_random_bytes(conf, ke->ke_conf_size);
+        cfs_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 8611608..904435e 100644 (file)
@@ -56,7 +56,6 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #include <linux/crypto.h>
 #include <asm/atomic.h>
index 3c51715..aaa4c85 100644 (file)
@@ -1424,7 +1424,7 @@ int __init gss_init_svc_upcall(void)
          * sequence number checking, thus no chance to sent error notification
          * back to clients.
          */
-        ll_get_random_bytes(&__ctx_index, sizeof(__ctx_index));
+        cfs_get_random_bytes(&__ctx_index, sizeof(__ctx_index));
 
 
         cache_register(&rsi_cache);
index ff340f0..1ac37b2 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #else
 #include <liblustre.h>
index 2cd6dea..be2322c 100644 (file)
@@ -56,7 +56,6 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
-#include <linux/random.h>
 #include <linux/mutex.h>
 #include <asm/atomic.h>
 #else