Motr  M0
service.c File Reference
#include "ut/ut.h"
#include "lib/arith.h"
#include "lib/misc.h"
#include "lib/errno.h"
#include "net/test/service.h"
Include dependency graph for service.c:

Go to the source code of this file.

Enumerations

enum  { SERVICE_ITERATIONS_NR = 0x1000 }
 

Functions

static int service_ut_cmd (void *ctx, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply, enum m0_net_test_cmd_type cmd_type)
 
static int service_ut_cmd_init (void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
 
static int service_ut_cmd_start (void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
 
static int service_ut_cmd_stop (void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
 
static int service_ut_cmd_status (void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
 
static void * service_ut_init (struct m0_net_test_service *svc_)
 
static void service_ut_fini (void *ctx)
 
static int service_ut_step (void *ctx)
 
static void service_ut_checks (struct m0_net_test_service *svc, enum m0_net_test_service_state state)
 
static void service_ut_check_reset (void)
 
static void service_ut_check_called (int *func_bool)
 
static bool service_can_handle (enum m0_net_test_cmd_type cmd_type)
 
void m0_net_test_service_ut (void)
 

Variables

static struct m0_net_test_service svc
 
static struct m0_net_test_cmd service_cmd
 
static struct m0_net_test_cmd service_reply
 
static int service_init_called
 
static int service_fini_called
 
static int service_step_called
 
static int service_cmd_called [M0_NET_TEST_CMD_NR]
 
static int service_cmd_errno
 
static int * service_func_called []
 
static struct m0_net_test_service_cmd_handler service_ut_cmd_handler []
 
static struct m0_net_test_service_ops service_ut_ops
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SERVICE_ITERATIONS_NR 

Definition at line 30 of file service.c.

Function Documentation

◆ m0_net_test_service_ut()

void m0_net_test_service_ut ( void  )

Definition at line 183 of file service.c.

Here is the call graph for this function:

◆ service_can_handle()

static bool service_can_handle ( enum m0_net_test_cmd_type  cmd_type)
static

Definition at line 172 of file service.c.

Here is the caller graph for this function:

◆ service_ut_check_called()

static void service_ut_check_called ( int *  func_bool)
static

Definition at line 153 of file service.c.

Here is the caller graph for this function:

◆ service_ut_check_reset()

static void service_ut_check_reset ( void  )
static

Definition at line 145 of file service.c.

Here is the caller graph for this function:

◆ service_ut_checks()

static void service_ut_checks ( struct m0_net_test_service svc,
enum m0_net_test_service_state  state 
)
static

Definition at line 133 of file service.c.

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

◆ service_ut_cmd()

static int service_ut_cmd ( void *  ctx,
const struct m0_net_test_cmd cmd,
struct m0_net_test_cmd reply,
enum m0_net_test_cmd_type  cmd_type 
)
static

Definition at line 49 of file service.c.

Here is the caller graph for this function:

◆ service_ut_cmd_init()

static int service_ut_cmd_init ( void *  ctx_,
const struct m0_net_test_cmd cmd,
struct m0_net_test_cmd reply 
)
static

Definition at line 60 of file service.c.

Here is the call graph for this function:

◆ service_ut_cmd_start()

static int service_ut_cmd_start ( void *  ctx_,
const struct m0_net_test_cmd cmd,
struct m0_net_test_cmd reply 
)
static

Definition at line 67 of file service.c.

Here is the call graph for this function:

◆ service_ut_cmd_status()

static int service_ut_cmd_status ( void *  ctx_,
const struct m0_net_test_cmd cmd,
struct m0_net_test_cmd reply 
)
static

Definition at line 81 of file service.c.

Here is the call graph for this function:

◆ service_ut_cmd_stop()

static int service_ut_cmd_stop ( void *  ctx_,
const struct m0_net_test_cmd cmd,
struct m0_net_test_cmd reply 
)
static

Definition at line 74 of file service.c.

Here is the call graph for this function:

◆ service_ut_fini()

static void service_ut_fini ( void *  ctx)
static

Definition at line 95 of file service.c.

◆ service_ut_init()

static void* service_ut_init ( struct m0_net_test_service svc_)
static

Definition at line 88 of file service.c.

◆ service_ut_step()

static int service_ut_step ( void *  ctx)
static

Definition at line 100 of file service.c.

Variable Documentation

◆ service_cmd

struct m0_net_test_cmd service_cmd
static

Definition at line 35 of file service.c.

◆ service_cmd_called

int service_cmd_called[M0_NET_TEST_CMD_NR]
static

Definition at line 40 of file service.c.

◆ service_cmd_errno

int service_cmd_errno
static

Definition at line 41 of file service.c.

◆ service_fini_called

int service_fini_called
static

Definition at line 38 of file service.c.

◆ service_func_called

int* service_func_called[]
static
Initial value:
= {
}
static int service_step_called
Definition: service.c:39
static int service_fini_called
Definition: service.c:38
static int service_init_called
Definition: service.c:37

Definition at line 43 of file service.c.

◆ service_init_called

int service_init_called
static

Definition at line 37 of file service.c.

◆ service_reply

struct m0_net_test_cmd service_reply
static

Definition at line 36 of file service.c.

◆ service_step_called

int service_step_called
static

Definition at line 39 of file service.c.

◆ service_ut_cmd_handler

struct m0_net_test_service_cmd_handler service_ut_cmd_handler[]
static
Initial value:
= {
{
.ntsch_type = M0_NET_TEST_CMD_INIT,
.ntsch_handler = service_ut_cmd_init,
},
{
.ntsch_type = M0_NET_TEST_CMD_START,
.ntsch_handler = service_ut_cmd_start,
},
{
.ntsch_type = M0_NET_TEST_CMD_STOP,
.ntsch_handler = service_ut_cmd_stop,
},
{
.ntsch_type = M0_NET_TEST_CMD_STATUS,
.ntsch_handler = service_ut_cmd_status,
},
}
static int service_ut_cmd_status(void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
Definition: service.c:81
static int service_ut_cmd_start(void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
Definition: service.c:67
static int service_ut_cmd_init(void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
Definition: service.c:60
static int service_ut_cmd_stop(void *ctx_, const struct m0_net_test_cmd *cmd, struct m0_net_test_cmd *reply)
Definition: service.c:74

Definition at line 106 of file service.c.

◆ service_ut_ops

struct m0_net_test_service_ops service_ut_ops
static
Initial value:
= {
.ntso_init = service_ut_init,
.ntso_fini = service_ut_fini,
.ntso_step = service_ut_step,
.ntso_cmd_handler = service_ut_cmd_handler,
.ntso_cmd_handler_nr = ARRAY_SIZE(service_ut_cmd_handler),
}
static void * service_ut_init(struct m0_net_test_service *svc_)
Definition: service.c:88
static void service_ut_fini(void *ctx)
Definition: service.c:95
static int service_ut_step(void *ctx)
Definition: service.c:100
static struct m0_net_test_service_cmd_handler service_ut_cmd_handler[]
Definition: service.c:106
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 125 of file service.c.

◆ svc

struct m0_net_test_service svc
static

Definition at line 34 of file service.c.