git: 90b1df4f4df9 - main - netlink: small cleanup of generic snl(3)

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 16 Jan 2025 07:30:21 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=90b1df4f4df937bca4b18563e6e15288de7484ac

commit 90b1df4f4df937bca4b18563e6e15288de7484ac
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-16 01:01:53 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-16 07:22:19 +0000

    netlink: small cleanup of generic snl(3)
    
    - Add const qualifiers for the family/group name pointers.
    - Break & tab long lines.
    
    No functional changes.
---
 sys/netlink/netlink_snl_generic.h | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/sys/netlink/netlink_snl_generic.h b/sys/netlink/netlink_snl_generic.h
index e2dc4d1bfffe..bdbefb914259 100644
--- a/sys/netlink/netlink_snl_generic.h
+++ b/sys/netlink/netlink_snl_generic.h
@@ -62,7 +62,7 @@ static struct snl_field_parser snl_fp_genl[] = {};
 
 struct snl_genl_ctrl_mcast_group {
 	uint32_t mcast_grp_id;
-	char *mcast_grp_name;
+	const char *mcast_grp_name;
 };
 
 struct snl_genl_ctrl_mcast_groups {
@@ -72,25 +72,40 @@ struct snl_genl_ctrl_mcast_groups {
 
 #define	_OUT(_field)	offsetof(struct snl_genl_ctrl_mcast_group, _field)
 static struct snl_attr_parser _nla_p_getmc[] = {
-	{ .type = CTRL_ATTR_MCAST_GRP_NAME, .off = _OUT(mcast_grp_name), .cb = snl_attr_get_string },
-	{ .type = CTRL_ATTR_MCAST_GRP_ID, .off = _OUT(mcast_grp_id), .cb = snl_attr_get_uint32 },
+	{
+		.type = CTRL_ATTR_MCAST_GRP_NAME,
+		.off = _OUT(mcast_grp_name),
+		.cb = snl_attr_get_string,
+	},
+	{
+		.type = CTRL_ATTR_MCAST_GRP_ID,
+		.off = _OUT(mcast_grp_id),
+		.cb = snl_attr_get_uint32,
+	},
 };
 #undef _OUT
 SNL_DECLARE_ATTR_PARSER_EXT(_genl_ctrl_mc_parser,
-		sizeof(struct snl_genl_ctrl_mcast_group),
-		_nla_p_getmc, NULL);
+    sizeof(struct snl_genl_ctrl_mcast_group), _nla_p_getmc, NULL);
 
 struct _getfamily_attrs {
 	uint16_t family_id;
-	char	*family_name;
+	const char *family_name;
 	struct snl_genl_ctrl_mcast_groups mcast_groups;
 };
 
 #define	_IN(_field)	offsetof(struct genlmsghdr, _field)
 #define	_OUT(_field)	offsetof(struct _getfamily_attrs, _field)
 static struct snl_attr_parser _nla_p_getfam[] = {
-	{ .type = CTRL_ATTR_FAMILY_ID , .off = _OUT(family_id), .cb = snl_attr_get_uint16 },
-	{ .type = CTRL_ATTR_FAMILY_NAME, .off = _OUT(family_name), .cb = snl_attr_get_string },
+	{
+		.type = CTRL_ATTR_FAMILY_ID,
+		.off = _OUT(family_id),
+		.cb = snl_attr_get_uint16,
+	},
+	{
+		.type = CTRL_ATTR_FAMILY_NAME,
+		.off = _OUT(family_name),
+		.cb = snl_attr_get_string,
+	},
 	{
 		.type = CTRL_ATTR_MCAST_GROUPS,
 		.off = _OUT(mcast_groups),