Motr  M0
lut_main.c File Reference
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "lib/uuid.h"
#include "motr/init.h"
#include "module/instance.h"
#include "lib/arith.h"
#include "lib/errno.h"
#include "lib/memory.h"
#include "net/lnet/lnet_core_types.h"
#include "net/lnet/lnet_ioctl.h"
#include "net/lnet/ut/lnet_drv_ut.h"
Include dependency graph for lut_main.c:

Go to the source code of this file.

Macros

#define LUT_PO2_SHIFT(n)
 
#define LUT_ALLOC_PTR(ptr)
 
#define LUT_FREE_PTR(ptr)   lut_mem_free((ptr), sizeof ((ptr)[0]), LUT_PO2_SHIFT(sizeof ((ptr)[0])))
 
#define UT_LNET_INVALID
 

Enumerations

enum  { MAX_PROC_TRIES = 120, PROC_DELAY_SEC = 2, FAIL_UID_GID = 99, UT_TM_UPVT = 0xdeadbeaf }
 

Functions

static void * lut_mem_alloc (size_t size, unsigned shift)
 
static void lut_mem_free (void *data, size_t size, unsigned shift)
 
int test_dev_exists (void)
 
int test_open_close (void)
 
int test_read_write (void)
 
int test_invalid_ioctls (void)
 
int test_dom_init (void)
 
int test_tms (bool force_cleanup)
 
int test_duptm (void)
 
int main (int argc, char *argv[])
 

Variables

const char lnet_xprt_dev [] = "/dev/" M0_LNET_DEV
 
const char lnet_ut_proc [] = "/proc/" UT_PROC_NAME
 

Macro Definition Documentation

◆ LUT_ALLOC_PTR

#define LUT_ALLOC_PTR (   ptr)
Value:
((ptr) = lut_mem_alloc(sizeof ((ptr)[0]), \
LUT_PO2_SHIFT(sizeof ((ptr)[0]))))
static void ptr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:440
static void * lut_mem_alloc(size_t size, unsigned shift)
Definition: lut_main.c:66

Definition at line 60 of file lut_main.c.

◆ LUT_FREE_PTR

#define LUT_FREE_PTR (   ptr)    lut_mem_free((ptr), sizeof ((ptr)[0]), LUT_PO2_SHIFT(sizeof ((ptr)[0])))

Definition at line 63 of file lut_main.c.

◆ LUT_PO2_SHIFT

#define LUT_PO2_SHIFT (   n)
Value:
(((n) <= 8) ? 3 : ((n) <= 16) ? 4 : ((n) <= 32) ? 5 : \
((n) <= 64) ? 6 : ((n) <= 128) ? 7 : ((n) <= 256) ? 8 : \
((n) <= 512) ? 9 : ((n) / 0))
uint64_t n
Definition: fops.h:107

Round up a number n to the next power of 2, min 1<<3, works for n <= 1<<9. If n is a power of 2, returns n. Requires a constant input, allowing compile-time computation.

Definition at line 56 of file lut_main.c.

◆ UT_LNET_INVALID

#define UT_LNET_INVALID
Value:
#define M0_LNET_IOC_MAX_NR
Definition: lnet_ioctl.h:168
#define M0_LNET_IOC_MAGIC
Definition: lnet_ioctl.h:166

Definition at line 146 of file lut_main.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_PROC_TRIES 
PROC_DELAY_SEC 
FAIL_UID_GID 
UT_TM_UPVT 

Definition at line 44 of file lut_main.c.

Function Documentation

◆ lut_mem_alloc()

static void* lut_mem_alloc ( size_t  size,
unsigned  shift 
)
static

Definition at line 66 of file lut_main.c.

Here is the call graph for this function:

◆ lut_mem_free()

static void lut_mem_free ( void *  data,
size_t  size,
unsigned  shift 
)
static

Definition at line 71 of file lut_main.c.

Here is the call graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 332 of file lut_main.c.

Here is the call graph for this function:

◆ test_dev_exists()

int test_dev_exists ( void  )

Definition at line 76 of file lut_main.c.

Here is the caller graph for this function:

◆ test_dom_init()

int test_dom_init ( void  )

Definition at line 184 of file lut_main.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_duptm()

int test_duptm ( void  )

Definition at line 278 of file lut_main.c.

Here is the caller graph for this function:

◆ test_invalid_ioctls()

int test_invalid_ioctls ( void  )

Definition at line 150 of file lut_main.c.

Here is the caller graph for this function:

◆ test_open_close()

int test_open_close ( void  )

Definition at line 92 of file lut_main.c.

Here is the caller graph for this function:

◆ test_read_write()

int test_read_write ( void  )

Definition at line 123 of file lut_main.c.

Here is the caller graph for this function:

◆ test_tms()

int test_tms ( bool  force_cleanup)

Definition at line 218 of file lut_main.c.

Here is the caller graph for this function:

Variable Documentation

◆ lnet_ut_proc

const char lnet_ut_proc[] = "/proc/" UT_PROC_NAME

Definition at line 42 of file lut_main.c.

◆ lnet_xprt_dev

const char lnet_xprt_dev[] = "/dev/" M0_LNET_DEV

Definition at line 41 of file lut_main.c.