Ethernet Bridge development
 help / color / mirror / Atom feed
* [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals
       [not found] <20261130184752.545119-1-stephen@networkplumber.org>
@ 2026-11-30 18:47 ` Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2026-11-30 18:47 UTC (permalink / raw)
  To: netdev
  Cc: dsahern, Stephen Hemminger, Ido Schimmel, Nikolay Aleksandrov,
	Jiri Pirko, Leon Romanovsky, bridge

print_mdb_entry() declares unsigned int ifindex for the entry's via
interface, shadowing the bridge port parameter of the same name.

devlink opens a local handle named rth and iterates version attributes
in a local named version, shadowing the global rth and the version[]
string from version.h.

rdma's main() keeps its option state in locals named show_details,
show_raw and oneline, shadowing the globals of the same names that it
never reads.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 bridge/mdb.c      |  6 +++---
 devlink/devlink.c | 16 ++++++++--------
 rdma/rdma.c       | 20 ++++++++++----------
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/bridge/mdb.c b/bridge/mdb.c
index 112deeb9..ccaf41da 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -279,11 +279,11 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
 			   rta_getattr_u32(tb[MDBA_MDB_EATTR_SRC_VNI]));
 
 	if (tb[MDBA_MDB_EATTR_IFINDEX]) {
-		unsigned int ifindex;
+		unsigned int via_ifindex;
 
-		ifindex = rta_getattr_u32(tb[MDBA_MDB_EATTR_IFINDEX]);
+		via_ifindex = rta_getattr_u32(tb[MDBA_MDB_EATTR_IFINDEX]);
 		print_string(PRINT_ANY, "via", " via %s",
-			     ll_index_to_name(ifindex));
+			     ll_index_to_name(via_ifindex));
 	}
 
 	if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER]) {
diff --git a/devlink/devlink.c b/devlink/devlink.c
index b6b24b49..c839e92a 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -846,13 +846,13 @@ static int ifname_map_rtnl_init(struct dl *dl, const char *ifname)
 		.i.ifi_family = AF_UNSPEC,
 	};
 	struct rtattr *tb[IFLA_MAX + 1];
-	struct rtnl_handle rth;
+	struct rtnl_handle drth;
 	struct ifinfomsg *ifi;
 	struct nlmsghdr *n = NULL;
 	int len;
 	int err;
 
-	if (rtnl_open(&rth, 0) < 0) {
+	if (rtnl_open(&drth, 0) < 0) {
 		pr_err("Cannot open rtnetlink\n");
 		return -EINVAL;
 	}
@@ -861,7 +861,7 @@ static int ifname_map_rtnl_init(struct dl *dl, const char *ifname)
 		  !check_ifname(ifname) ? IFLA_IFNAME : IFLA_ALT_IFNAME,
 		  ifname, strlen(ifname) + 1);
 
-	if (rtnl_talk(&rth, &req.n, &n) < 0) {
+	if (rtnl_talk(&drth, &req.n, &n) < 0) {
 		err = -EINVAL;
 		goto out;
 	}
@@ -890,7 +890,7 @@ static int ifname_map_rtnl_init(struct dl *dl, const char *ifname)
 
 out:
 	free(n);
-	rtnl_close(&rth);
+	rtnl_close(&drth);
 	return err;
 }
 
@@ -4411,18 +4411,18 @@ static int cmd_dev_reload(struct dl *dl)
 static void pr_out_versions_single(struct dl *dl, const struct nlmsghdr *nlh,
 				   const char *name, int type)
 {
-	struct nlattr *version;
+	struct nlattr *ver_attr;
 
-	mnl_attr_for_each(version, nlh, sizeof(struct genlmsghdr)) {
+	mnl_attr_for_each(ver_attr, nlh, sizeof(struct genlmsghdr)) {
 		struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {};
 		const char *ver_value;
 		const char *ver_name;
 		int err;
 
-		if (mnl_attr_get_type(version) != type)
+		if (mnl_attr_get_type(ver_attr) != type)
 			continue;
 
-		err = mnl_attr_parse_nested(version, attr_cb, tb);
+		err = mnl_attr_parse_nested(ver_attr, attr_cb, tb);
 		if (err != MNL_CB_OK)
 			continue;
 
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 253ac58b..9d775478 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -100,10 +100,10 @@ int main(int argc, char **argv)
 	};
 	bool show_driver_details = false;
 	const char *batch_file = NULL;
-	bool show_details = false;
-	bool show_raw = false;
+	bool details = false;
+	bool raw = false;
 	bool force = false;
-	bool oneline = false;
+	bool single_line = false;
 	struct rd rd = {};
 	char *filename;
 	int opt;
@@ -121,16 +121,16 @@ int main(int argc, char **argv)
 			++pretty;
 			break;
 		case 'd':
-			if (show_details)
+			if (details)
 				show_driver_details = true;
 			else
-				show_details = true;
+				details = true;
 			break;
 		case 'r':
-			show_raw = true;
+			raw = true;
 			break;
 		case 'o':
-			oneline = true;
+			single_line = true;
 			break;
 		case 'j':
 			++json;
@@ -157,11 +157,11 @@ int main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	_SL_ = oneline ? "\\" : "\n";
+	_SL_ = single_line ? "\\" : "\n";
 
-	rd.show_details = show_details;
+	rd.show_details = details;
 	rd.show_driver_details = show_driver_details;
-	rd.show_raw = show_raw;
+	rd.show_raw = raw;
 
 	err = rd_init(&rd, filename);
 	if (err)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261130184752.545119-1-stephen@networkplumber.org>
2026-11-30 18:47 ` [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox