xref: /titanic_51/usr/src/common/zev/zev.h (revision 2bb8e5e2ef829a38e0408e7207b4aa15f5eb947b)
1 #ifndef __ZEV_H__
2 #define __ZEV_H__
3 
4 #include <sys/types.h>
5 
6 #ifdef _KERNEL
7 #include <sys/dmu_objset.h>
8 #include <sys/dsl_dataset.h>
9 #include <sys/zfs_vfsops.h>
10 #include <sys/dsl_dir.h>
11 #include <sys/spa_impl.h>
12 #endif
13 
14 #define ZEVIOC			('z' << 8)
15 #define ZEV_IOC_GET_STATISTICS	(ZEVIOC | 1)	/* get zev statistics */
16 #define ZEV_IOC_MUTE_POOL	(ZEVIOC | 2)	/* no more events for pool */
17 #define ZEV_IOC_UNMUTE_POOL	(ZEVIOC | 3)	/* send pool events again */
18 
19 #define ZEV_OP_MIN			 1
20 #define	ZEV_OP_ZFS_MOUNT		 1
21 #define	ZEV_OP_ZFS_UMOUNT		 2
22 #define	ZEV_OP_ZVOL_WRITE		 3
23 #define	ZEV_OP_ZVOL_TRUNCATE		 4
24 #define	ZEV_OP_ZNODE_CLOSE_AFTER_UPDATE	 5
25 #define	ZEV_OP_ZNODE_CREATE		 6
26 #define	ZEV_OP_ZNODE_REMOVE		 7
27 #define	ZEV_OP_ZNODE_LINK		 8
28 #define	ZEV_OP_ZNODE_SYMLINK		 9
29 #define	ZEV_OP_ZNODE_RENAME		10
30 #define	ZEV_OP_ZNODE_WRITE		11
31 #define	ZEV_OP_ZNODE_TRUNCATE		12
32 #define	ZEV_OP_ZNODE_SETATTR		13
33 #define	ZEV_OP_ZNODE_ACL		14
34 #define	ZEV_OP_MAX			14
35 
36 typedef struct zev_statistics_t {
37 	uint64_t	zev_queue_len;
38 	uint64_t	zev_bytes_read;
39 	/* counters */
40 	uint64_t	zev_cnt_total_events;
41 	uint64_t	zev_cnt_errors;
42 	/* zfsvfs ops */
43 	uint64_t	zev_cnt_zfs_mount;
44 	uint64_t	zev_cnt_zfs_umount;
45 	/* zvol ops */
46 	uint64_t	zev_cnt_zvol_write;
47 	uint64_t	zev_cnt_zvol_truncate;
48 	/* znode ops */
49 	uint64_t	zev_cnt_znode_close_after_update;
50 	uint64_t	zev_cnt_znode_create;
51 	uint64_t	zev_cnt_znode_remove;
52 	uint64_t	zev_cnt_znode_link;
53 	uint64_t	zev_cnt_znode_symlink;
54 	uint64_t	zev_cnt_znode_rename;
55 	uint64_t	zev_cnt_znode_write;
56 	uint64_t	zev_cnt_znode_truncate;
57 	uint64_t	zev_cnt_znode_setattr;
58 	uint64_t	zev_cnt_znode_acl;
59 } zev_statistics_t;
60 
61 typedef struct zev_ioctl_poolarg {
62 	uint64_t	zev_poolname_len;
63 	char		zev_poolname[MAXPATHLEN];
64 } zev_ioctl_poolarg_t;
65 
66 #ifdef _KERNEL
67 void zev_mq_printf(int op, int error, char *fmt, ...);
68 int zev_skip_pool(objset_t *os);
69 #endif
70 
71 #endif /* __ZEV_H__ */
72 
73