23 #include <sys/ioctl.h> 56 #define LUT_PO2_SHIFT(n) \ 57 (((n) <= 8) ? 3 : ((n) <= 16) ? 4 : ((n) <= 32) ? 5 : \ 58 ((n) <= 64) ? 6 : ((n) <= 128) ? 7 : ((n) <= 256) ? 8 : \ 59 ((n) <= 512) ? 9 : ((n) / 0)) 60 #define LUT_ALLOC_PTR(ptr) \ 61 ((ptr) = lut_mem_alloc(sizeof ((ptr)[0]), \ 62 LUT_PO2_SHIFT(sizeof ((ptr)[0])))) 63 #define LUT_FREE_PTR(ptr) \ 64 lut_mem_free((ptr), sizeof ((ptr)[0]), LUT_PO2_SHIFT(sizeof ((ptr)[0]))) 82 if (!S_ISCHR(st.st_mode))
86 if ((st.st_mode & S_IRWXO) != 0)
137 if (
rc >= 0 || errno != EINVAL)
140 if (
rc >= 0 || errno != EINVAL)
143 return failed ? 1 : 0;
146 #define UT_LNET_INVALID \ 147 _IOWR(M0_LNET_IOC_MAGIC, (M0_LNET_IOC_MAX_NR + 1), \ 148 struct m0_lnet_dev_dom_init_params) 167 if (
rc >= 0 || errno != ENOTTY)
172 if (
rc >= 0 || errno != EFAULT)
177 if (
rc >= 0 || errno != EFAULT)
181 return failed ? 1 : 0;
204 if (
p.ddi_max_buffer_size < 2 ||
206 p.ddi_max_buffer_segment_size < 2 ||
208 p.ddi_max_buffer_segments < 2 ||
318 if (
rc == 0 || errno != EBADR) {
332 int main(
int argc,
char *argv[])
357 "%s: kernel UT did not create %s after %d sec\n",
365 rc = write(procf, cmd, 1);
368 off = lseek(procf, off, SEEK_SET);
371 rc = read(procf, cmd, 1);
373 fprintf(stderr,
"%s: failed to read from procfs lnet UT" 374 " file '%s', rc = %d\n",
375 __FILE__, strerror(errno),
rc);
406 printf(
"**** UNKNOWN TEST %d\n", (
int) *cmd);
410 rc = write(procf, cmd, 1);
static struct m0_addb2_philter p
M0_INTERNAL int struct dentry struct kstat * stat
static bool m0_is_po2(uint64_t val)
M0_INTERNAL void m0_free_aligned(void *data, size_t size, unsigned shift)
int test_read_write(void)
#define LUT_FREE_PTR(ptr)
int m0_init(struct m0 *instance)
m0_time_t m0_time(uint64_t secs, long ns)
int test_invalid_ioctls(void)
int main(int argc, char *argv[])
static void lut_mem_free(void *data, size_t size, unsigned shift)
#define LUT_ALLOC_PTR(ptr)
int test_dev_exists(void)
struct nlx_core_transfer_mc * dts_ctm
static struct m0_stob_domain * dom
const char lnet_ut_proc[]
static void * lut_mem_alloc(size_t size, unsigned shift)
int test_tms(bool force_cleanup)
int test_open_close(void)
static struct m0 instance
void m0_kmod_uuid_file_set(const char *path)
struct nlx_core_domain * ddi_cd
const char lnet_xprt_dev[]
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
int m0_nanosleep(const m0_time_t req, m0_time_t *rem)