From: Josua Mayer <josua@solid-run.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Mor Nagli <mor.nagli@solid-run.com>
Subject: Re: [PATCH net-next v2] net: dsa: mv88e6xxx: control mdio bus-id truncation for long paths
Date: Mon, 15 Apr 2024 08:01:22 +0000 [thread overview]
Message-ID: <f0e879e4-745c-4b33-b60e-15973cf9c42e@solid-run.com> (raw)
In-Reply-To: <1692b2fc-9c62-42ac-a9e8-d843ec932722@lunn.ch>
Am 04.04.24 um 16:29 schrieb Andrew Lunn:
>> + } 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.
I considered adding a new variable (e.g. busid_len) to capture all results
from snprintf calls. But it is confusing because in some calls it is
length of parts of bus-id only.
Maybe just using a new variable "len" for all snprintf can be readable?
prev parent reply other threads:[~2024-04-15 8:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 14:06 [PATCH net-next v2] net: dsa: mv88e6xxx: control mdio bus-id truncation for long paths Josua Mayer
2024-04-04 14:29 ` Andrew Lunn
2024-04-15 8:01 ` Josua Mayer [this message]
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=f0e879e4-745c-4b33-b60e-15973cf9c42e@solid-run.com \
--to=josua@solid-run.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mor.nagli@solid-run.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/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