nlsysevent: add default command to the events

This commit is contained in:
Baptiste Daroussin 2023-06-02 14:19:17 +02:00
parent 0bcb3ebd1f
commit 9908461193
2 changed files with 14 additions and 5 deletions

View file

@ -74,7 +74,7 @@ sysevent_write(struct sysevent_group *se, const char *subsystem, const char *typ
return; return;
} }
ghdr->version = 0; ghdr->version = 0;
ghdr->cmd = 0; ghdr->cmd = NLSE_CMD_NEWEVENT;
ghdr->reserved = 0; ghdr->reserved = 0;
nlattr_add_string(&nw, NLSE_ATTR_SYSTEM, se->name); nlattr_add_string(&nw, NLSE_ATTR_SYSTEM, se->name);
nlattr_add_string(&nw, NLSE_ATTR_SUBSYSTEM, subsystem); nlattr_add_string(&nw, NLSE_ATTR_SUBSYSTEM, subsystem);

View file

@ -30,11 +30,20 @@
enum { enum {
NLSE_ATTR_UNSPEC = 0, NLSE_ATTR_UNSPEC = 0,
NLSE_ATTR_SYSTEM = 1, NLSE_ATTR_SYSTEM = 1, /* string reporting the system name */
NLSE_ATTR_SUBSYSTEM = 2, NLSE_ATTR_SUBSYSTEM = 2, /* string reporting the subsystem name */
NLSE_ATTR_TYPE = 3, NLSE_ATTR_TYPE = 3, /* string reporting the type if the event */
NLSE_ATTR_DATA = 4, NLSE_ATTR_DATA = 4, /* string reporting the extra data (can be null) */
__NLSE_ATTR_MAX, __NLSE_ATTR_MAX,
}; };
#define NLSE_ATTR_MAX (__NLSE_ATTR_MAX -1) #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 #endif