return -EINVAL;
}
- if (!(nlh = msg_init(buf, TIPC_NL_LINK_GET))) {
+ nlh = msg_init(buf, TIPC_NL_LINK_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
if (parse_opts(opts, cmdl) < 0)
return -EINVAL;
- if (!(nlh = msg_init(buf, TIPC_NL_LINK_GET))) {
+ nlh = msg_init(buf, TIPC_NL_LINK_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
- if (!(opt = get_opt(opts, "link"))) {
+ opt = get_opt(opts, "link");
+ if (!opt) {
fprintf(stderr, "error, missing link\n");
return -EINVAL;
}
return -EINVAL;
}
- if (!(nlh = msg_init(buf, TIPC_NL_LINK_RESET_STATS))) {
+ nlh = msg_init(buf, TIPC_NL_LINK_RESET_STATS);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
- if (!(opt = get_opt(opts, "link"))) {
+ opt = get_opt(opts, "link");
+ if (!opt) {
fprintf(stderr, "error, missing link\n");
return -EINVAL;
}
mnl_attr_get_u32(stats[TIPC_NLA_STATS_MSG_LEN_CNT]),
mnl_attr_get_u32(stats[TIPC_NLA_STATS_MSG_LEN_TOT]) / proft);
- printf(" 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
- "-16384:%u%% -32768:%u%% -66000:%u%%\n",
+ printf(" 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% -16384:%u%% -32768:%u%% -66000:%u%%\n",
perc(mnl_attr_get_u32(stats[TIPC_NLA_STATS_MSG_LEN_P0]), proft),
perc(mnl_attr_get_u32(stats[TIPC_NLA_STATS_MSG_LEN_P1]), proft),
perc(mnl_attr_get_u32(stats[TIPC_NLA_STATS_MSG_LEN_P2]), proft),
return -EINVAL;
}
- if (!(nlh = msg_init(buf, TIPC_NL_LINK_GET))) {
+ nlh = msg_init(buf, TIPC_NL_LINK_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
if (parse_opts(opts, cmdl) < 0)
return -EINVAL;
- if ((opt = get_opt(opts, "link")))
+ opt = get_opt(opts, "link");
+ if (opt)
link = opt->val;
return msg_dumpit(nlh, link_stat_show_cb, link);
if (parse_opts(opts, cmdl) < 0)
return -EINVAL;
- if (!(nlh = msg_init(buf, TIPC_NL_LINK_SET))) {
+ nlh = msg_init(buf, TIPC_NL_LINK_SET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
attrs = mnl_attr_nest_start(nlh, TIPC_NLA_LINK);
- if (!(opt = get_opt(opts, "link"))) {
+ opt = get_opt(opts, "link");
+ if (!opt) {
fprintf(stderr, "error, missing link\n");
return -EINVAL;
}
}
size = atoi(shift_cmdl(cmdl));
- if (!(nlh = msg_init(buf, TIPC_NL_MON_SET))) {
+ nlh = msg_init(buf, TIPC_NL_MON_SET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
return -EINVAL;
}
- if (!(nlh = msg_init(buf, TIPC_NL_MON_GET))) {
+ nlh = msg_init(buf, TIPC_NL_MON_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
}
/* print the applied members, since we know the the members
- * are listed in ascending order, we print only the state */
+ * are listed in ascending order, we print only the state
+ */
static void link_mon_print_applied(uint16_t applied, uint64_t up_map)
{
int i;
}
/* print the non applied members, since we dont know
- * the members, we print them along with the state */
+ * the members, we print them along with the state
+ */
static void link_mon_print_non_applied(uint16_t applied, uint16_t member_cnt,
uint64_t up_map, uint32_t *members)
{
char buf[MNL_SOCKET_BUFFER_SIZE];
struct nlattr *nest;
- if (!(nlh = msg_init(buf, TIPC_NL_MON_PEER_GET))) {
+ nlh = msg_init(buf, TIPC_NL_MON_PEER_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {};
char *req_bearer = data;
const char *bname;
- const char *title = "node status monitored generation "
- "applied_node_status [non_applied_node:status]";
+ const char title[] =
+ "node status monitored generation applied_node_status [non_applied_node:status]";
mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
if (!info[TIPC_NLA_MON])
static void cmd_link_mon_list_help(struct cmdl *cmdl)
{
- fprintf(stderr, "Usage: %s monitor list [ media MEDIA ARGS...] \n\n",
+ fprintf(stderr, "Usage: %s monitor list [ media MEDIA ARGS...]\n\n",
cmdl->argv[0]);
print_bearer_media();
}
static void cmd_link_mon_list_udp_help(struct cmdl *cmdl, char *media)
{
fprintf(stderr,
- "Usage: %s monitor list media udp name NAME \n\n",
+ "Usage: %s monitor list media udp name NAME\n\n",
cmdl->argv[0]);
}
return -EINVAL;
if (get_opt(opts, "media")) {
- if ((err = cmd_get_unique_bearer_name(cmd, cmdl, opts, bname,
- sup_media)))
+ err = cmd_get_unique_bearer_name(cmd, cmdl, opts, bname,
+ sup_media);
+ if (err)
return err;
}
return -EINVAL;
}
- if (!(nlh = msg_init(buf, TIPC_NL_MON_GET))) {
+ nlh = msg_init(buf, TIPC_NL_MON_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}
static void cmd_link_mon_get_help(struct cmdl *cmdl)
{
- fprintf(stderr, "Usage: %s monitor get PPROPERTY \n\n"
+ fprintf(stderr, "Usage: %s monitor get PPROPERTY\n\n"
"PROPERTIES\n"
- " threshold - Get monitor activation threshold\n",
+ " threshold - Get monitor activation threshold\n",
cmdl->argv[0]);
}
{
char buf[MNL_SOCKET_BUFFER_SIZE];
- if (!(nlh = msg_init(buf, TIPC_NL_MON_GET))) {
+ nlh = msg_init(buf, TIPC_NL_MON_GET);
+ if (!nlh) {
fprintf(stderr, "error, message initialisation failed\n");
return -1;
}