25 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_OTHER 44 #define PROC_FT M0_CONF_PROCESS_TYPE.cot_ftype.ft_id 63 fprintf(stdout,
"\n");
66 fprintf(stderr,
"Invalid FOP opcode %.2d.\n",
opcode);
70 fprintf(stdout,
"\n");
81 const char *fop_input)
93 return M0_ERR_INFO(-EINVAL,
"opcode=%u, fop type not found",
97 return M0_ERR_INFO(-ENOMEM,
"opcode=%u, m0_fop_alloc() failed",
105 printf(
"Sending FOP: ");
116 return M0_ERR_INFO(-EINVAL,
"Sending message failed");
123 return M0_ERR_INFO(-EINVAL,
"rpc item receive failed");
129 return M0_ERR_INFO(-EINVAL,
"RPC item reply not received");
133 printf(
"Server replied with FOP: ");
143 " { -l FOP list | -f FOP opcode }" 144 " [-s server (e.g. 172.18.50.40@o2ib1:12345:34:1) ]" 145 " [-c client (e.g. 172.18.50.40@o2ib1:12345:34:*) ]" 151 " [-d fop_description (in xcode read grammar)] " 152 " [[-i] [-y yaml_file_path]]" 208 int console_main(
int argc,
char **argv)
210 int main(
int argc,
char **argv)
218 const char *server =
NULL;
219 const char *yaml_path =
NULL;
220 const char *fop_desc =
NULL;
227 .rcx_local_addr =
"0@lo:12345:34:*",
228 .rcx_remote_addr =
"0@lo:12345:34:1",
229 .rcx_max_rpcs_in_flight = 1,
286 if ((!input && yaml_path !=
NULL) ||
287 (input && yaml_path ==
NULL) ||
288 (fop_desc !=
NULL && yaml_path !=
NULL)) {
297 fprintf(stderr,
"YAML Init failed\n");
302 if (server ==
NULL) {
303 fprintf(stderr,
"Server assignment failed\n");
309 fprintf(stderr,
"Client assignment failed\n");
315 if (show &&
opcode == 0) {
345 fprintf(stderr,
"m0_rpc_client_start failed\n");
346 result = EX_SOFTWARE;
349 printf(
"connected\n");
362 fprintf(stderr,
"fop_send_and_print failed\n");
363 result = EX_SOFTWARE;
379 #undef M0_TRACE_SUBSYSTEM
#define M0_GETOPTS(progname, argc, argv,...)
#define M0_FLAGARG(ch, desc, ptr)
static struct m0_rpc_client_ctx cctx
static uint32_t max_rpc_msg_size
M0_INTERNAL int m0_xcode_read(struct m0_xcode_obj *obj, const char *str)
static void console_fini(void)
M0_INTERNAL int m0_cons_yaml_init(const char *file_path)
Inititalizes parser by opening given file. and also checks for error by getting root node...
int m0_init(struct m0 *instance)
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.
static struct m0_rpc_item * item
int main(int argc, char **argv)
The service to connect to is specified at the command line.
#define M0_STRINGARG(ch, desc, func)
struct m0_fop_type * f_type
#define M0_ERR_INFO(rc, fmt,...)
static int console_init(void)
static int tm_recv_queue_len
return M0_ERR(-EOPNOTSUPP)
#define M0_FID_TINIT(type, container, key)
M0_INTERNAL void m0_cons_yaml_fini(void)
Deletes the parser and closes the YAML file.
#define M0_FORMATARG(ch, desc, fmt, ptr)
void client(struct client_params *params)
uint32_t rcx_max_rpc_msg_size
static int fop_info_show(uint32_t opcode)
Iterate over FOP and print names of its members.
int m0_rpc_client_stop(struct m0_rpc_client_ctx *cctx)
struct m0_net_xprt * m0_net_xprt_default_get(void)
int m0_rpc_client_start(struct m0_rpc_client_ctx *cctx)
struct m0_rpc_item * ri_reply
uint32_t rcx_recv_queue_min_length
int m0_rpc_post_sync(struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops, m0_time_t deadline)
M0_INTERNAL void m0_fi_command_fop_init(void)
M0_INTERNAL int m0_cons_fop_show(struct m0_fop_type *fopt)
Iterate over FOP fields and print names.
M0_INTERNAL int m0_cons_fop_obj_output(struct m0_fop *fop)
Helper function for FOP output.
m0_time_t rcx_abs_timeout
struct m0_net_domain * rcx_net_dom
M0_INTERNAL struct m0_fop_type * m0_fop_type_find(uint32_t opcode)
M0_INTERNAL int m0_cons_fop_obj_input(struct m0_fop *fop)
Helper function for FOP input.
static const char * usage_msg
static struct m0_net_domain client_net_dom
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
struct m0_rpc_session rcx_session
m0_time_t m0_time_from_now(uint64_t secs, long ns)
const char * rcx_remote_addr
M0_INTERNAL void * m0_cons_yaml_get_value(const char *name)
Search for specified string and set the respctive value form YAML file. (like "name : console") ...
void m0_fop_put_lock(struct m0_fop *fop)
static struct m0_fop * fop
static struct m0 instance
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
struct m0t1fs_filedata * fd
M0_INTERNAL bool yaml_support
const char * rcx_local_addr
struct m0_rpc_machine rcx_rpc_machine
M0_INTERNAL void m0_cons_fop_list_show(void)
Helper function to print list of FOPs.
M0_INTERNAL void m0_cons_fop_name_print(const struct m0_fop_type *ftype)
M0_INTERNAL void m0_fi_command_fop_fini(void)
M0_INTERNAL int m0_console_fop_init(void)
#define M0_FOP_XCODE_OBJ(f)
M0_INTERNAL void m0_console_fop_fini(void)
struct m0_rpc_item f_item
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)