linux-headers (unknown)

(root)/
include/
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 _LINUX_USER_EVENTS_H
       9  #define _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: Bit in enable address to use */
      31  	__u8	enable_bit;
      32  
      33  	/* Input: Enable size in bytes at address */
      34  	__u8	enable_size;
      35  
      36  	/* Input: Flags for future use, set to 0 */
      37  	__u16	flags;
      38  
      39  	/* Input: Address to update when enabled */
      40  	__u64	enable_addr;
      41  
      42  	/* Input: Pointer to string with event name, description and flags */
      43  	__u64	name_args;
      44  
      45  	/* Output: Index of the event to use when writing data */
      46  	__u32	write_index;
      47  } __attribute__((__packed__));
      48  
      49  /*
      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.
      52   */
      53  struct user_unreg {
      54  	/* Input: Size of the user_unreg structure being used */
      55  	__u32	size;
      56  
      57  	/* Input: Bit to unregister */
      58  	__u8	disable_bit;
      59  
      60  	/* Input: Reserved, set to 0 */
      61  	__u8	__reserved;
      62  
      63  	/* Input: Reserved, set to 0 */
      64  	__u16	__reserved2;
      65  
      66  	/* Input: Address to unregister */
      67  	__u64	disable_addr;
      68  } __attribute__((__packed__));
      69  
      70  #define DIAG_IOC_MAGIC '*'
      71  
      72  /* Request to register a user_event */
      73  #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
      74  
      75  /* Request to delete a user_event */
      76  #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
      77  
      78  /* Requests to unregister a user_event */
      79  #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
      80  
      81  #endif /* _LINUX_USER_EVENTS_H */