git: ac84ce05c121 - main - netlink: consistently use uint16_t for family id

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Tue, 03 Dec 2024 20:04:54 UTC
The branch main has been updated by glebius:

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

commit ac84ce05c121b1f6ff47f0f3302ac26020231d08
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-12-03 20:04:09 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-12-03 20:04:09 +0000

    netlink: consistently use uint16_t for family id
    
    Reviewed by:            melifaro
    Differential Revision:  https://reviews.freebsd.org/D47547
---
 sys/netlink/netlink_ctl.h         | 4 ++--
 sys/netlink/netlink_domain.c      | 2 +-
 sys/netlink/netlink_generic_kpi.c | 4 ++--
 sys/netlink/netlink_var.h         | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/netlink/netlink_ctl.h b/sys/netlink/netlink_ctl.h
index 90a6cb663810..2d4737b61c40 100644
--- a/sys/netlink/netlink_ctl.h
+++ b/sys/netlink/netlink_ctl.h
@@ -79,7 +79,7 @@ bool netlink_register_proto(int proto, const char *proto_name, nl_handler_f hand
 bool netlink_unregister_proto(int proto);
 
 /* Common helpers */
-bool nl_has_listeners(int netlink_family, uint32_t groups_mask);
+bool nl_has_listeners(uint16_t netlink_family, uint32_t groups_mask);
 bool nlp_has_priv(struct nlpcb *nlp, int priv);
 struct ucred *nlp_get_cred(struct nlpcb *nlp);
 uint32_t nlp_get_pid(const struct nlpcb *nlp);
@@ -103,7 +103,7 @@ uint32_t genl_register_group(const char *family_name, const char *group_name);
 
 struct genl_family;
 const char *genl_get_family_name(const struct genl_family *gf);
-uint32_t genl_get_family_id(const struct genl_family *gf);
+uint16_t genl_get_family_id(const struct genl_family *gf);
 
 typedef void (*genl_family_event_handler_t)(void *arg, const struct genl_family *gf, int action);
 EVENTHANDLER_DECLARE(genl_family_event, genl_family_event_handler_t);
diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c
index 777aff43000a..7bd58e63b65a 100644
--- a/sys/netlink/netlink_domain.c
+++ b/sys/netlink/netlink_domain.c
@@ -256,7 +256,7 @@ nl_send_group(struct nl_writer *nw)
 }
 
 bool
-nl_has_listeners(int netlink_family, uint32_t groups_mask)
+nl_has_listeners(uint16_t netlink_family, uint32_t groups_mask)
 {
 	return (V_nl_ctl != NULL);
 }
diff --git a/sys/netlink/netlink_generic_kpi.c b/sys/netlink/netlink_generic_kpi.c
index b5cf03dd8fc8..4e40bb7dfc49 100644
--- a/sys/netlink/netlink_generic_kpi.c
+++ b/sys/netlink/netlink_generic_kpi.c
@@ -252,7 +252,7 @@ genl_register_group(const char *family_name, const char *group_name)
 
 /* accessors */
 struct genl_family *
-genl_get_family(uint32_t family_id)
+genl_get_family(uint16_t family_id)
 {
 	return ((family_id < MAX_FAMILIES) ? &families[family_id] : NULL);
 }
@@ -263,7 +263,7 @@ genl_get_family_name(const struct genl_family *gf)
 	return (gf->family_name);
 }
 
-uint32_t
+uint16_t
 genl_get_family_id(const struct genl_family *gf)
 {
 	return (gf->family_id);
diff --git a/sys/netlink/netlink_var.h b/sys/netlink/netlink_var.h
index ddf30b373446..51b0045b1430 100644
--- a/sys/netlink/netlink_var.h
+++ b/sys/netlink/netlink_var.h
@@ -159,7 +159,7 @@ struct genl_group {
 	const char		*group_name;
 };
 
-struct genl_family *genl_get_family(uint32_t family_id);
+struct genl_family *genl_get_family(uint16_t family_id);
 struct genl_group *genl_get_group(uint32_t group_id);
 
 #define	MAX_FAMILIES	20