Motr  M0
client.h File Reference
#include "ut/ut.h"
#include "motr/client.h"
#include "layout/layout.h"
#include "motr/pg.h"
Include dependency graph for client.h:

Go to the source code of this file.

Macros

#define __MOTR_UT_H__
 
#define M0_DEFAULT_EP   "0@lo:12345:45:101"
 
#define M0_DEFAULT_HA_ADDR   "0@lo:12345:66:1"
 
#define M0_DEFAULT_PROFILE   "<0x7000000000000001:0>"
 
#define M0_DEFAULT_PROC_FID   "<0x7200000000000000:0>"
 
#define SET_DEFAULT_CONFIG()
 
#define INIT(instance)   do_init(instance)
 
#define M0T1FS_LAYOUT_P   4
 
#define M0T1FS_LAYOUT_N   2
 
#define M0T1FS_LAYOUT_K   1
 
#define M0T1FS_LAYOUT_S   1
 
#define DUMMY_PTR   0xdeafdead
 
#define UT_DEFAULT_BLOCK_SIZE   (1ULL << M0_DEFAULT_BUF_SHIFT)
 

Functions

static int do_init (struct m0_client **instance)
 
M0_INTERNAL int ut_init (void)
 
M0_INTERNAL int ut_fini (void)
 
M0_INTERNAL void ut_realm_entity_setup (struct m0_realm *realm, struct m0_entity *ent, struct m0_client *cinst)
 
M0_INTERNAL int ut_m0_client_init (struct m0_client **instance)
 
M0_INTERNAL void ut_m0_client_fini (struct m0_client **instance)
 
M0_INTERNAL void ut_shuffle_test_order (struct m0_ut_suite *suite)
 
void ut_layout_domain_fill (struct m0_client *cinst)
 
void ut_layout_domain_empty (struct m0_client *cinst)
 
M0_INTERNAL void ut_striped_layout_fini (struct m0_striped_layout *stl, struct m0_layout_domain *dom)
 
M0_INTERNAL void ut_striped_layout_init (struct m0_striped_layout *stl, struct m0_layout_domain *dom)
 
M0_INTERNAL struct m0_objut_dummy_obj_create (void)
 
M0_INTERNAL void ut_dummy_obj_delete (struct m0_obj *obj)
 
M0_INTERNAL struct m0_pdclust_layoutut_dummy_pdclust_layout_create (struct m0_client *instance)
 
M0_INTERNAL void ut_dummy_pdclust_layout_delete (struct m0_pdclust_layout *pl, struct m0_client *instance)
 
M0_INTERNAL struct m0_pdclust_instanceut_dummy_pdclust_instance_create (struct m0_pdclust_layout *pdl)
 
M0_INTERNAL void ut_dummy_pdclust_instance_delete (struct m0_pdclust_instance *pdi)
 
M0_INTERNAL void ut_dummy_xfer_req_init (struct nw_xfer_request *xfer)
 
M0_INTERNAL struct nw_xfer_requestut_dummy_xfer_req_create (void)
 
M0_INTERNAL void ut_dummy_xfer_req_fini (struct nw_xfer_request *xfer)
 
M0_INTERNAL void ut_dummy_xfer_req_delete (struct nw_xfer_request *xfer)
 
M0_INTERNAL struct data_bufut_dummy_data_buf_create (void)
 
M0_INTERNAL void ut_dummy_data_buf_delete (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_data_buf_init (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_data_buf_fini (struct data_buf *db)
 
M0_INTERNAL void ut_dummy_paritybufs_create (struct pargrp_iomap *map, bool do_alloc)
 
M0_INTERNAL void ut_dummy_paritybufs_delete (struct pargrp_iomap *map, bool do_free)
 
M0_INTERNAL struct pargrp_iomaput_dummy_pargrp_iomap_create (struct m0_client *instance, int num_blocks)
 
M0_INTERNAL void ut_dummy_pargrp_iomap_delete (struct pargrp_iomap *map, struct m0_client *instance)
 
M0_INTERNAL struct m0_op_iout_dummy_ioo_create (struct m0_client *instance, int num_io_maps)
 
M0_INTERNAL void ut_dummy_ioo_delete (struct m0_op_io *ioo, struct m0_client *instance)
 
M0_INTERNAL struct m0_pdclust_layoutut_get_pdclust_layout_from_ioo (struct m0_op_io *ioo)
 
void dummy_ioreq_fop_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL struct ioreq_foput_dummy_ioreq_fop_create (void)
 
M0_INTERNAL void ut_dummy_ioreq_fop_delete (struct ioreq_fop *fop)
 
M0_INTERNAL struct target_iorequt_dummy_target_ioreq_create (void)
 
M0_INTERNAL void ut_dummy_target_ioreq_delete (struct target_ioreq *ti)
 
M0_INTERNAL int ut_dummy_poolmach_create (struct m0_pool_version *pv)
 
M0_INTERNAL void ut_dummy_poolmach_delete (struct m0_pool_version *pv)
 
M0_INTERNAL void ut_set_device_state (struct m0_poolmach *pm, int dev, enum m0_pool_nd_state state)
 
M0_INTERNAL void ut_set_node_state (struct m0_poolmach *pm, int node, enum m0_pool_nd_state state)
 

Variables

struct m0_config default_config
 
struct m0_layout_enum ut_layout_enum
 
struct m0_layout_instance_ops ut_layout_instance_ops
 
const struct pargrp_iomap_ops mock_iomap_ops
 

Macro Definition Documentation

◆ __MOTR_UT_H__

#define __MOTR_UT_H__

Definition at line 25 of file client.h.

◆ DUMMY_PTR

#define DUMMY_PTR   0xdeafdead

Definition at line 66 of file client.h.

◆ INIT

#define INIT (   instance)    do_init(instance)

Definition at line 58 of file client.h.

◆ M0_DEFAULT_EP

#define M0_DEFAULT_EP   "0@lo:12345:45:101"

Definition at line 33 of file client.h.

◆ M0_DEFAULT_HA_ADDR

#define M0_DEFAULT_HA_ADDR   "0@lo:12345:66:1"

Definition at line 34 of file client.h.

◆ M0_DEFAULT_PROC_FID

#define M0_DEFAULT_PROC_FID   "<0x7200000000000000:0>"

Definition at line 36 of file client.h.

◆ M0_DEFAULT_PROFILE

#define M0_DEFAULT_PROFILE   "<0x7000000000000001:0>"

Definition at line 35 of file client.h.

◆ M0T1FS_LAYOUT_K

#define M0T1FS_LAYOUT_K   1

Definition at line 63 of file client.h.

◆ M0T1FS_LAYOUT_N

#define M0T1FS_LAYOUT_N   2

Definition at line 62 of file client.h.

◆ M0T1FS_LAYOUT_P

#define M0T1FS_LAYOUT_P   4

Definition at line 61 of file client.h.

◆ M0T1FS_LAYOUT_S

#define M0T1FS_LAYOUT_S   1

Definition at line 64 of file client.h.

◆ SET_DEFAULT_CONFIG

#define SET_DEFAULT_CONFIG ( )
Value:
do { \
struct m0_config *confp = &default_config; \
\
confp->mc_is_oostore = false; \
confp->mc_is_read_verify = false; \
confp->mc_layout_id = 1; \
confp->mc_local_addr = M0_DEFAULT_EP;\
confp->mc_ha_addr = M0_DEFAULT_HA_ADDR;\
confp->mc_profile = M0_DEFAULT_PROFILE; \
confp->mc_process_fid = M0_DEFAULT_PROC_FID; \
confp->mc_tm_recv_queue_min_len = M0_NET_TM_RECV_QUEUE_DEF_LEN;\
confp->mc_max_rpc_msg_size = M0_RPC_DEF_MAX_RPC_MSG_SIZE; \
} while(0);
#define M0_DEFAULT_EP
Definition: client.h:33
bool mc_is_oostore
Definition: client.h:920
#define M0_DEFAULT_PROC_FID
Definition: client.h:36
#define M0_DEFAULT_HA_ADDR
Definition: client.h:34
struct m0_config default_config
Definition: client.c:58
#define M0_DEFAULT_PROFILE
Definition: client.h:35

Definition at line 37 of file client.h.

◆ UT_DEFAULT_BLOCK_SIZE

#define UT_DEFAULT_BLOCK_SIZE   (1ULL << M0_DEFAULT_BUF_SHIFT)

Definition at line 67 of file client.h.

Function Documentation

◆ do_init()

static int do_init ( struct m0_client **  instance)
inlinestatic

Definition at line 52 of file client.h.

Here is the call graph for this function:

◆ dummy_ioreq_fop_cb()

void dummy_ioreq_fop_cb ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

Callback for a ioreq_fop. Executed when an rpc reply is received.

Definition at line 508 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_data_buf_create()

M0_INTERNAL struct data_buf* ut_dummy_data_buf_create ( void  )

Creates a UT dummy data_buf. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 200 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_data_buf_delete()

M0_INTERNAL void ut_dummy_data_buf_delete ( struct data_buf db)

Deletes a UT dummy data_buf. Call this function once for each dummy created.

Definition at line 209 of file io_dummy.c.

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

◆ ut_dummy_data_buf_fini()

M0_INTERNAL void ut_dummy_data_buf_fini ( struct data_buf db)

Finalises a UT dummy data_buf.

Definition at line 232 of file io_dummy.c.

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

◆ ut_dummy_data_buf_init()

M0_INTERNAL void ut_dummy_data_buf_init ( struct data_buf db)

Initialises a UT dummy data_buf.

Definition at line 215 of file io_dummy.c.

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

◆ ut_dummy_ioo_create()

M0_INTERNAL struct m0_op_io* ut_dummy_ioo_create ( struct m0_client instance,
int  num_io_maps 
)

Creates a UT dummy m0_op_io. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 366 of file io_dummy.c.

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

◆ ut_dummy_ioo_delete()

M0_INTERNAL void ut_dummy_ioo_delete ( struct m0_op_io ioo,
struct m0_client instance 
)

Deletes a UT dummy m0_op_io. Call this function once for each dummy created.

Definition at line 463 of file io_dummy.c.

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

◆ ut_dummy_ioreq_fop_create()

M0_INTERNAL struct ioreq_fop* ut_dummy_ioreq_fop_create ( void  )

Creates a UT dummy ioreq_fop. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 512 of file io_dummy.c.

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

◆ ut_dummy_ioreq_fop_delete()

M0_INTERNAL void ut_dummy_ioreq_fop_delete ( struct ioreq_fop fop)

Deletes a UT dummy ioreq_fop. Call this function once for each dummy created.

Definition at line 526 of file io_dummy.c.

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

◆ ut_dummy_obj_create()

M0_INTERNAL struct m0_obj* ut_dummy_obj_create ( void  )

Creates a UT dummy m0_obj. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 64 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_obj_delete()

M0_INTERNAL void ut_dummy_obj_delete ( struct m0_obj obj)

Deletes a UT dummy m0_obj. Call this function once for each dummy created.

Definition at line 73 of file io_dummy.c.

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

◆ ut_dummy_pargrp_iomap_create()

M0_INTERNAL struct pargrp_iomap* ut_dummy_pargrp_iomap_create ( struct m0_client instance,
int  num_blocks 
)

Allocate an iomap structure, to be freed by ut_dummy_pargrp_iomap_delete.

Parameters
instanceThe client instance to use.
num_blocksThe number of 4K blocks you will read/write with this map. This value must be <= M0T1FS_LAYOUT_N;
Returns
the allocated structure
Remarks
Need to set the pargrp_iomap's pi_ioo to point to a real ioo if invariant(pargrp_iomap) has to pass.

Definition at line 301 of file io_dummy.c.

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

◆ ut_dummy_pargrp_iomap_delete()

M0_INTERNAL void ut_dummy_pargrp_iomap_delete ( struct pargrp_iomap map,
struct m0_client instance 
)

Deletes a UT dummy pargrp_iomap. Call this function once for each dummy created.

Definition at line 340 of file io_dummy.c.

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

◆ ut_dummy_paritybufs_create()

M0_INTERNAL void ut_dummy_paritybufs_create ( struct pargrp_iomap map,
bool  do_alloc 
)

Definition at line 251 of file io_dummy.c.

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

◆ ut_dummy_paritybufs_delete()

M0_INTERNAL void ut_dummy_paritybufs_delete ( struct pargrp_iomap map,
bool  do_free 
)

Definition at line 281 of file io_dummy.c.

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

◆ ut_dummy_pdclust_instance_create()

M0_INTERNAL struct m0_pdclust_instance* ut_dummy_pdclust_instance_create ( struct m0_pdclust_layout pdl)

Creates a UT dummy m0_pdclust_instance. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 118 of file io_dummy.c.

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

◆ ut_dummy_pdclust_instance_delete()

M0_INTERNAL void ut_dummy_pdclust_instance_delete ( struct m0_pdclust_instance pdi)

Deletes a UT dummy m0_pdclust_instance. Call this function once for each dummy created.

Definition at line 158 of file io_dummy.c.

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

◆ ut_dummy_pdclust_layout_create()

M0_INTERNAL struct m0_pdclust_layout* ut_dummy_pdclust_layout_create ( struct m0_client instance)

Creates a UT dummy m0_pdclust_layout. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 79 of file io_dummy.c.

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

◆ ut_dummy_pdclust_layout_delete()

M0_INTERNAL void ut_dummy_pdclust_layout_delete ( struct m0_pdclust_layout pl,
struct m0_client instance 
)

Deletes a UT dummy pdclust_layout. Call this function once for each dummy created.

Definition at line 108 of file io_dummy.c.

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

◆ ut_dummy_poolmach_create()

M0_INTERNAL int ut_dummy_poolmach_create ( struct m0_pool_version pv)

Creates a UT dummy pool machine.

Definition at line 563 of file io_dummy.c.

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

◆ ut_dummy_poolmach_delete()

M0_INTERNAL void ut_dummy_poolmach_delete ( struct m0_pool_version pv)

Deletes a UT dummy pool machine.

Definition at line 628 of file io_dummy.c.

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

◆ ut_dummy_target_ioreq_create()

M0_INTERNAL struct target_ioreq* ut_dummy_target_ioreq_create ( void  )

Creates a UT dummy target_ioreq. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 532 of file io_dummy.c.

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

◆ ut_dummy_target_ioreq_delete()

M0_INTERNAL void ut_dummy_target_ioreq_delete ( struct target_ioreq ti)

Deletes a UT dummy target_ioreq. Call this function once for each dummy created.

Definition at line 552 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_create()

M0_INTERNAL struct nw_xfer_request* ut_dummy_xfer_req_create ( void  )

Creates a UT dummy nw_xfer_request. This allows passing some invariants() forced by the lower layers of Motr.

Definition at line 178 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_delete()

M0_INTERNAL void ut_dummy_xfer_req_delete ( struct nw_xfer_request xfer)

Deletes a UT dummy nw_xfer_request. Call this function once for each dummy created.

Definition at line 193 of file io_dummy.c.

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

◆ ut_dummy_xfer_req_fini()

M0_INTERNAL void ut_dummy_xfer_req_fini ( struct nw_xfer_request xfer)

Finalises a UT dummy nw_xfer_request.

Definition at line 187 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_dummy_xfer_req_init()

M0_INTERNAL void ut_dummy_xfer_req_init ( struct nw_xfer_request xfer)

Initialises a UT dummy nw_xfer_request.

Definition at line 171 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_fini()

M0_INTERNAL int ut_fini ( void  )

Finalises the client UT environment.

Definition at line 1257 of file client.c.

Here is the call graph for this function:

◆ ut_get_pdclust_layout_from_ioo()

M0_INTERNAL struct m0_pdclust_layout* ut_get_pdclust_layout_from_ioo ( struct m0_op_io ioo)

Returns the pdclust_layout of an ioo.

Definition at line 456 of file io_dummy.c.

Here is the caller graph for this function:

◆ ut_init()

M0_INTERNAL int ut_init ( void  )

Initialises the client UT environment.

Definition at line 1245 of file client.c.

Here is the call graph for this function:

◆ ut_layout_domain_empty()

void ut_layout_domain_empty ( struct m0_client cinst)

Empties a layout domain that has been filled via ut_layout_domain_fill().

Parameters
cinstclient instance.

Definition at line 218 of file obj.c.

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

◆ ut_layout_domain_fill()

void ut_layout_domain_fill ( struct m0_client cinst)

Fills the layout_domain of a m0_ instance, so it contains only a layout's id. This only guarantees m0_layout_find(M0_DEFAULT_LAYOUT_ID) returns something.

Parameters
layoutlayout to be added to the domain.
cinstclient instance.
Remarks
This might be seen as a workaround to reduce dependencies with other motr components.
cinst must have been successfully initialised at least until the IL_HA_STATE level.

Definition at line 208 of file obj.c.

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

◆ ut_m0_client_fini()

M0_INTERNAL void ut_m0_client_fini ( struct m0_client **  instance)

A version of m0_client_fini for use in unit tests. This will finalise whatever was done in ut_m0_client_init.

Parameters
instanceA pointer to where the instance should be stored.

Definition at line 354 of file client.c.

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

◆ ut_m0_client_init()

M0_INTERNAL int ut_m0_client_init ( struct m0_client **  instance)

A version of m0_client_init for use in unit tests. This will initialise client as far as we can in this environment.

Parameters
instanceA pointer to where the instance should be stored.
Returns
The value of m0_client_init.

Definition at line 265 of file client.c.

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

◆ ut_realm_entity_setup()

M0_INTERNAL void ut_realm_entity_setup ( struct m0_realm realm,
struct m0_entity ent,
struct m0_client cinst 
)

Fake setup for a realm and entity.

Definition at line 60 of file client.c.

Here is the call graph for this function:

◆ ut_set_device_state()

M0_INTERNAL void ut_set_device_state ( struct m0_poolmach pm,
int  dev,
enum m0_pool_nd_state  state 
)

Definition at line 1006 of file io_pargrp.c.

Here is the caller graph for this function:

◆ ut_set_node_state()

M0_INTERNAL void ut_set_node_state ( struct m0_poolmach pm,
int  node,
enum m0_pool_nd_state  state 
)

Definition at line 1012 of file io_pargrp.c.

Here is the caller graph for this function:

◆ ut_shuffle_test_order()

M0_INTERNAL void ut_shuffle_test_order ( struct m0_ut_suite suite)

A trick to force the UTs to run in random order every time. This allows the tester to discover hidden dependencies among tests (bonus score!).

Definition at line 1205 of file client.c.

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

◆ ut_striped_layout_fini()

M0_INTERNAL void ut_striped_layout_fini ( struct m0_striped_layout stl,
struct m0_layout_domain dom 
)

Definition at line 202 of file obj.c.

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

◆ ut_striped_layout_init()

M0_INTERNAL void ut_striped_layout_init ( struct m0_striped_layout stl,
struct m0_layout_domain dom 
)

Definition at line 180 of file obj.c.

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

Variable Documentation

◆ default_config

struct m0_config default_config

Definition at line 58 of file client.c.

◆ mock_iomap_ops

const struct pargrp_iomap_ops mock_iomap_ops

Definition at line 670 of file io_dummy.c.

◆ ut_layout_enum

struct m0_layout_enum ut_layout_enum

Definition at line 92 of file obj.c.

◆ ut_layout_instance_ops

struct m0_layout_instance_ops ut_layout_instance_ops

Definition at line 106 of file obj.c.