1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Copyright (c) 2021-2022, Microsoft Corporation.
8 #ifndef _UAPI_LINUX_USER_EVENTS_H
9 #define _UAPI_LINUX_USER_EVENTS_H
11 #include <linux/types.h>
12 #include <linux/ioctl.h>
14 #define USER_EVENTS_SYSTEM "user_events"
15 #define USER_EVENTS_PREFIX "u:"
17 /* Create dynamic location entry within a 32-bit value */
18 #define DYN_LOC(offset, size) ((size) << 16 | (offset))
21 * Describes an event registration and stores the results of the registration.
22 * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
23 * must set the size and name_args before invocation.
27 /* Input: Size of the user_reg structure being used */
30 /* Input: Bit in enable address to use */
33 /* Input: Enable size in bytes at address */
36 /* Input: Flags for future use, set to 0 */
39 /* Input: Address to update when enabled */
42 /* Input: Pointer to string with event name, description and flags */
45 /* Output: Index of the event to use when writing data */
47 } __attribute__((__packed__));
50 * Describes an event unregister, callers must set the size, address and bit.
51 * This structure is passed to the DIAG_IOCSUNREG ioctl to disable bit updates.
54 /* Input: Size of the user_unreg structure being used */
57 /* Input: Bit to unregister */
60 /* Input: Reserved, set to 0 */
63 /* Input: Reserved, set to 0 */
66 /* Input: Address to unregister */
68 } __attribute__((__packed__));
70 #define DIAG_IOC_MAGIC '*'
72 /* Request to register a user_event */
73 #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
75 /* Request to delete a user_event */
76 #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
78 /* Requests to unregister a user_event */
79 #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
81 #endif /* _UAPI_LINUX_USER_EVENTS_H */