Whamcloud - gitweb
LU-14052 ofd: support for multiple access readers
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_access_log.h
1 #ifndef _LUSTRE_ACCESS_LOG_H
2 # define _LUSTRE_ACCESS_LOG_H
3
4 #include <linux/types.h>
5 #include <asm/ioctl.h>
6 /*
7  * This is due to us being out of kernel and the way the OpenSFS branch
8  * handles CFLAGS.
9  */
10 #ifdef __KERNEL__
11 # include <uapi/linux/lustre/lustre_user.h>
12 #else
13 # include <linux/lustre/lustre_user.h>
14 #endif
15
16 enum ofd_access_flags {
17         OFD_ACCESS_READ = 0x1,
18         OFD_ACCESS_WRITE = 0x2,
19 };
20
21 struct ofd_access_entry_v1 {
22         struct lu_fid   oae_parent_fid; /* 16 */
23         __u64           oae_begin; /* 24 */
24         __u64           oae_end; /* 32 */
25         __u64           oae_time; /* 40 */
26         __u32           oae_size; /* 44 */
27         __u32           oae_segment_count; /* 48 */
28         __u32           oae_flags; /* 52 enum ofd_access_flags */
29         __u32           oae_reserved1; /* 56 */
30         __u32           oae_reserved2; /* 60 */
31         __u32           oae_reserved3; /* 64 */
32 };
33
34 /* The name of the subdirectory of devtmpfs (/dev) containing the
35  * control and access log char devices. */
36 #define LUSTRE_ACCESS_LOG_DIR_NAME "lustre-access-log"
37
38 enum {
39         LUSTRE_ACCESS_LOG_VERSION_1 = 0x00010000,
40         LUSTRE_ACCESS_LOG_TYPE_OFD = 0x1,
41         LUSTRE_ACCESS_LOG_NAME_SIZE = 128,
42 };
43
44 struct lustre_access_log_info_v1 {
45         __u32   lali_version; /* LUSTRE_ACCESS_LOG_VERSION_1 */
46         __u32   lali_type; /* LUSTRE_ACCESS_LOG_TYPE_OFD */
47         char    lali_name[LUSTRE_ACCESS_LOG_NAME_SIZE]; /* obd_name */
48         __u32   lali_log_size;
49         __u32   lali_entry_size;
50         /* Underscore prefixed members are intended for test and debug
51          * purposes only. */
52         __u32   _lali_head;
53         __u32   _lali_tail;
54         __u32   _lali_entry_space;
55         __u32   _lali_entry_count;
56         __u32   _lali_drop_count;
57         __u32   _lali_is_closed;
58 };
59
60 enum {
61         /* /dev/lustre-access-log/control ioctl: return lustre access log
62          * interface version. */
63         LUSTRE_ACCESS_LOG_IOCTL_VERSION = _IO('O', 0x81),
64
65         /* /dev/lustre-access-log/control ioctl: return device major
66          * used for access log devices. (The major is dynamically
67          * allocated during ofd module initialization. */
68         LUSTRE_ACCESS_LOG_IOCTL_MAJOR = _IO('O', 0x82),
69
70         /* /dev/lustre-access-log/control ioctl: get global control event
71          * count and store it into file private_data. */
72         LUSTRE_ACCESS_LOG_IOCTL_PRESCAN = _IO('O', 0x83),
73
74         /* /dev/lustre-access-log/OBDNAME ioctl: populate struct
75          * lustre_access_log_info_v1 for the current device. */
76         LUSTRE_ACCESS_LOG_IOCTL_INFO = _IOR('O', 0x84, struct lustre_access_log_info_v1),
77
78         /* /dev/lustre-access-log/OBDNAME ioctl: only entries whose
79          * PFID MDT index is equal to arg will be added to the log. A
80          * value of 0xfffffffff ((__u32)-1) will disable filtering
81          * which is the default.  Added in V2. */
82         LUSTRE_ACCESS_LOG_IOCTL_FILTER = _IOW('O', 0x85, __u32),
83 };
84
85 #endif /* _LUSTRE_ACCESS_LOG_H */