Thread (30 messages) 30 messages, 5 authors, 2023-08-10

Re: [PATCH net-next 08/10] netdev-genl: use struct genl_info for reply construction

From: Jiri Pirko <jiri@resnulli.us>
Date: 2023-08-10 09:10:26

Wed, Aug 09, 2023 at 08:26:46PM CEST, kuba@kernel.org wrote:

[...]
quoted hunk ↗ jump to hunk
@@ -41,6 +41,7 @@ netdev_nl_dev_fill(struct net_device *netdev, struct sk_buff *rsp,
static void
netdev_genl_dev_notify(struct net_device *netdev, int cmd)
{
+	GENL_INFO_NTF(info, &netdev_nl_family, cmd);
These macros declaring and defining struct on stack always introduce
some level of obfuscation to the code. Again, as I suggested in the
reply to the previous patch, would it be nicer to have initializer
helper instead? Something like:

	struct genl_info info;

	genl_info_nft(&info, &netdev_nl_family, cmd);

quoted hunk ↗ jump to hunk
	struct sk_buff *ntf;

	if (!genl_has_listeners(&netdev_nl_family, dev_net(netdev),
@@ -51,7 +52,7 @@ netdev_genl_dev_notify(struct net_device *netdev, int cmd)
	if (!ntf)
		return;

-	if (netdev_nl_dev_fill(netdev, ntf, 0, 0, 0, cmd)) {
+	if (netdev_nl_dev_fill(netdev, ntf, &info)) {
		nlmsg_free(ntf);
		return;
	}
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help