Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jonathan Toppins <jtoppins@redhat.com>
To: Joe Perches <joe@perches.com>, Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, leon@kernel.org,
	Jay Vosburgh <j.vosburgh@gmail.com>,
	Veaceslav Falico <vfalico@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] bonding: combine netlink and console error messages
Date: Wed, 11 Aug 2021 10:31:20 -0400	[thread overview]
Message-ID: <5100eeab-dd01-d739-95f0-0a0267652bae@redhat.com> (raw)
In-Reply-To: <c296dd2f66e97ad38d5456c0fab4e0ff99b14634.camel@perches.com>

On 8/11/21 9:23 AM, Joe Perches wrote:
> On Wed, 2021-08-11 at 05:49 -0700, Jakub Kicinski wrote:
>> On Tue, 10 Aug 2021 20:27:01 -0700 Joe Perches wrote:
>>>> +#define BOND_NL_ERR(bond_dev, extack, errmsg) do {		\
>>>> +	if (extack)						\
>>>> +		NL_SET_ERR_MSG(extack, errmsg);			\
>>>> +	else							\
>>>> +		netdev_err(bond_dev, "Error: %s\n", errmsg);	\
>>>> +} while (0)
>>>> +
>>>> +#define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) do {		\
>>>> +	if (extack)							\
>>>> +		NL_SET_ERR_MSG(extack, errmsg);				\
>>>> +	else								\
>>>> +		slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg);	\
>>>> +} while (0)
>>>
>>> Ideally both of these would be static functions and not macros.
>>
>> That may break our ability for NL_SET_ERR_MSG to place strings
>> back in a static buffer, no?
> 
> Not really.
> 
> The most common way to place things in a particular section is to
> use __section("whatever")
> 
> It's pretty trivial to mark these errmsg strings as above.

I am unable to convert these to functions at this time, due to how 
NL_SET_ERR_MSG is expanded. This is with either a param list prototype 
of, "const char *errmsg" or "const char errmsg[]".

$ make C=1 drivers/net/bonding/bonding.ko
   CALL    scripts/checksyscalls.sh
   CALL    scripts/atomic/check-atomics.sh
   DESCEND objtool
   DESCEND bpf/resolve_btfids
   CC [M]  drivers/net/bonding/bond_main.o
In file included from ./include/uapi/linux/neighbour.h:6,
                  from ./include/linux/netdevice.h:45,
                  from ./include/net/inet_sock.h:19,
                  from ./include/net/ip.h:28,
                  from drivers/net/bonding/bond_main.c:42:
drivers/net/bonding/bond_main.c: In function ‘bond_nl_err’:
drivers/net/bonding/bond_main.c:1733:26: error: invalid initializer
    NL_SET_ERR_MSG(extack, errmsg);
                           ^~~~~~
./include/linux/netlink.h:92:30: note: in definition of macro 
‘NL_SET_ERR_MSG’
   static const char __msg[] = msg;  \
                               ^~~
drivers/net/bonding/bond_main.c: In function ‘slave_nl_err’:
drivers/net/bonding/bond_main.c:1744:26: error: invalid initializer
    NL_SET_ERR_MSG(extack, errmsg);
                           ^~~~~~
./include/linux/netlink.h:92:30: note: in definition of macro 
‘NL_SET_ERR_MSG’
   static const char __msg[] = msg;  \
                               ^~~
make[3]: *** [scripts/Makefile.build:271: 
drivers/net/bonding/bond_main.o] Error 1
make[2]: *** [scripts/Makefile.build:514: drivers/net/bonding] Error 2
make[1]: *** [scripts/Makefile.build:514: drivers/net] Error 2
make: *** [Makefile:1841: drivers] Error 2



  reply	other threads:[~2021-08-11 14:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07  3:30 [PATCH net-next 0/2] bonding: cleanup header file and error msgs Jonathan Toppins
2021-08-07  3:30 ` [PATCH net-next 1/2] bonding: remove extraneous definitions from bonding.h Jonathan Toppins
2021-08-07  3:30 ` [PATCH net-next 2/2] bonding: combine netlink and console error messages Jonathan Toppins
2021-08-07  3:52   ` Joe Perches
2021-08-07 21:54     ` Jonathan Toppins
2021-08-08 10:02       ` Joe Perches
2021-08-09  2:07         ` Jonathan Toppins
2021-08-09  5:05           ` Joe Perches
2021-08-09 17:17             ` Jonathan Toppins
2021-08-08 10:16   ` Leon Romanovsky
2021-08-09  1:42     ` Jonathan Toppins
2021-08-09  6:03       ` Leon Romanovsky
2021-08-10  6:40   ` [PATCH net-next v2 " Jonathan Toppins
2021-08-10  6:47     ` Leon Romanovsky
2021-08-11  2:53 ` [PATCH net-next v2 0/2] bonding: cleanup header file and error msgs Jonathan Toppins
2021-08-11  2:53   ` [PATCH net-next v2 1/2] bonding: remove extraneous definitions from bonding.h Jonathan Toppins
2021-08-11  2:53   ` [PATCH net-next v2 2/2] bonding: combine netlink and console error messages Jonathan Toppins
2021-08-11  3:27     ` Joe Perches
2021-08-11 12:49       ` Jakub Kicinski
2021-08-11 13:23         ` Joe Perches
2021-08-11 14:31           ` Jonathan Toppins [this message]
2021-08-11 22:10   ` [PATCH net-next v2 0/2] bonding: cleanup header file and error msgs patchwork-bot+netdevbpf

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=5100eeab-dd01-d739-95f0-0a0267652bae@redhat.com \
    --to=jtoppins@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=j.vosburgh@gmail.com \
    --cc=joe@perches.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@gmail.com \
    --subject='Re: [PATCH net-next v2 2/2] bonding: combine netlink and console error messages' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).