[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2024 16:29:46 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Josua Mayer <josua@...id-run.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Mor Nagli <mor.nagli@...id-run.com>
Subject: Re: [PATCH net-next v2] net: dsa: mv88e6xxx: control mdio bus-id
truncation for long paths
> + } else if (err >= MII_BUS_ID_SIZE) {
> + /* If generated bus id is truncated, names in sysfs
> + * may collide. Insert a special numeric suffix to mark
> + * truncation and avoid name collisions.
> + */
> + err = snprintf(NULL, 0, "...!-%d", trunc);
> + if (err < 0)
> + return err;
It took me a while to figure out what this was doing. Rather than err,
maybe add a new variable postfix_len, to give a clue that this is used
to determine how long the post fix is, and so how much needs to be
truncated from the end of the string to make room for it.
Andrew
Powered by blists - more mailing lists