|
static int | fop_info_show (uint32_t opcode) |
| Iterate over FOP and print names of its members. More...
|
|
static int | fop_send_and_print (struct m0_rpc_client_ctx *cctx, uint32_t opcode, const char *fop_input) |
| Build the RPC item using FOP (Embedded into item) and send it. More...
|
|
static void | usage (void) |
|
static int | console_init (void) |
|
static void | console_fini (void) |
|
int | main (int argc, char **argv) |
| The service to connect to is specified at the command line. More...
|
|
static int | console_fom_create (struct m0_fop *fop, struct m0_reqh *reqh, const struct m0_fom_ops *fom_ops, struct m0_fom **m) |
|
static size_t | console_fom_home_locality (const struct m0_fom *fom) |
|
static void | console_fom_fini (struct m0_fom *fom) |
|
static int | console_device_fom_create (struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh) |
|
static int | console_fom_tick (struct m0_fom *fom) |
|
static int | console_test_fom_create (struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh) |
|
M0_INTERNAL void | m0_console_fop_fini (void) |
|
M0_INTERNAL int | m0_console_fop_init (void) |
|
static void | sig_handler (int num) |
|
static int | cons_init (void) |
|
static int | cons_fini (void) |
|
static void | file_redirect_init (void) |
|
static void | file_redirect_fini (void) |
|
static int | generate_yaml_file (const char *name) |
|
static void | check_values (struct m0_fop *fop) |
|
static void | yaml_basic_test (void) |
|
static void | input_test (void) |
|
static void | file_compare (const char *in, const char *out) |
|
static void | output_test (void) |
|
static void | yaml_file_test (void) |
|
static void | yaml_parser_test (void) |
|
static void | yaml_root_get_test (void) |
|
static void | yaml_get_value_test (void) |
|
static int | device_yaml_file (const char *name) |
|
static void | cons_client_init (struct m0_rpc_client_ctx *cctx) |
|
static void | cons_client_fini (struct m0_rpc_client_ctx *cctx) |
|
static void | cons_server_init (struct m0_rpc_server_ctx *sctx) |
|
static void | cons_server_fini (struct m0_rpc_server_ctx *sctx) |
|
static void | conn_basic_test (void) |
|
static void | success_client (int dummy) |
|
static void | conn_success_test (void) |
|
static void | mesg_send_client (int dummy) |
|
static void | mesg_send_test (void) |
|
static int | console_cmd (char **params) |
|
static void | console_input_test (void) |
|
Build a standalone utility that
- connects to a specified service.
- constructs a fop of a specified fop type and with specified values of fields and sends it to the service.
- waits fop reply.
- outputs fop reply to the user.
The console utility can send a DEVICE_FAILURE fop to a server. Server-side processing for fops of this type consists of calling a single stub function. Real implementation will be supplied by the middleware.cm-setup task.
◆ ALIST
#define ALIST |
( |
|
... | ) |
((char *[]){ __VA_ARGS__, NULL}) |
◆ CLIENT_ENDPOINT_ADDR
#define CLIENT_ENDPOINT_ADDR "0@lo:12345:34:2" |
◆ ENDPOINT
◆ NAME
#define NAME |
( |
|
ext | ) |
"console_st_srv" ext |
◆ SERVER_ADDB_STOB_FILE_NAME
#define SERVER_ADDB_STOB_FILE_NAME "linuxstob:cons_server_addb_stob" |
◆ SERVER_DB_FILE_NAME
#define SERVER_DB_FILE_NAME "cons_server_db" |
◆ SERVER_ENDPOINT
◆ SERVER_ENDPOINT_ADDR
#define SERVER_ENDPOINT_ADDR "0@lo:12345:34:1" |
◆ SERVER_LOG_FILE_NAME
#define SERVER_LOG_FILE_NAME "cons_server.log" |
◆ SERVER_STOB_FILE_NAME
#define SERVER_STOB_FILE_NAME "cons_server_stob" |
◆ anonymous enum
Enumerator |
---|
COB_DOM_CLIENT_ID | |
COB_DOM_SERVER_ID | |
Definition at line 38 of file console.c.
◆ anonymous enum
Enumerator |
---|
CLIENT_COB_DOM_ID | |
MAX_RPCS_IN_FLIGHT | |
MAX_RETRIES | |
Definition at line 64 of file console.c.
◆ check_values()
static void check_values |
( |
struct m0_fop * |
fop | ) |
|
|
static |
◆ conn_basic_test()
static void conn_basic_test |
( |
void |
| ) |
|
|
static |
◆ conn_success_test()
static void conn_success_test |
( |
void |
| ) |
|
|
static |
◆ cons_client_fini()
◆ cons_client_init()
◆ cons_fini()
static int cons_fini |
( |
void |
| ) |
|
|
static |
◆ cons_init()
static int cons_init |
( |
void |
| ) |
|
|
static |
◆ cons_server_fini()
◆ cons_server_init()
◆ console_cmd()
static int console_cmd |
( |
char ** |
params | ) |
|
|
static |
◆ console_device_fom_create()
static int console_device_fom_create |
( |
struct m0_fop * |
fop, |
|
|
struct m0_fom ** |
m, |
|
|
struct m0_reqh * |
reqh |
|
) |
| |
|
static |
◆ console_fini()
static void console_fini |
( |
void |
| ) |
|
|
static |
◆ console_fom_create()
NOTE: Though service type is NOT set in the FOP_TYPE_INIT for console fops, we are setting it in the console UT, where the client thread creates the fop. So the assertion in m0_fom_init should pass
Definition at line 40 of file console_fom.c.
◆ console_fom_fini()
static void console_fom_fini |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ console_fom_home_locality()
static size_t console_fom_home_locality |
( |
const struct m0_fom * |
fom | ) |
|
|
static |
◆ console_fom_tick()
static int console_fom_tick |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ console_init()
static int console_init |
( |
void |
| ) |
|
|
static |
◆ console_input_test()
static void console_input_test |
( |
void |
| ) |
|
|
static |
◆ console_test_fom_create()
static int console_test_fom_create |
( |
struct m0_fop * |
fop, |
|
|
struct m0_fom ** |
m, |
|
|
struct m0_reqh * |
reqh |
|
) |
| |
|
static |
◆ device_yaml_file()
static int device_yaml_file |
( |
const char * |
name | ) |
|
|
static |
◆ file_compare()
static void file_compare |
( |
const char * |
in, |
|
|
const char * |
out |
|
) |
| |
|
static |
◆ file_redirect_fini()
static void file_redirect_fini |
( |
void |
| ) |
|
|
static |
◆ file_redirect_init()
static void file_redirect_init |
( |
void |
| ) |
|
|
static |
◆ fop_info_show()
static int fop_info_show |
( |
uint32_t |
opcode | ) |
|
|
static |
Iterate over FOP and print names of its members.
- Parameters
-
Definition at line 59 of file console.c.
◆ fop_send_and_print()
static int fop_send_and_print |
( |
struct m0_rpc_client_ctx * |
cctx, |
|
|
uint32_t |
opcode, |
|
|
const char * |
fop_input |
|
) |
| |
|
static |
Build the RPC item using FOP (Embedded into item) and send it.
- Parameters
-
cctx | RPC Client context |
opcode | RPC item opcode |
Definition at line 80 of file console.c.
◆ generate_yaml_file()
static int generate_yaml_file |
( |
const char * |
name | ) |
|
|
static |
◆ input_test()
static void input_test |
( |
void |
| ) |
|
|
static |
◆ m0_console_fop_fini()
M0_INTERNAL void m0_console_fop_fini |
( |
void |
| ) |
|
◆ m0_console_fop_init()
M0_INTERNAL int m0_console_fop_init |
( |
void |
| ) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
The service to connect to is specified at the command line.
Test server for m0console.
The fop type to be sent is specified at the command line.
The values of fop fields are specified interactively. The program locates the fop type format (m0_fop_type_format) corresponding to the specified fop type and iterates over fop fields, prompting the user for the field values.
The program supports RECORD, SEQUENCE and UNION aggregation types, as well as all atomic types (U32, U64, BYTE and VOID).
- Returns
- 0 success, -errno failure.
Definition at line 210 of file console.c.
◆ mesg_send_client()
static void mesg_send_client |
( |
int |
dummy | ) |
|
|
static |
◆ mesg_send_test()
static void mesg_send_test |
( |
void |
| ) |
|
|
static |
◆ output_test()
static void output_test |
( |
void |
| ) |
|
|
static |
◆ sig_handler()
static void sig_handler |
( |
int |
num | ) |
|
|
static |
◆ success_client()
static void success_client |
( |
int |
dummy | ) |
|
|
static |
◆ usage()
static void usage |
( |
void |
| ) |
|
|
static |
◆ yaml_basic_test()
static void yaml_basic_test |
( |
void |
| ) |
|
|
static |
◆ yaml_file_test()
static void yaml_file_test |
( |
void |
| ) |
|
|
static |
◆ yaml_get_value_test()
static void yaml_get_value_test |
( |
void |
| ) |
|
|
static |
◆ yaml_parser_test()
static void yaml_parser_test |
( |
void |
| ) |
|
|
static |
◆ yaml_root_get_test()
static void yaml_root_get_test |
( |
void |
| ) |
|
|
static |
◆ cctx
Initial value:= {
}
#define SERVER_ENDPOINT_ADDR
static struct m0_net_domain client_net_dom
#define CLIENT_ENDPOINT_ADDR
struct m0_fid g_process_fid
Definition at line 72 of file console.c.
◆ client_net_dom
◆ cons_mach
◆ console_ut
Initial value:= {
.ts_name = "libconsole-ut",
.ts_tests = {
}
}
static int cons_init(void)
static void yaml_root_get_test(void)
static void input_test(void)
static void conn_basic_test(void)
static void mesg_send_test(void)
static void yaml_parser_test(void)
static void console_input_test(void)
static int cons_fini(void)
static void conn_success_test(void)
static void yaml_basic_test(void)
static void yaml_file_test(void)
static void output_test(void)
static void yaml_get_value_test(void)
Definition at line 628 of file console.c.
◆ err_file
const char* err_file = "/tmp/stderr" |
|
static |
◆ err_redir
◆ in_file
const char* in_file = "/tmp/stdin" |
|
static |
◆ in_redir
◆ m0_cons_fom_device_type_ops
◆ m0_cons_fop_device_fopt
◆ m0_cons_fop_reply_fopt
◆ m0_cons_fop_test_fopt
◆ m0_console_fom_device_ops
Initial value:= {
}
static size_t console_fom_home_locality(const struct m0_fom *fom)
static void console_fom_fini(struct m0_fom *fom)
static int console_fom_tick(struct m0_fom *fom)
Definition at line 141 of file console_fom.c.
◆ m0_console_fom_test_ops
Initial value:= {
}
static size_t console_fom_home_locality(const struct m0_fom *fom)
static void console_fom_fini(struct m0_fom *fom)
static int console_fom_tick(struct m0_fom *fom)
Definition at line 162 of file console_fom.c.
◆ m0_console_fom_type_device_ops
Initial value:= {
}
static int console_device_fom_create(struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh)
Definition at line 147 of file console_fom.c.
◆ m0_console_fom_type_test_ops
Initial value:= {
}
static int console_test_fom_create(struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh)
Definition at line 168 of file console_fom.c.
◆ m0_console_verbose [1/2]
◆ m0_console_verbose [2/2]
◆ m0_rpc_service_type
◆ out_file
const char* out_file = "/tmp/stdout" |
|
static |
◆ out_redir
◆ sctx
◆ server_argv
Initial value:= {
}
#define SERVER_ADDB_STOB_FILE_NAME
#define SERVER_ENDPOINT_ADDR
#define SERVER_DB_FILE_NAME
#define M0_UT_CONF_PROCESS
#define SERVER_STOB_FILE_NAME
Definition at line 80 of file console.c.
◆ signaled
◆ timeout
◆ usage_msg
Initial value:= "Usage: m0console "
" { -l FOP list | -f FOP opcode }"
" [-s server (e.g. 172.18.50.40@o2ib1:12345:34:1) ]"
" [-c client (e.g. 172.18.50.40@o2ib1:12345:34:*) ]"
" [-t timeout]"
" [-d fop_description (in xcode read grammar)] "
" "
" [-h] [-v]"
Definition at line 142 of file console.c.
◆ yaml_file
const char* yaml_file = "/tmp/console_ut.yaml" |
|
static |