X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fselftest%2Fselftest.h;h=50383505bb76a0530a9f68755d927434ce4895ba;hb=e0d3582ad65aaefb5c3fa912f681b1eeb65ddc99;hp=b759e6a1ebbf74e7e40995926267aa15b88e8172;hpb=6f9526798b250a13885ab49e3a3827019afbda05;p=fs%2Flustre-release.git diff --git a/lnet/selftest/selftest.h b/lnet/selftest/selftest.h index b759e6a..5038350 100644 --- a/lnet/selftest/selftest.h +++ b/lnet/selftest/selftest.h @@ -10,16 +10,39 @@ #define LNET_ONLY +#ifndef __KERNEL__ + +/* XXX workaround XXX */ +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +/* TODO: remove these when libcfs provides proper primitives for userspace + * + * Dummy implementations of spinlock_t and atomic_t work since userspace + * selftest is completely single-threaded, even using multi-threaded usocklnd. + */ +typedef struct { } spinlock_t; +static inline void spin_lock(spinlock_t *l) {return;} +static inline void spin_unlock(spinlock_t *l) {return;} +static inline void spin_lock_init(spinlock_t *l) {return;} + +typedef struct { volatile int counter; } atomic_t; +#define atomic_read(a) ((a)->counter) +#define atomic_set(a,b) do {(a)->counter = b; } while (0) +#define atomic_dec_and_test(a) ((--((a)->counter)) == 0) +#define atomic_inc(a) (((a)->counter)++) +#define atomic_dec(a) do { (a)->counter--; } while (0) + +#endif + #include #include #include +#include #include #include -#ifndef __KERNEL__ -#include /* userland spinlock_t and atomic_t */ -#endif - #include "rpc.h" #include "timer.h" @@ -316,6 +339,7 @@ typedef struct { struct list_head sn_batches; /* list of batches */ char sn_name[LST_NAME_SIZE]; atomic_t sn_brw_errors; + atomic_t sn_ping_errors; } sfw_session_t; #define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \ @@ -347,10 +371,10 @@ typedef struct sfw_test_instance { sfw_test_client_ops_t *tsi_ops; /* test client operations */ /* public parameter for all test units */ - int tsi_is_client:1; /* is test client */ - int tsi_stop_onerr:1; /* stop on error */ - int tsi_concur; /* concurrency */ - int tsi_loop; /* loop count */ + int tsi_is_client:1; /* is test client */ + int tsi_stoptsu_onerr:1; /* stop tsu on error */ + int tsi_concur; /* concurrency */ + int tsi_loop; /* loop count */ /* status of test instance */ spinlock_t tsi_lock; /* serialize */ @@ -377,7 +401,6 @@ typedef struct sfw_test_unit { struct list_head tsu_list; /* chain on lst_test_instance */ lnet_process_id_t tsu_dest; /* id of dest node */ int tsu_loop; /* loop count of the test */ - int tsu_error; /* error code */ sfw_test_instance_t *tsu_instance; /* pointer to test instance */ void *tsu_private; /* private data */ swi_workitem_t tsu_worker; /* workitem of the test unit */ @@ -517,7 +540,6 @@ swi_state2str (int state) int stt_poll_interval(void); int sfw_session_removed(void); -void sfw_set_session_timeout(int timeout); int stt_check_events(void); int swi_check_events(void);