git: 99084611932f - main - nlsysevent: add default command to the events

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Fri, 02 Jun 2023 12:22:32 UTC
The branch main has been updated by bapt:

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

commit 99084611932f5b61e1ed875da550a889f170e125
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-06-02 12:19:17 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-06-02 12:22:10 +0000

    nlsysevent: add default command to the events
---
 sys/netlink/netlink_sysevent.c |  2 +-
 sys/netlink/netlink_sysevent.h | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/sys/netlink/netlink_sysevent.c b/sys/netlink/netlink_sysevent.c
index aeb819e6e85d..9da72a121ecd 100644
--- a/sys/netlink/netlink_sysevent.c
+++ b/sys/netlink/netlink_sysevent.c
@@ -74,7 +74,7 @@ sysevent_write(struct sysevent_group *se, const char *subsystem, const char *typ
 		return;
 	}
 	ghdr->version = 0;
-	ghdr->cmd = 0;
+	ghdr->cmd = NLSE_CMD_NEWEVENT;
 	ghdr->reserved = 0;
 	nlattr_add_string(&nw, NLSE_ATTR_SYSTEM, se->name);
 	nlattr_add_string(&nw, NLSE_ATTR_SUBSYSTEM, subsystem);
diff --git a/sys/netlink/netlink_sysevent.h b/sys/netlink/netlink_sysevent.h
index 23288d2dd5c3..8434a0de078e 100644
--- a/sys/netlink/netlink_sysevent.h
+++ b/sys/netlink/netlink_sysevent.h
@@ -30,11 +30,20 @@
 
 enum {
 	NLSE_ATTR_UNSPEC = 0,
-	NLSE_ATTR_SYSTEM = 1,
-	NLSE_ATTR_SUBSYSTEM = 2,
-	NLSE_ATTR_TYPE = 3,
-	NLSE_ATTR_DATA = 4,
+	NLSE_ATTR_SYSTEM = 1,     /* string reporting the system name */
+	NLSE_ATTR_SUBSYSTEM = 2,  /* string reporting the subsystem name */
+	NLSE_ATTR_TYPE = 3,       /* string reporting the type if the event */
+	NLSE_ATTR_DATA = 4,       /* string reporting the extra data (can be null) */
 	__NLSE_ATTR_MAX,
 };
 #define NLSE_ATTR_MAX (__NLSE_ATTR_MAX -1)
+
+/* commands */
+enum {
+	NLSE_CMD_UNSPEC = 0,
+	NLSE_CMD_NEWEVENT = 1,
+	__NLSE_CMD_MAX,
+};
+#define	NLSE_CMD_MAX (__NLSE_CMD_MAX - 1)
+
 #endif