]>
git.proxmox.com Git - mirror_iproute2.git/blob - rdma/rdma.c
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Leon Romanovsky <leonro@mellanox.com>
15 static void help(char *name
)
17 pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
18 "where OBJECT := { dev | help }\n"
19 " OPTIONS := { -V[ersion] | -d[etails]}\n", name
);
22 static int cmd_help(struct rd
*rd
)
28 static int rd_cmd(struct rd
*rd
)
30 const struct rd_cmd cmds
[] = {
37 return rd_exec_cmd(rd
, cmds
, "object");
40 static int rd_init(struct rd
*rd
, int argc
, char **argv
, char *filename
)
45 rd
->filename
= filename
;
48 INIT_LIST_HEAD(&rd
->dev_map_list
);
49 rd
->buff
= malloc(MNL_SOCKET_BUFFER_SIZE
);
53 rd_prepare_msg(rd
, RDMA_NLDEV_CMD_GET
,
54 &seq
, (NLM_F_REQUEST
| NLM_F_ACK
| NLM_F_DUMP
));
55 ret
= rd_send_msg(rd
);
59 return rd_recv_msg(rd
, rd_dev_init_cb
, rd
, seq
);
62 static void rd_free(struct rd
*rd
)
68 int main(int argc
, char **argv
)
70 static const struct option long_options
[] = {
71 { "version", no_argument
, NULL
, 'V' },
72 { "help", no_argument
, NULL
, 'h' },
73 { "details", no_argument
, NULL
, 'd' },
76 bool show_details
= false;
82 filename
= basename(argv
[0]);
84 while ((opt
= getopt_long(argc
, argv
, "Vhd",
85 long_options
, NULL
)) >= 0) {
88 printf("%s utility, iproute2-ss%s\n",
98 pr_err("Unknown option.\n");
107 err
= rd_init(&rd
, argc
, argv
, filename
);
111 rd
.show_details
= show_details
;
116 return err
? EXIT_FAILURE
: EXIT_SUCCESS
;