Ethernet Bridge development
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org,
	Stephen Hemminger <stephen@networkplumber.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Jiri Pirko <jiri@resnulli.us>, Leon Romanovsky <leon@kernel.org>,
	bridge@lists.linux-foundation.org
Subject: [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals
Date: Mon, 30 Nov 2026 10:47:09 -0800	[thread overview]
Message-ID: <20261130184752.545119-9-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130184752.545119-1-stephen@networkplumber.org>

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


           reply	other threads:[~2026-11-30 19:11 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261130184752.545119-1-stephen@networkplumber.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130184752.545119-9-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=bridge@lists.linux-foundation.org \
    --cc=dsahern@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox