Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | /* |
| 3 | * Copyright (c) 2021, Microsoft Corporation. |
| 4 | * |
| 5 | * Authors: |
| 6 | * Beau Belgrave <[email protected]> |
| 7 | */ |
| 8 | #ifndef _UAPI_LINUX_USER_EVENTS_H |
| 9 | #define _UAPI_LINUX_USER_EVENTS_H |
| 10 | |
| 11 | #include <linux/types.h> |
| 12 | #include <linux/ioctl.h> |
| 13 | |
| 14 | #ifdef __KERNEL__ |
| 15 | #include <linux/uio.h> |
| 16 | #else |
| 17 | #include <sys/uio.h> |
| 18 | #endif |
| 19 | |
| 20 | #define USER_EVENTS_SYSTEM "user_events" |
| 21 | #define USER_EVENTS_PREFIX "u:" |
| 22 | |
Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 23 | /* Create dynamic location entry within a 32-bit value */ |
| 24 | #define DYN_LOC(offset, size) ((size) << 16 | (offset)) |
| 25 | |
Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 26 | /* |
| 27 | * Describes an event registration and stores the results of the registration. |
| 28 | * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum |
| 29 | * must set the size and name_args before invocation. |
| 30 | */ |
| 31 | struct user_reg { |
| 32 | |
| 33 | /* Input: Size of the user_reg structure being used */ |
| 34 | __u32 size; |
| 35 | |
| 36 | /* Input: Pointer to string with event name, description and flags */ |
| 37 | __u64 name_args; |
| 38 | |
Beau Belgrave | 39d6d08 | 2022-07-28 16:33:08 -0700 | [diff] [blame] | 39 | /* Output: Bitwise index of the event within the status page */ |
| 40 | __u32 status_bit; |
Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 41 | |
| 42 | /* Output: Index of the event to use when writing data */ |
| 43 | __u32 write_index; |
Beau Belgrave | 39d6d08 | 2022-07-28 16:33:08 -0700 | [diff] [blame] | 44 | } __attribute__((__packed__)); |
Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 45 | |
| 46 | #define DIAG_IOC_MAGIC '*' |
| 47 | |
| 48 | /* Requests to register a user_event */ |
| 49 | #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg*) |
| 50 | |
| 51 | /* Requests to delete a user_event */ |
| 52 | #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char*) |
| 53 | |
Beau Belgrave | 7f5a08c | 2022-01-18 12:43:15 -0800 | [diff] [blame] | 54 | #endif /* _UAPI_LINUX_USER_EVENTS_H */ |