Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing/user_events: Split header into uapi and kernel

The UAPI parts need to be split out from the kernel parts of user_events
now that other parts of the kernel will reference it. Do so by moving
the existing include/linux/user_events.h into
include/uapi/linux/user_events.h.

Link: https://lkml.kernel.org/r/20230328235219.203-2-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Beau Belgrave and committed by
Steven Rostedt (Google)
e5a26a40 80a76994

+54 -51
+6 -46
include/linux/user_events.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (c) 2021, Microsoft Corporation. 3 + * Copyright (c) 2022, Microsoft Corporation. 4 4 * 5 5 * Authors: 6 6 * Beau Belgrave <beaub@linux.microsoft.com> 7 7 */ 8 - #ifndef _UAPI_LINUX_USER_EVENTS_H 9 - #define _UAPI_LINUX_USER_EVENTS_H 10 8 11 - #include <linux/types.h> 12 - #include <linux/ioctl.h> 9 + #ifndef _LINUX_USER_EVENTS_H 10 + #define _LINUX_USER_EVENTS_H 13 11 14 - #ifdef __KERNEL__ 15 - #include <linux/uio.h> 16 - #else 17 - #include <sys/uio.h> 18 - #endif 12 + #include <uapi/linux/user_events.h> 19 13 20 - #define USER_EVENTS_SYSTEM "user_events" 21 - #define USER_EVENTS_PREFIX "u:" 22 - 23 - /* Create dynamic location entry within a 32-bit value */ 24 - #define DYN_LOC(offset, size) ((size) << 16 | (offset)) 25 - 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 - 39 - /* Output: Bitwise index of the event within the status page */ 40 - __u32 status_bit; 41 - 42 - /* Output: Index of the event to use when writing data */ 43 - __u32 write_index; 44 - } __attribute__((__packed__)); 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 - 54 - #endif /* _UAPI_LINUX_USER_EVENTS_H */ 14 + #endif /* _LINUX_USER_EVENTS_H */
+48
include/uapi/linux/user_events.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + /* 3 + * Copyright (c) 2021-2022, Microsoft Corporation. 4 + * 5 + * Authors: 6 + * Beau Belgrave <beaub@linux.microsoft.com> 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 + #define USER_EVENTS_SYSTEM "user_events" 15 + #define USER_EVENTS_PREFIX "u:" 16 + 17 + /* Create dynamic location entry within a 32-bit value */ 18 + #define DYN_LOC(offset, size) ((size) << 16 | (offset)) 19 + 20 + /* 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. 24 + */ 25 + struct user_reg { 26 + 27 + /* Input: Size of the user_reg structure being used */ 28 + __u32 size; 29 + 30 + /* Input: Pointer to string with event name, description and flags */ 31 + __u64 name_args; 32 + 33 + /* Output: Bitwise index of the event within the status page */ 34 + __u32 status_bit; 35 + 36 + /* Output: Index of the event to use when writing data */ 37 + __u32 write_index; 38 + } __attribute__((__packed__)); 39 + 40 + #define DIAG_IOC_MAGIC '*' 41 + 42 + /* Request to register a user_event */ 43 + #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *) 44 + 45 + /* Request to delete a user_event */ 46 + #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *) 47 + 48 + #endif /* _UAPI_LINUX_USER_EVENTS_H */
-5
kernel/trace/trace_events_user.c
··· 19 19 #include <linux/tracefs.h> 20 20 #include <linux/types.h> 21 21 #include <linux/uaccess.h> 22 - /* Reminder to move to uapi when everything works */ 23 - #ifdef CONFIG_COMPILE_TEST 24 22 #include <linux/user_events.h> 25 - #else 26 - #include <uapi/linux/user_events.h> 27 - #endif 28 23 #include "trace.h" 29 24 #include "trace_dynevent.h" 30 25