1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2013 Damian Bogel. All rights reserved.
14 */
15
16 #ifndef _FSD_H
17 #define _FSD_H
18
19 /*
20 * filesystem disturber header file
21 */
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <sys/errno.h>
28 #include <sys/ksynch.h>
29 #include <sys/list.h>
30 #include <sys/param.h>
31 #include <sys/types.h>
32 #include <sys/vfs.h>
33
34
35 #define FSD_DEV_PATH "/dev/fsd"
36
37 /*
38 * Commands for ioctl().
39 */
40 #define FSDIOC (('f' << 24) | ('s' << 16) | ('d' << 8))
41 #define FSD_GET_PARAM (FSDIOC | 1)
42 #define FSD_ENABLE (FSDIOC | 2)
43 #define FSD_DISABLE (FSDIOC | 3)
44 #define FSD_DISTURB (FSDIOC | 4)
45 #define FSD_DISTURB_OFF (FSDIOC | 5)
46 #define FSD_DISTURB_OMNI (FSDIOC | 6)
47 #define FSD_DISTURB_OMNI_OFF (FSDIOC | 7)
48 #define FSD_GET_LIST (FSDIOC | 8)
49 #define FSD_GET_INFO (FSDIOC | 9)
50
51
52 /*
53 * Parameters description:
54 * "read less"
55 * Makes a VOP_READ() call read n (from a given range) bytes less than it
56 * was requested.
57 */
58 typedef struct fsd {
59 uint64_t read_less_chance;
60 uint64_t read_less_r[2]; /* range */
61 } fsd_t;
62
63 typedef struct fsd_info {
64 uint64_t fsdinf_enabled; /* fsd enabled */
65 uint64_t fsdinf_count; /* disturbers installed */
66 uint64_t fsdinf_omni_on; /* omnipresent disturber on */
67 fsd_t fsdinf_omni_param; /* omnipresent dist. params */
68 } fsd_info_t;
69
70 typedef struct fsd_dis {
71 int64_t fsdd_mnt;
72 fsd_t fsdd_param;
73 } fsd_dis_t;
74
75 typedef struct fsd_fs {
76 fsd_t fsdf_param;
77 uint8_t fsdf_name[MAXPATHLEN];
78 } fsd_fs_t;
79
80 typedef union fsd_ioc { /* Used with: */
81 fsd_info_t fsdioc_info; /* _GET_INFO */
82 fsd_dis_t fsdioc_dis; /* _DISTURB */
83 fsd_t fsdioc_param; /* _GET_PARAM out, _DISTURB_OMNI */
84 int64_t fsdioc_mnt; /* _DISTURB_OFF, _GET_PARAM in */
85 struct {
86 int64_t count;
87 uint64_t listp;
88 } fsdioc_list; /* _GET_LIST */
89 } fsd_ioc_t;
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* _FSD_H */