[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240102164538.7527-1-stephen@networkplumber.org>
Date: Tue, 2 Jan 2024 08:45:24 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] rdma: shorten print_ lines
With the shorter form of print_ function some of the lines can
now be shortened. Max line length in iproute2 should be 100 characters
or less.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
rdma/dev.c | 6 ++----
rdma/link.c | 16 ++++++----------
rdma/res-cq.c | 3 +--
rdma/res-qp.c | 9 +++------
rdma/res-srq.c | 3 +--
rdma/res.c | 11 ++++-------
rdma/stat.c | 20 +++++++-------------
rdma/sys.c | 10 +++-------
rdma/utils.c | 15 +++++----------
9 files changed, 32 insertions(+), 61 deletions(-)
diff --git a/rdma/dev.c b/rdma/dev.c
index e3483482c823..7496162df9e2 100644
--- a/rdma/dev.c
+++ b/rdma/dev.c
@@ -144,8 +144,7 @@ static void dev_print_sys_image_guid(struct rd *rd, struct nlattr **tb)
sys_image_guid = mnl_attr_get_u64(tb[RDMA_NLDEV_ATTR_SYS_IMAGE_GUID]);
memcpy(vp, &sys_image_guid, sizeof(uint64_t));
snprintf(str, 32, "%04x:%04x:%04x:%04x", vp[3], vp[2], vp[1], vp[0]);
- print_string(PRINT_ANY, "sys_image_guid",
- "sys_image_guid %s ", str);
+ print_string(PRINT_ANY, "sys_image_guid", "sys_image_guid %s ", str);
}
static void dev_print_dim_setting(struct rd *rd, struct nlattr **tb)
@@ -185,8 +184,7 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb)
node_type = mnl_attr_get_u8(tb[RDMA_NLDEV_ATTR_DEV_NODE_TYPE]);
node_str = node_type_to_str(node_type);
- print_string(PRINT_ANY, "node_type", "node_type %s ",
- node_str);
+ print_string(PRINT_ANY, "node_type", "node_type %s ", node_str);
}
static void dev_print_dev_proto(struct rd *rd, struct nlattr **tb)
diff --git a/rdma/link.c b/rdma/link.c
index 913186cbfd73..48f7b0877468 100644
--- a/rdma/link.c
+++ b/rdma/link.c
@@ -120,8 +120,7 @@ static void link_print_subnet_prefix(struct rd *rd, struct nlattr **tb)
subnet_prefix = mnl_attr_get_u64(tb[RDMA_NLDEV_ATTR_SUBNET_PREFIX]);
memcpy(vp, &subnet_prefix, sizeof(uint64_t));
snprintf(str, 32, "%04x:%04x:%04x:%04x", vp[3], vp[2], vp[1], vp[0]);
- print_string(PRINT_ANY, "subnet_prefix",
- "subnet_prefix %s ", str);
+ print_string(PRINT_ANY, "subnet_prefix", "subnet_prefix %s ", str);
}
static void link_print_lid(struct rd *rd, struct nlattr **tb)
@@ -176,8 +175,7 @@ static void link_print_state(struct rd *rd, struct nlattr **tb)
return;
state = mnl_attr_get_u8(tb[RDMA_NLDEV_ATTR_PORT_STATE]);
- print_string(PRINT_ANY, "state", "state %s ",
- link_state_to_str(state));
+ print_string(PRINT_ANY, "state", "state %s ", link_state_to_str(state));
}
static const char *phys_state_to_str(uint8_t phys_state)
@@ -202,8 +200,8 @@ static void link_print_phys_state(struct rd *rd, struct nlattr **tb)
return;
phys_state = mnl_attr_get_u8(tb[RDMA_NLDEV_ATTR_PORT_PHYS_STATE]);
- print_string(PRINT_ANY, "physical_state",
- "physical_state %s ", phys_state_to_str(phys_state));
+ print_string(PRINT_ANY, "physical_state", "physical_state %s ",
+ phys_state_to_str(phys_state));
}
static void link_print_netdev(struct rd *rd, struct nlattr **tb)
@@ -216,10 +214,8 @@ static void link_print_netdev(struct rd *rd, struct nlattr **tb)
netdev_name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_NDEV_NAME]);
idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_NDEV_INDEX]);
- print_string(PRINT_ANY, "netdev", "netdev %s ",
- netdev_name);
- print_uint(PRINT_ANY, "netdev_index",
- rd->show_details ? "netdev_index %u " : "", idx);
+ print_string(PRINT_ANY, "netdev", "netdev %s ", netdev_name);
+ print_uint(PRINT_ANY, "netdev_index", rd->show_details ? "netdev_index %u " : "", idx);
}
static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index 9656773ffe6e..b4dcc026ed4b 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -21,8 +21,7 @@ static void print_poll_ctx(struct rd *rd, uint8_t poll_ctx, struct nlattr *attr)
{
if (!attr)
return;
- print_string(PRINT_ANY, "poll-ctx", "poll-ctx %s ",
- poll_ctx_to_str(poll_ctx));
+ print_string(PRINT_ANY, "poll-ctx", "poll-ctx %s ", poll_ctx_to_str(poll_ctx));
}
static void print_cq_dim_setting(struct rd *rd, struct nlattr *attr)
diff --git a/rdma/res-qp.c b/rdma/res-qp.c
index ef062c764c06..2390c0b5732b 100644
--- a/rdma/res-qp.c
+++ b/rdma/res-qp.c
@@ -37,14 +37,12 @@ static void print_rqpn(struct rd *rd, uint32_t val, struct nlattr **nla_line)
static void print_type(struct rd *rd, uint32_t val)
{
- print_string(PRINT_ANY, "type", "type %s ",
- qp_types_to_str(val));
+ print_string(PRINT_ANY, "type", "type %s ", qp_types_to_str(val));
}
static void print_state(struct rd *rd, uint32_t val)
{
- print_string(PRINT_ANY, "state", "state %s ",
- qp_states_to_str(val));
+ print_string(PRINT_ANY, "state", "state %s ", qp_states_to_str(val));
}
static void print_rqpsn(struct rd *rd, uint32_t val, struct nlattr **nla_line)
@@ -60,8 +58,7 @@ static void print_pathmig(struct rd *rd, uint32_t val, struct nlattr **nla_line)
if (!nla_line[RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE])
return;
- print_string(PRINT_ANY, "path-mig-state",
- "path-mig-state %s ", path_mig_to_str(val));
+ print_string(PRINT_ANY, "path-mig-state", "path-mig-state %s ", path_mig_to_str(val));
}
static int res_qp_line_raw(struct rd *rd, const char *name, int idx,
diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 714abb96711a..e702fecd1f34 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -22,8 +22,7 @@ static const char *srq_types_to_str(uint8_t idx)
static void print_type(struct rd *rd, uint32_t val)
{
- print_string(PRINT_ANY, "type", "type %s ",
- srq_types_to_str(val));
+ print_string(PRINT_ANY, "type", "type %s ", srq_types_to_str(val));
}
static void print_qps(char *qp_str)
diff --git a/rdma/res.c b/rdma/res.c
index b0efcd95f4fe..715cf93c4fab 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -51,9 +51,8 @@ static int res_print_summary(struct rd *rd, struct nlattr **tb)
name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
- res_print_u64(
- rd, name, curr,
- nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
+ res_print_u64(rd, name, curr,
+ nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
}
return 0;
}
@@ -189,14 +188,12 @@ void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
}
if (!rd->json_output)
- print_string(PRINT_ANY, NULL, "link %s ",
- tmp);
+ print_string(PRINT_ANY, NULL, "link %s ", tmp);
}
void print_qp_type(struct rd *rd, uint32_t val)
{
- print_string(PRINT_ANY, "qp-type", "qp-type %s ",
- qp_types_to_str(val));
+ print_string(PRINT_ANY, "qp-type", "qp-type %s ", qp_types_to_str(val));
}
void print_key(struct rd *rd, const char *name, uint64_t val,
diff --git a/rdma/stat.c b/rdma/stat.c
index 53d829e9ccf8..28b1ad857219 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -304,8 +304,7 @@ static int res_counter_line(struct rd *rd, const char *name, int index,
qpn = mnl_attr_get_u32(qp_line[RDMA_NLDEV_ATTR_RES_LQPN]);
if (!isfirst)
- print_string(PRINT_FP, NULL, ",",
- NULL);
+ print_string(PRINT_FP, NULL, ",", NULL);
print_uint(PRINT_ANY, NULL, "%d", qpn);
isfirst = false;
}
@@ -790,28 +789,23 @@ static int do_stat_mode_parse_cb(const struct nlmsghdr *nlh, void *data,
if (supported || enabled) {
if (isfirst) {
open_json_object(NULL);
- print_string(PRINT_ANY,
- "ifname", "link %s/", dev);
- print_uint(PRINT_ANY, "port",
- "%u ", port);
+ print_string(PRINT_ANY, "ifname", "link %s/", dev);
+ print_uint(PRINT_ANY, "port", "%u ", port);
if (supported)
open_json_array(PRINT_ANY,
- "supported optional-counters");
+ "supported optional-counters");
else
open_json_array(PRINT_ANY,
"optional-counters");
- print_string(PRINT_FP, NULL,
- " ", NULL);
+ print_string(PRINT_FP, NULL, " ", NULL);
isfirst = false;
} else {
- print_string(PRINT_FP, NULL,
- ",", NULL);
+ print_string(PRINT_FP, NULL, ",", NULL);
}
if (rd->pretty_output && !rd->json_output)
newline_indent(rd);
- print_string(PRINT_ANY, NULL, "%s",
- name);
+ print_string(PRINT_ANY, NULL, "%s", name);
}
}
diff --git a/rdma/sys.c b/rdma/sys.c
index d7403a24027d..7bb0edbfec2b 100644
--- a/rdma/sys.c
+++ b/rdma/sys.c
@@ -36,8 +36,7 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
else
mode_str = "unknown";
- print_string(PRINT_ANY, "netns", "netns %s ",
- mode_str);
+ print_string(PRINT_ANY, "netns", "netns %s ", mode_str);
}
if (tb[RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE]) {
@@ -45,17 +44,14 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
mode = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE]);
- print_on_off(PRINT_ANY, "privileged-qkey",
- "privileged-qkey %s ", mode);
+ print_on_off(PRINT_ANY, "privileged-qkey", "privileged-qkey %s ", mode);
}
if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])
cof = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]);
- print_on_off(PRINT_ANY, "copy-on-fork",
- "copy-on-fork %s\n",
- cof);
+ print_on_off(PRINT_ANY, "copy-on-fork", "copy-on-fork %s\n", cof);
return MNL_CB_OK;
}
diff --git a/rdma/utils.c b/rdma/utils.c
index d647813c37fa..f73a9f19b617 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -872,24 +872,19 @@ static int print_driver_entry(struct rd *rd, struct nlattr *key_attr,
switch (attr_type) {
case RDMA_NLDEV_ATTR_DRIVER_STRING:
- ret = print_driver_string(rd, key_str,
- mnl_attr_get_str(val_attr));
+ ret = print_driver_string(rd, key_str, mnl_attr_get_str(val_attr));
break;
case RDMA_NLDEV_ATTR_DRIVER_S32:
- ret = print_driver_s32(rd, key_str, mnl_attr_get_u32(val_attr),
- print_type);
+ ret = print_driver_s32(rd, key_str, mnl_attr_get_u32(val_attr), print_type);
break;
case RDMA_NLDEV_ATTR_DRIVER_U32:
- ret = print_driver_u32(rd, key_str, mnl_attr_get_u32(val_attr),
- print_type);
+ ret = print_driver_u32(rd, key_str, mnl_attr_get_u32(val_attr), print_type);
break;
case RDMA_NLDEV_ATTR_DRIVER_S64:
- ret = print_driver_s64(rd, key_str, mnl_attr_get_u64(val_attr),
- print_type);
+ ret = print_driver_s64(rd, key_str, mnl_attr_get_u64(val_attr), print_type);
break;
case RDMA_NLDEV_ATTR_DRIVER_U64:
- ret = print_driver_u64(rd, key_str, mnl_attr_get_u64(val_attr),
- print_type);
+ ret = print_driver_u64(rd, key_str, mnl_attr_get_u64(val_attr), print_type);
break;
}
free(key_str);
--
2.43.0
Powered by blists - more mailing lists