Welcome to mirror list, hosted at ThFree Co, Russian Federation.

common.h « include « Ext3Fsd - github.com/matt-wu/Ext3Fsd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 66ed586c9cb4a70f4cbe093752cc23f35e2744a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#ifndef _EXT2_COMMON_INCLUDE_
#define _EXT2_COMMON_INCLUDE_

/* global ioctl */
#define IOCTL_APP_VOLUME_PROPERTY \
CTL_CODE(FILE_DEVICE_UNKNOWN, 2000, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_APP_QUERY_PERFSTAT \
CTL_CODE(FILE_DEVICE_UNKNOWN, 2001, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_APP_MOUNT_POINT \
CTL_CODE(FILE_DEVICE_UNKNOWN, 2002, METHOD_BUFFERED, FILE_ANY_ACCESS)


/* performance / memory allocaiton statistics */
#define PS_IRP_CONTEXT  0x00
#define PS_VCB          0x01
#define PS_FCB          0x02
#define PS_CCB          0x03
#define PS_MCB          0x04
#define PS_EXTENT       0x05
#define PS_RW_CONTEXT   0x06
#define PS_VPB          0x07
#define PS_FILE_NAME    0x08
#define PS_MCB_NAME     0x09
#define PS_INODE_NAME   0x0A
#define PS_DIR_ENTRY    0x0B
#define PS_DIR_PATTERN  0x0C
#define PS_DISK_EVENT   0x0D
#define PS_DISK_BUFFER  0x0E
#define PS_BLOCK_DATA   0x0F

#define PS_EXT2_INODE   0x10
#define PS_DENTRY       0x11
#define PS_BUFF_HEAD    0x12

#define PS_MAX_TYPE_V1  (0x10)
#define PS_MAX_TYPE_V2  (0x30)

typedef union {

    ULONG           Slot[PS_MAX_TYPE_V1];

    struct {
        ULONG       IrpContext;
        ULONG       Vcb;
        ULONG       Fcb;
        ULONG       Ccb;
        ULONG       Mcb;
        ULONG       Extent;
        ULONG       RwContext;   /* rw context */
        ULONG       Vpb;
        ULONG       FileName;
        ULONG       McbName;
        ULONG       InodeName;
        ULONG       DirEntry;    /* pDir */
        ULONG       DirPattern;  /* Ccb-> in Ext2QeuryDir */
        ULONG       ReadDiskEvent;
        ULONG       ReadDiskBuffer;
        ULONG       BlockData;   /* Ext2Expand&TruncateFile*/
    };

} EXT2_STAT_ARRAY_V1;

typedef union {

    ULONG           Slot[PS_MAX_TYPE_V2];

    struct {
        ULONG       IrpContext;
        ULONG       Vcb;
        ULONG       Fcb;
        ULONG       Ccb;
        ULONG       Mcb;
        ULONG       Extent;
        ULONG       RwContext;  /* rw context */
        ULONG       Vpb;
        ULONG       FileName;
        ULONG       McbName;
        ULONG       InodeName;
        ULONG       DirEntry;   /* pDir */
        ULONG       DirPattern; /* Ccb-> in Ext2QeuryDir */
        ULONG       ReadDiskEvent;
        ULONG       ReadDiskBuffer;
        ULONG       BlockData;  /* Ext2Expand&TruncateFile*/
        ULONG       Inodes;     /* inodes */
        ULONG       NameEntries;    /* name dentry */
        ULONG       BufferHead; /* Buffer Header allocations */
    };

} EXT2_STAT_ARRAY_V2;

typedef struct _EXT2_PERF_STATISTICS_V1 {

    /* totoal number of processed/being processed requests */
    struct {
        ULONG           Processed;
        ULONG           Current;
    } Irps [IRP_MJ_MAXIMUM_FUNCTION + 1];

    /* structure size */
    EXT2_STAT_ARRAY_V1  Unit;

    /* current memory allocation statistics */
    EXT2_STAT_ARRAY_V1  Current;

    /* memory allocated in bytes */
    EXT2_STAT_ARRAY_V1  Size;

    /* totoal memory allocation statistics */
    EXT2_STAT_ARRAY_V1  Total;

} EXT2_PERF_STATISTICS_V1, *PEXT2_PERF_STATISTICS_V1;

#define EXT2_PERF_STAT_MAGIC '2SPE'
#define EXT2_PERF_STAT_VER2   2

typedef struct _EXT2_PERF_STATISTICS_V2 {

    ULONG               Magic;      /* EPS2 */
    USHORT              Version;    /* 02 */
    USHORT              Length;     /* sizeof(EXT2_PERF_STATISTICS_V2) */

    /* totoal number of processed/being processed requests */
    struct {
        ULONG           Processed;
        ULONG           Current;
    } Irps [IRP_MJ_MAXIMUM_FUNCTION + 1];

    /* structure size */
    EXT2_STAT_ARRAY_V2  Unit;

    /* current memory allocation statistics */
    EXT2_STAT_ARRAY_V2  Current;

    /* memory allocated in bytes */
    EXT2_STAT_ARRAY_V2  Size;

    /* totoal memory allocation statistics */
    EXT2_STAT_ARRAY_V2  Total;

} EXT2_PERF_STATISTICS_V2, *PEXT2_PERF_STATISTICS_V2;

/* volume property ... */

#define EXT2_VOLUME_PROPERTY_MAGIC 'EVPM'

#define EXT2_FLAG_VP_SET_GLOBAL   0x00000001

#define APP_CMD_QUERY_VERSION     0x00000000 /* with global flag set */
#define APP_CMD_QUERY_CODEPAGES   0x00000001
#define APP_CMD_QUERY_PROPERTY    0x00000002
#define APP_CMD_SET_PROPERTY      0x00000003
#define APP_CMD_QUERY_PROPERTY2   0x00000004
#define APP_CMD_SET_PROPERTY2     0x00000005
#define APP_CMD_QUERY_PROPERTY3   0x00000006
#define APP_CMD_SET_PROPERTY3     0x00000007

#define CODEPAGE_MAXLEN     0x20
#define HIDINGPAT_LEN       0x20

typedef struct _EXT2_VOLUME_PROPERTY {
    ULONG               Magic;
    ULONG               Flags;
    ULONG               Command;
    BOOLEAN             bReadonly;
    BOOLEAN             bExt3Writable;
    BOOLEAN             bExt2;
    BOOLEAN             bExt3;
    UCHAR               Codepage[CODEPAGE_MAXLEN];
} EXT2_VOLUME_PROPERTY;

#ifdef __cplusplus
typedef struct _EXT2_VOLUME_PROPERTY2:EXT2_VOLUME_PROPERTY {
#else   // __cplusplus
typedef struct _EXT2_VOLUME_PROPERTY2 {
    EXT2_VOLUME_PROPERTY ;
#endif  // __cplusplus

    /* new volume properties added after version 0.35 */

    /* volume uuid */
    __u8	                    UUID[16];

    /* mount point: driver letter only */
    UCHAR                       DrvLetter;

    /* checking bitmap */
    BOOLEAN                     bCheckBitmap;

    /* global hiding patterns */
    BOOLEAN                     bHidingPrefix;
    BOOLEAN                     bHidingSuffix;
    CHAR                        sHidingPrefix[HIDINGPAT_LEN];
    CHAR                        sHidingSuffix[HIDINGPAT_LEN];

} EXT2_VOLUME_PROPERTY2, *PEXT2_VOLUME_PROPERTY2;

#define EXT2_VPROP3_AUTOMOUNT 0x0000000000000001

typedef struct _EXT2_VOLUME_PROPERTY3 {
    EXT2_VOLUME_PROPERTY2  Prop2;
    unsigned __int64       Flags;
    int                    AutoMount:1;
    int                    Reserved1:31;
    int                    Reserved2[31];
} EXT2_VOLUME_PROPERTY3, *PEXT2_VOLUME_PROPERTY3;

/* Ext2Fsd driver version and built time */
typedef struct _EXT2_VOLUME_PROPERTY_VERSION {
    ULONG               Magic;
    ULONG               Flags;
    ULONG               Command;
    CHAR                Version[0x1C];
    CHAR                Time[0x20];
    CHAR                Date[0x20];
} EXT2_VOLUME_PROPERTY_VERSION, *PEXT2_VOLUME_PROPERTY_VERSION;

/* performance statistics */
#define EXT2_QUERY_PERFSTAT_MAGIC 'EVPM'
#define EXT2_QUERY_PERFSTAT_VER2  0x8000000

typedef struct _EXT2_QUERY_PERFSTAT {
    ULONG                   Magic;
    ULONG                   Flags;
    ULONG                   Command;
    union {
        EXT2_PERF_STATISTICS_V1 PerfStatV1;
        EXT2_PERF_STATISTICS_V2 PerfStatV2;
    };
} EXT2_QUERY_PERFSTAT, *PEXT2_QUERY_PERFSTAT;

#define EXT2_QUERY_PERFSTAT_SZV1 (FIELD_OFFSET(EXT2_QUERY_PERFSTAT, PerfStatV1) + sizeof(EXT2_PERF_STATISTICS_V1))
#define EXT2_QUERY_PERFSTAT_SZV2 (FIELD_OFFSET(EXT2_QUERY_PERFSTAT, PerfStatV1) + sizeof(EXT2_PERF_STATISTICS_V2))

/* mountpoint management  */
#define EXT2_APP_MOUNTPOINT_MAGIC 'EAMM'
typedef struct _EXT2_MOUNT_POINT {
    ULONG                   Magic;
    ULONG                   Flags;
    ULONG                   Size;
    ULONG                   Command;
    USHORT                  Link[256];
    USHORT                  Name[256];
} EXT2_MOUNT_POINT, *PEXT2_MOUNT_POINT;

#define APP_CMD_ADD_DOS_SYMLINK    0x00000001
#define APP_CMD_DEL_DOS_SYMLINK    0x00000002


#endif /* _EXT2_COMMON_INCLUDE_ */