xref: /linux-6.15/include/uapi/linux/watch_queue.h (revision 0858caa4)
1*0858caa4SDavid Howells /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*0858caa4SDavid Howells #ifndef _UAPI_LINUX_WATCH_QUEUE_H
3*0858caa4SDavid Howells #define _UAPI_LINUX_WATCH_QUEUE_H
4*0858caa4SDavid Howells 
5*0858caa4SDavid Howells #include <linux/types.h>
6*0858caa4SDavid Howells 
7*0858caa4SDavid Howells enum watch_notification_type {
8*0858caa4SDavid Howells 	WATCH_TYPE_META		= 0,	/* Special record */
9*0858caa4SDavid Howells 	WATCH_TYPE__NR		= 1
10*0858caa4SDavid Howells };
11*0858caa4SDavid Howells 
12*0858caa4SDavid Howells enum watch_meta_notification_subtype {
13*0858caa4SDavid Howells 	WATCH_META_REMOVAL_NOTIFICATION	= 0,	/* Watched object was removed */
14*0858caa4SDavid Howells 	WATCH_META_LOSS_NOTIFICATION	= 1,	/* Data loss occurred */
15*0858caa4SDavid Howells };
16*0858caa4SDavid Howells 
17*0858caa4SDavid Howells /*
18*0858caa4SDavid Howells  * Notification record header.  This is aligned to 64-bits so that subclasses
19*0858caa4SDavid Howells  * can contain __u64 fields.
20*0858caa4SDavid Howells  */
21*0858caa4SDavid Howells struct watch_notification {
22*0858caa4SDavid Howells 	__u32			type:24;	/* enum watch_notification_type */
23*0858caa4SDavid Howells 	__u32			subtype:8;	/* Type-specific subtype (filterable) */
24*0858caa4SDavid Howells 	__u32			info;
25*0858caa4SDavid Howells #define WATCH_INFO_LENGTH	0x0000007f	/* Length of record */
26*0858caa4SDavid Howells #define WATCH_INFO_LENGTH__SHIFT 0
27*0858caa4SDavid Howells #define WATCH_INFO_ID		0x0000ff00	/* ID of watchpoint */
28*0858caa4SDavid Howells #define WATCH_INFO_ID__SHIFT	8
29*0858caa4SDavid Howells #define WATCH_INFO_TYPE_INFO	0xffff0000	/* Type-specific info */
30*0858caa4SDavid Howells #define WATCH_INFO_TYPE_INFO__SHIFT 16
31*0858caa4SDavid Howells #define WATCH_INFO_FLAG_0	0x00010000	/* Type-specific info, flag bit 0 */
32*0858caa4SDavid Howells #define WATCH_INFO_FLAG_1	0x00020000	/* ... */
33*0858caa4SDavid Howells #define WATCH_INFO_FLAG_2	0x00040000
34*0858caa4SDavid Howells #define WATCH_INFO_FLAG_3	0x00080000
35*0858caa4SDavid Howells #define WATCH_INFO_FLAG_4	0x00100000
36*0858caa4SDavid Howells #define WATCH_INFO_FLAG_5	0x00200000
37*0858caa4SDavid Howells #define WATCH_INFO_FLAG_6	0x00400000
38*0858caa4SDavid Howells #define WATCH_INFO_FLAG_7	0x00800000
39*0858caa4SDavid Howells };
40*0858caa4SDavid Howells 
41*0858caa4SDavid Howells 
42*0858caa4SDavid Howells /*
43*0858caa4SDavid Howells  * Extended watch removal notification.  This is used optionally if the type
44*0858caa4SDavid Howells  * wants to indicate an identifier for the object being watched, if there is
45*0858caa4SDavid Howells  * such.  This can be distinguished by the length.
46*0858caa4SDavid Howells  *
47*0858caa4SDavid Howells  * type -> WATCH_TYPE_META
48*0858caa4SDavid Howells  * subtype -> WATCH_META_REMOVAL_NOTIFICATION
49*0858caa4SDavid Howells  */
50*0858caa4SDavid Howells struct watch_notification_removal {
51*0858caa4SDavid Howells 	struct watch_notification watch;
52*0858caa4SDavid Howells 	__u64	id;		/* Type-dependent identifier */
53*0858caa4SDavid Howells };
54*0858caa4SDavid Howells 
55*0858caa4SDavid Howells #endif /* _UAPI_LINUX_WATCH_QUEUE_H */
56