- remove local random function, use lib/random.c random32()
PATCH 1/1 - remove local random function, use lib/random.c random32()
reducing the number of random number functions
Signed-off-by Joe Perches <[email protected]>
fs/xfs/support/debug.c +0 -17
@@ -78,20 +78,3 @@ assfail(char *expr, char *file, int line)printk ("Assertion failed: %s, file: %s, line: %d\n" , expr, file, line);BUG (); } - -#if ((defined(DEBUG ) || defined(INDUCE_IO_ERRROR )) && !defined(NO_WANT_RANDOM )) -unsigned long random (void ) -{ -static unsigned long RandomValue =1 ; -/* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */ - registerlong rv = RandomValue; - registerlong lo; - registerlong hi; - - hi = rv /127773 ; - lo = rv %127773 ; - rv =16807 * lo -2836 * hi; -if (rv <=0 ) rv +=2147483647 ; -return RandomValue = rv; -} -#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
fs/xfs/support/debug.h +1 -1
@@ -40,7 +40,7 @@ extern void assfail(char *expr, char *f, int l);# define ASSERT (expr) ((void)0)#else # define ASSERT (expr) ASSERT_ALWAYS(expr) -extern unsigned long random (void ); +# include <linux/random.h> #endif #ifndef STATIC
fs/xfs/xfs_alloc.c +1 -1
@@ -764,7 +764,7 @@ xfs_alloc_ag_vextent_near(*/ int dofirst;/* set to do first algorithm */ - dofirst =random () &1 ; + dofirst =random32 () &1 ;#endif /* * Get a cursor for the by-size btree.
fs/xfs/xfs_error.c +1 -1
@@ -80,7 +80,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,int i;int64_t fsid; -if (random () % randfactor) +if (random32 () % randfactor)return 0 ;memcpy (&fsid, fsidp,sizeof (xfs_fsid_t));