Lines Matching refs:rd
22 static int cmd_help(struct rd *rd) in cmd_help() argument
24 help(rd->filename); in cmd_help()
28 static int rd_cmd(struct rd *rd) in rd_cmd() argument
38 return rd_exec_cmd(rd, cmds, "object"); in rd_cmd()
41 static int rd_init(struct rd *rd, int argc, char **argv, char *filename) in rd_init() argument
46 rd->filename = filename; in rd_init()
47 rd->argc = argc; in rd_init()
48 rd->argv = argv; in rd_init()
49 INIT_LIST_HEAD(&rd->dev_map_list); in rd_init()
51 if (rd->json_output) { in rd_init()
52 rd->jw = jsonw_new(stdout); in rd_init()
53 if (!rd->jw) { in rd_init()
57 jsonw_pretty(rd->jw, rd->pretty_output); in rd_init()
60 rd->buff = malloc(MNL_SOCKET_BUFFER_SIZE); in rd_init()
61 if (!rd->buff) in rd_init()
64 rd_prepare_msg(rd, RDMA_NLDEV_CMD_GET, in rd_init()
66 ret = rd_send_msg(rd); in rd_init()
70 return rd_recv_msg(rd, rd_dev_init_cb, rd, seq); in rd_init()
73 static void rd_free(struct rd *rd) in rd_free() argument
75 if (rd->json_output) in rd_free()
76 jsonw_destroy(&rd->jw); in rd_free()
77 free(rd->buff); in rd_free()
78 rd_free_devmap(rd); in rd_free()
95 struct rd rd; in main() local
130 rd.show_details = show_details; in main()
131 rd.json_output = json_output; in main()
132 rd.pretty_output = pretty_output; in main()
134 err = rd_init(&rd, argc, argv, filename); in main()
138 err = rd_cmd(&rd); in main()
141 rd_free(&rd); in main()