From 46bfd4e5170ec950c1eb2e27c2ae67fa9b84ee12 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 8 Oct 2018 13:36:43 -0600 Subject: [PATCH] Remove old OS dependent (unused) random code Signed-off-by: Jens Axboe --- os/os-aix.h | 1 - os/os-android.h | 17 ----------------- os/os-dragonfly.h | 1 - os/os-freebsd.h | 1 - os/os-hpux.h | 1 - os/os-linux.h | 15 --------------- os/os-mac.h | 1 - os/os-netbsd.h | 1 - os/os-openbsd.h | 1 - os/os-solaris.h | 16 ---------------- os/os-windows.h | 1 - os/os.h | 17 ----------------- 12 files changed, 73 deletions(-) diff --git a/os/os-aix.h b/os/os-aix.h index e204d6f2..1aab96e0 100644 --- a/os/os-aix.h +++ b/os/os-aix.h @@ -11,7 +11,6 @@ #include "../file.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define OS_MAP_ANON MAP_ANON diff --git a/os/os-android.h b/os/os-android.h index 1483275e..3c050776 100644 --- a/os/os-android.h +++ b/os/os-android.h @@ -201,23 +201,6 @@ static inline unsigned long long os_phys_mem(void) return (unsigned long long) pages * (unsigned long long) pagesize; } -typedef struct { unsigned short r[3]; } os_random_state_t; - -static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) -{ - rs->r[0] = seed & 0xffff; - seed >>= 16; - rs->r[1] = seed & 0xffff; - seed >>= 16; - rs->r[2] = seed & 0xffff; - seed48(rs->r); -} - -static inline long os_random_long(os_random_state_t *rs) -{ - return nrand48(rs->r); -} - #ifdef O_NOATIME #define FIO_O_NOATIME O_NOATIME #else diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h index e80ad8cd..eb92521f 100644 --- a/os/os-dragonfly.h +++ b/os/os-dragonfly.h @@ -25,7 +25,6 @@ #include "../lib/types.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_FS_STAT #define FIO_HAVE_TRIM diff --git a/os/os-freebsd.h b/os/os-freebsd.h index 97bc8ae5..789da178 100644 --- a/os/os-freebsd.h +++ b/os/os-freebsd.h @@ -16,7 +16,6 @@ #include "../file.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_CHARDEV_SIZE #define FIO_HAVE_FS_STAT diff --git a/os/os-hpux.h b/os/os-hpux.h index 515a5256..c1dafe42 100644 --- a/os/os-hpux.h +++ b/os/os-hpux.h @@ -20,7 +20,6 @@ #include "../file.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_CHARDEV_SIZE diff --git a/os/os-linux.h b/os/os-linux.h index 6b63d123..ba58bf7d 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -60,8 +60,6 @@ typedef cpu_set_t os_cpu_mask_t; -typedef struct drand48_data os_random_state_t; - #ifdef CONFIG_3ARG_AFFINITY #define fio_setaffinity(pid, cpumask) \ sched_setaffinity((pid), sizeof(cpumask), &(cpumask)) @@ -170,19 +168,6 @@ static inline unsigned long long os_phys_mem(void) return (unsigned long long) pages * (unsigned long long) pagesize; } -static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) -{ - srand48_r(seed, rs); -} - -static inline long os_random_long(os_random_state_t *rs) -{ - long val; - - lrand48_r(rs, &val); - return val; -} - static inline int fio_lookup_raw(dev_t dev, int *majdev, int *mindev) { struct raw_config_request rq; diff --git a/os/os-mac.h b/os/os-mac.h index 92a60ee9..0b9c8707 100644 --- a/os/os-mac.h +++ b/os/os-mac.h @@ -16,7 +16,6 @@ #include "../file.h" -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_GETTID #define FIO_HAVE_CHARDEV_SIZE diff --git a/os/os-netbsd.h b/os/os-netbsd.h index 682a11c9..c06261d4 100644 --- a/os/os-netbsd.h +++ b/os/os-netbsd.h @@ -21,7 +21,6 @@ #include "../file.h" #define FIO_HAVE_ODIRECT -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID diff --git a/os/os-openbsd.h b/os/os-openbsd.h index b4c02c9b..70f58b49 100644 --- a/os/os-openbsd.h +++ b/os/os-openbsd.h @@ -20,7 +20,6 @@ #include "../file.h" -#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID diff --git a/os/os-solaris.h b/os/os-solaris.h index 2425ab9e..1a411af6 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -47,7 +47,6 @@ struct solaris_rand_seed { #define FIO_OS_HAS_CTIME_R typedef psetid_t os_cpu_mask_t; -typedef struct solaris_rand_seed os_random_state_t; static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) { @@ -92,21 +91,6 @@ static inline unsigned long long get_fs_free_size(const char *path) return ret; } -static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) -{ - rs->r[0] = seed & 0xffff; - seed >>= 16; - rs->r[1] = seed & 0xffff; - seed >>= 16; - rs->r[2] = seed & 0xffff; - seed48(rs->r); -} - -static inline long os_random_long(os_random_state_t *rs) -{ - return nrand48(rs->r); -} - #define FIO_OS_DIRECTIO extern int directio(int, int); static inline int fio_set_odirect(struct fio_file *f) diff --git a/os/os-windows.h b/os/os-windows.h index aad446e7..ef955dc3 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -35,7 +35,6 @@ int rand_r(unsigned *); #define FIO_HAVE_CPU_AFFINITY #define FIO_HAVE_CHARDEV_SIZE #define FIO_HAVE_GETTID -#define FIO_USE_GENERIC_RAND #define FIO_PREFERRED_ENGINE "windowsaio" #define FIO_PREFERRED_CLOCK_SOURCE CS_CGETTIME diff --git a/os/os.h b/os/os.h index becc4103..0b182c4a 100644 --- a/os/os.h +++ b/os/os.h @@ -298,23 +298,6 @@ static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) } #endif -#ifdef FIO_USE_GENERIC_RAND -typedef unsigned int os_random_state_t; - -static inline void os_random_seed(unsigned long seed, os_random_state_t *rs) -{ - srand(seed); -} - -static inline long os_random_long(os_random_state_t *rs) -{ - long val; - - val = rand_r(rs); - return val; -} -#endif - #ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE static inline int init_random_seeds(unsigned long *rand_seeds, int size) { -- 2.25.1