-unsigned int __thread rand_lookup;
-unsigned long __thread nr_add;
-unsigned long __thread nr_addexist;
-unsigned long __thread nr_del;
-unsigned long __thread nr_delnoent;
-unsigned long __thread lookup_fail;
-unsigned long __thread lookup_ok;
+enum test_hash {
+ TEST_HASH_RW,
+ TEST_HASH_UNIQUE,
+};
+
+struct test_hash_cb {
+ void (*sigusr1)(int signo);
+ void (*sigusr2)(int signo);
+ void *(*thr_reader)(void *_count);
+ void *(*thr_writer)(void *_count);
+ int (*populate_hash)(void);
+};
+
+static
+struct test_hash_cb test_hash_cb[] = {
+ [TEST_HASH_RW] = {
+ test_hash_rw_sigusr1_handler,
+ test_hash_rw_sigusr2_handler,
+ test_hash_rw_thr_reader,
+ test_hash_rw_thr_writer,
+ test_hash_rw_populate_hash,
+ },
+ [TEST_HASH_UNIQUE] = {
+ test_hash_unique_sigusr1_handler,
+ test_hash_unique_sigusr2_handler,
+ test_hash_unique_thr_reader,
+ test_hash_unique_thr_writer,
+ test_hash_unique_populate_hash,
+ },
+
+};
+
+static enum test_hash test_choice = TEST_HASH_RW;
+
+void (*get_sigusr1_cb(void))(int)
+{
+ return test_hash_cb[test_choice].sigusr1;
+}
+
+void (*get_sigusr2_cb(void))(int)
+{
+ return test_hash_cb[test_choice].sigusr2;
+}
+
+void *(*get_thr_reader_cb(void))(void *)
+{
+ return test_hash_cb[test_choice].thr_reader;
+}
+
+void *(*get_thr_writer_cb(void))(void *)
+{
+ return test_hash_cb[test_choice].thr_writer;
+}
+
+int (*get_populate_hash_cb(void))(void)
+{
+ return test_hash_cb[test_choice].populate_hash;
+}
+
+DEFINE_URCU_TLS(unsigned int, rand_lookup);
+DEFINE_URCU_TLS(unsigned long, nr_add);
+DEFINE_URCU_TLS(unsigned long, nr_addexist);
+DEFINE_URCU_TLS(unsigned long, nr_del);
+DEFINE_URCU_TLS(unsigned long, nr_delnoent);
+DEFINE_URCU_TLS(unsigned long, lookup_fail);
+DEFINE_URCU_TLS(unsigned long, lookup_ok);