Skip to content

Commit e5a26a4

Browse files
beaubelgraverostedt
authored andcommitted
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>
1 parent 80a7699 commit e5a26a4

3 files changed

Lines changed: 54 additions & 51 deletions

File tree

include/linux/user_events.h

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
1-
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1+
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
3-
* Copyright (c) 2021, Microsoft Corporation.
3+
* Copyright (c) 2022, Microsoft Corporation.
44
*
55
* Authors:
66
* Beau Belgrave <beaub@linux.microsoft.com>
77
*/
8-
#ifndef _UAPI_LINUX_USER_EVENTS_H
9-
#define _UAPI_LINUX_USER_EVENTS_H
108

11-
#include <linux/types.h>
12-
#include <linux/ioctl.h>
9+
#ifndef _LINUX_USER_EVENTS_H
10+
#define _LINUX_USER_EVENTS_H
1311

14-
#ifdef __KERNEL__
15-
#include <linux/uio.h>
16-
#else
17-
#include <sys/uio.h>
18-
#endif
12+
#include <uapi/linux/user_events.h>
1913

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 */

include/uapi/linux/user_events.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 */

kernel/trace/trace_events_user.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
#include <linux/tracefs.h>
2020
#include <linux/types.h>
2121
#include <linux/uaccess.h>
22-
/* Reminder to move to uapi when everything works */
23-
#ifdef CONFIG_COMPILE_TEST
2422
#include <linux/user_events.h>
25-
#else
26-
#include <uapi/linux/user_events.h>
27-
#endif
2823
#include "trace.h"
2924
#include "trace_dynevent.h"
3025

0 commit comments

Comments
 (0)