ReactOS 0.4.15-dev-5667-ged97270
btrfs_drv.h
Go to the documentation of this file.
1/* Copyright (c) Mark Harmstone 2016-17
2 *
3 * This file is part of WinBtrfs.
4 *
5 * WinBtrfs is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public Licence as published by
7 * the Free Software Foundation, either version 3 of the Licence, or
8 * (at your option) any later version.
9 *
10 * WinBtrfs is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public Licence for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public Licence
16 * along with WinBtrfs. If not, see <http://www.gnu.org/licenses/>. */
17
18#pragma once
19
20#ifndef __REACTOS__
21#undef _WIN32_WINNT
22#undef NTDDI_VERSION
23
24#define _WIN32_WINNT 0x0601
25#define NTDDI_VERSION 0x06020000 // Win 8
26#define _CRT_SECURE_NO_WARNINGS
27#define _NO_CRT_STDIO_INLINE
28#endif /* __REACTOS__ */
29
30#ifdef _MSC_VER
31#pragma warning(push)
32#pragma warning(disable:4163)
33#pragma warning(disable:4311)
34#pragma warning(disable:4312)
35#else
36#pragma GCC diagnostic push
37#pragma GCC diagnostic ignored "-Wsign-compare"
38#pragma GCC diagnostic ignored "-Wsign-conversion"
39#endif
40
41#include <ntifs.h>
42#include <ntddk.h>
43#ifdef __REACTOS__
44#include <ntdddisk.h>
45#endif /* __REACTOS__ */
46#include <mountmgr.h>
47#ifdef __REACTOS__
48#include <rtlfuncs.h>
49#include <iotypes.h>
50#include <pseh/pseh2.h>
51#endif /* __REACTOS__ */
52#include <windef.h>
53#include <wdm.h>
54
55#ifdef _MSC_VER
56#pragma warning(pop)
57#else
58#pragma GCC diagnostic pop
59#endif
60
61#include <stdio.h>
62#include <stdarg.h>
63#include <stddef.h>
64#include <stdint.h>
65#include <stdbool.h>
66#include "btrfs.h"
67#include "btrfsioctl.h"
68
69#ifdef __REACTOS__
70C_ASSERT(sizeof(bool) == 1);
71#endif
72
73#ifdef _DEBUG
74// #define DEBUG_FCB_REFCOUNTS
75// #define DEBUG_LONG_MESSAGES
76// #define DEBUG_FLUSH_TIMES
77// #define DEBUG_CHUNK_LOCKS
78// #define DEBUG_TRIM_EMULATION
79#define DEBUG_PARANOID
80#endif
81
82#define UNUSED(x) (void)(x)
83
84#define BTRFS_NODE_TYPE_CCB 0x2295
85#define BTRFS_NODE_TYPE_FCB 0x2296
86
87#define ALLOC_TAG 0x7442484D //'MHBt'
88#define ALLOC_TAG_ZLIB 0x7A42484D //'MHBz'
89
90#define UID_NOBODY 65534
91#define GID_NOBODY 65534
92
93#define EA_NTACL "security.NTACL"
94#define EA_NTACL_HASH 0x45922146
95
96#define EA_DOSATTRIB "user.DOSATTRIB"
97#define EA_DOSATTRIB_HASH 0x914f9939
98
99#define EA_REPARSE "user.reparse"
100#define EA_REPARSE_HASH 0xfabad1fe
101
102#define EA_EA "user.EA"
103#define EA_EA_HASH 0x8270dd43
104
105#define EA_CASE_SENSITIVE "user.casesensitive"
106#define EA_CASE_SENSITIVE_HASH 0x1a9d97d4
107
108#define EA_PROP_COMPRESSION "btrfs.compression"
109#define EA_PROP_COMPRESSION_HASH 0x20ccdf69
110
111#define MAX_EXTENT_SIZE 0x8000000 // 128 MB
112#define COMPRESSED_EXTENT_SIZE 0x20000 // 128 KB
113
114#define READ_AHEAD_GRANULARITY COMPRESSED_EXTENT_SIZE // really ought to be a multiple of COMPRESSED_EXTENT_SIZE
115
116#ifndef IO_REPARSE_TAG_LX_SYMLINK
117
118#define IO_REPARSE_TAG_LX_SYMLINK 0xa000001d
119
120#define IO_REPARSE_TAG_AF_UNIX 0x80000023
121#define IO_REPARSE_TAG_LX_FIFO 0x80000024
122#define IO_REPARSE_TAG_LX_CHR 0x80000025
123#define IO_REPARSE_TAG_LX_BLK 0x80000026
124
125#endif
126
127#define BTRFS_VOLUME_PREFIX L"\\Device\\Btrfs{"
128
129#if defined(_MSC_VER) || defined(__clang__)
130#define try __try
131#define except __except
132#define finally __finally
133#define leave __leave
134#else
135#define try if (1)
136#define except(x) if (0 && (x))
137#define finally if (1)
138#define leave
139#endif
140
141#ifndef __REACTOS__
142#ifndef InterlockedIncrement64
143#define InterlockedIncrement64(a) __sync_add_and_fetch(a, 1)
144#endif
145#endif // __REACTOS__
146
147#ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING
148#define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
149#endif
150
151#ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME
152#define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400
153#endif
154
155#ifndef FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
156#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
157#endif
158
159#ifndef __REACTOS__
160#ifndef _MSC_VER
161typedef struct _FILE_ID_128 {
164
165#define FILE_CS_FLAG_CASE_SENSITIVE_DIR 1
166#endif
167#else
168typedef struct _FILE_ID_128 {
169 UCHAR Identifier[16];
171
172#define FILE_CS_FLAG_CASE_SENSITIVE_DIR 1
173#endif // __REACTOS__
174
175typedef struct _DUPLICATE_EXTENTS_DATA {
181
182#define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_ACCESS)
183
187 DWORD Flags;
191
195 DWORD Flags;
197
198#define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
199#define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
200
201#ifndef __REACTOS__
202#ifndef _MSC_VER
203#define __drv_aliasesMem
204#define _Dispatch_type_(a)
205#define _Lock_level_order_(a,b)
206#endif
207#endif // __REACTOS__
208
210_Create_lock_level_(fcb_lock)
211_Lock_level_order_(tree_lock, fcb_lock)
212
213#define MAX_HASH_SIZE 32
214
215struct _device_extension;
216
217typedef struct _fcb_nonpaged {
224
225struct _root;
226
227typedef struct {
230 bool unique;
231 bool ignore;
233 void* csum;
234
236
238} extent;
239
240typedef struct {
246} hardlink;
247
248struct _file_ref;
249
250typedef struct {
265} dir_child;
266
273
274typedef struct {
278 bool dirty;
279 char data[1];
280} xattr;
281
282typedef struct _fcb {
288 struct _root* subvol;
313
319
320 bool dirty;
329
330 bool ads;
335
339} fcb;
340
341typedef struct _file_ref {
354
355 bool dirty;
356
360
361typedef struct {
363 struct _ccb* ccb;
364 void* context;
368} send_info;
369
370typedef struct _ccb {
391 bool lxss;
395
396struct _device_extension;
397
398typedef struct {
401 struct _tree* tree;
403
404typedef struct _tree_data {
407 bool ignore;
409
410 union {
412
413 struct {
416 };
417 };
419
420typedef struct {
423
424typedef struct _tree {
431 struct _tree* parent;
433 struct _root* root;
440 bool write;
445
446typedef struct {
449
450typedef struct _root {
452 LONGLONG lastinode; // signed so we can use InterlockedIncrement64
456 bool dirty;
469
484};
485
486typedef struct {
488 void* data;
492} batch_item;
493
494typedef struct {
497 unsigned int num_items;
500
501typedef struct {
505} batch_root;
506
507typedef struct {
511
512typedef struct _root_cache {
516
517typedef struct {
522} space;
523
524typedef struct {
531 bool reloc;
532 bool trim;
535 ULONG disk_num;
536 ULONG part_num;
537 uint64_t stats[5];
543} device;
544
545typedef struct {
550} range_lock;
551
552typedef struct {
560
561typedef struct {
581 bool reloc;
591
594} chunk;
595
596typedef struct {
608
609typedef struct {
611
612 union {
615 };
616
619
620typedef struct {
622 void* data;
625} sys_chunk;
626
638};
639
640typedef struct {
642 void* in;
643 void* out;
644 unsigned int inlen, outlen, off, space_left;
645 LONG left, not_started;
649} calc_job;
650
651typedef struct {
655 unsigned int number;
656 bool quit;
658
659typedef struct {
666
667typedef struct {
668 bool ignore;
686
687#define VCB_TYPE_FS 1
688#define VCB_TYPE_CONTROL 2
689#define VCB_TYPE_VOLUME 3
690#define VCB_TYPE_PDO 4
691#define VCB_TYPE_BUS 5
692
693#define BALANCE_OPTS_DATA 0
694#define BALANCE_OPTS_METADATA 1
695#define BALANCE_OPTS_SYSTEM 2
696
697typedef struct {
702 bool paused;
712
713typedef struct {
718 bool parity;
720
721 union {
722 struct {
728
729 struct {
734 };
736
737typedef struct {
743 bool paused;
754} scrub_info;
755
757
758typedef struct _device_extension {
765#ifdef DEBUG_CHUNK_LOCKS
766 LONG chunk_locks_held;
767#endif
770 unsigned int sector_shift;
771 unsigned int csum_size;
774 bool locked;
778 bool trim;
784 _Has_lock_level_(fcb_lock) ERESOURCE fcb_lock;
787 _Has_lock_level_(tree_lock) ERESOURCE tree_lock;
841
842typedef struct {
845
846typedef struct {
852
853typedef struct {
869
871
882 bool dead;
885
886typedef struct pdo_device_extension {
893
898
901
902typedef struct {
906} uid_map;
907
908typedef struct {
912} gid_map;
913
922
924
925typedef struct {
935
936typedef struct _write_data_context {
944
945typedef struct {
952} tree_write;
953
954typedef struct {
957} name_bit;
958
961static __inline void acquire_fcb_lock_shared(device_extension* Vcb) {
962 ExAcquireResourceSharedLite(&Vcb->fcb_lock, true);
963}
964
967static __inline void acquire_fcb_lock_exclusive(device_extension* Vcb) {
968 ExAcquireResourceExclusiveLite(&Vcb->fcb_lock, true);
969}
970
972_Releases_lock_(Vcb->fcb_lock)
973static __inline void release_fcb_lock(device_extension* Vcb) {
974 ExReleaseResourceLite(&Vcb->fcb_lock);
975}
976
977static __inline void* map_user_buffer(PIRP Irp, ULONG priority) {
978 if (!Irp->MdlAddress) {
979 return Irp->UserBuffer;
980 } else {
981 return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, priority);
982 }
983}
984
986 return (t->seconds * 10000000) + (t->nanoseconds / 100) + 116444736000000000;
987}
988
990 ULONGLONG l = (ULONGLONG)t.QuadPart - 116444736000000000;
991
992 out->seconds = l / 10000000;
993 out->nanoseconds = (uint32_t)((l % 10000000) * 100);
994}
995
996_Post_satisfies_(*stripe>=0&&*stripe<num_stripes)
997static __inline void get_raid0_offset(_In_ uint64_t off, _In_ uint64_t stripe_length, _In_ uint16_t num_stripes, _Out_ uint64_t* stripeoff, _Out_ uint16_t* stripe) {
998 uint64_t initoff, startoff;
999
1000 startoff = off % (num_stripes * stripe_length);
1001 initoff = (off / (num_stripes * stripe_length)) * stripe_length;
1002
1003 *stripe = (uint16_t)(startoff / stripe_length);
1004 *stripeoff = initoff + startoff - (*stripe * stripe_length);
1005}
1006
1007/* We only have 64 bits for a file ID, which isn't technically enough to be
1008 * unique on Btrfs. We fudge it by having three bytes for the subvol and
1009 * five for the inode, which should be good enough.
1010 * Inodes are also 64 bits on Linux, but the Linux driver seems to get round
1011 * this by tricking it into thinking subvols are separate volumes. */
1013 return (r->id << 40) | (inode & 0xffffffffff);
1014}
1015
1016#define keycmp(key1, key2)\
1017 ((key1.obj_id < key2.obj_id) ? -1 :\
1018 ((key1.obj_id > key2.obj_id) ? 1 :\
1019 ((key1.obj_type < key2.obj_type) ? -1 :\
1020 ((key1.obj_type > key2.obj_type) ? 1 :\
1021 ((key1.offset < key2.offset) ? -1 :\
1022 ((key1.offset > key2.offset) ? 1 :\
1023 0))))))
1024
1027 if (n & (a - 1))
1028 n = (n + a) & ~(a - 1);
1029
1030 return n;
1031}
1032
1033__inline static bool is_subvol_readonly(root* r, PIRP Irp) {
1034 if (!(r->root_item.flags & BTRFS_SUBVOL_READONLY))
1035 return false;
1036
1037 if (!r->reserved)
1038 return true;
1039
1040 return (!Irp || Irp->RequestorMode == UserMode) && PsGetCurrentProcess() != r->reserved ? true : false;
1041}
1042
1044 switch (type) {
1046 return sizeof(TREE_BLOCK_REF);
1047
1049 return sizeof(EXTENT_DATA_REF);
1050
1051 case TYPE_EXTENT_REF_V0:
1052 return sizeof(EXTENT_REF_V0);
1053
1055 return sizeof(SHARED_BLOCK_REF);
1056
1058 return sizeof(SHARED_DATA_REF);
1059
1060 default:
1061 return 0;
1062 }
1063}
1064
1066 switch (type) {
1068 return 1;
1069
1071 {
1073 return edr->count;
1074 }
1075
1076 case TYPE_EXTENT_REF_V0:
1077 {
1079 return erv0->count;
1080 }
1081
1083 return 1;
1084
1086 {
1088 return sdr->count;
1089 }
1090
1091 default:
1092 return 0;
1093 }
1094}
1095
1096// in xor-gas.S
1097#if defined(_X86_) || defined(_AMD64_)
1098void __stdcall do_xor_sse2(uint8_t* buf1, uint8_t* buf2, uint32_t len);
1099void __stdcall do_xor_avx2(uint8_t* buf1, uint8_t* buf2, uint32_t len);
1100#endif
1101
1102// in btrfs.c
1105
1107bool get_file_attributes_from_xattr(_In_reads_bytes_(len) char* val, _In_ uint16_t len, _Out_ ULONG* atts);
1108
1110 _In_ uint8_t type, _In_ bool dotfile, _In_ bool ignore_xa, _In_opt_ PIRP Irp);
1111
1113bool get_xattr(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, _In_ root* subvol, _In_ uint64_t inode, _In_z_ char* name, _In_ uint32_t crc32,
1115
1116#ifndef DEBUG_FCB_REFCOUNTS
1117void free_fcb(_Inout_ fcb* fcb);
1118#endif
1119void free_fileref(_Inout_ file_ref* fr);
1123 _Out_ root** rootptr, _In_ bool no_tree, _In_ uint64_t offset, _In_opt_ PIRP Irp);
1126 _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ bool Override, _Out_opt_ IO_STATUS_BLOCK* iosb);
1130
1132
1133extern xor_func do_xor;
1134
1135#ifdef DEBUG_CHUNK_LOCKS
1136#define acquire_chunk_lock(c, Vcb) { ExAcquireResourceExclusiveLite(&c->lock, true); InterlockedIncrement(&Vcb->chunk_locks_held); }
1137#define release_chunk_lock(c, Vcb) { InterlockedDecrement(&Vcb->chunk_locks_held); ExReleaseResourceLite(&c->lock); }
1138#else
1139#define acquire_chunk_lock(c, Vcb) ExAcquireResourceExclusiveLite(&(c)->lock, true)
1140#define release_chunk_lock(c, Vcb) ExReleaseResourceLite(&(c)->lock)
1141#endif
1142
1143void mark_fcb_dirty(_In_ fcb* fcb);
1144void mark_fileref_dirty(_In_ file_ref* fileref);
1148void init_device(_In_ device_extension* Vcb, _Inout_ device* dev, _In_ bool get_nums);
1151 _Out_writes_bytes_(Length) PUCHAR Buffer, _In_ bool override);
1155
1156_Function_class_(DRIVER_ADD_DEVICE)
1158
1159void reap_fcb(fcb* fcb);
1163NTSTATUS utf8_to_utf16(WCHAR* dest, ULONG dest_max, ULONG* dest_len, char* src, ULONG src_len);
1164NTSTATUS utf16_to_utf8(char* dest, ULONG dest_max, ULONG* dest_len, WCHAR* src, ULONG src_len);
1166
1169
1170void do_shutdown(PIRP Irp);
1172
1173#ifdef _MSC_VER
1174#define funcname __FUNCTION__
1175#else
1176#define funcname __func__
1177#endif
1178
1188extern uint32_t mount_no_trim;
1194extern uint32_t no_pnp;
1195
1196#ifndef __GNUC__
1197#define __attribute__(x)
1198#endif
1199
1200#ifdef _DEBUG
1201
1202extern bool log_started;
1204
1205#ifdef DEBUG_LONG_MESSAGES
1206
1207#define MSG(fn, file, line, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, file, line, s, ##__VA_ARGS__) : (void)0
1208
1209#define TRACE(s, ...) MSG(funcname, __FILE__, __LINE__, s, 3, ##__VA_ARGS__)
1210#define WARN(s, ...) MSG(funcname, __FILE__, __LINE__, s, 2, ##__VA_ARGS__)
1211#define FIXME(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1212#define ERR(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1213
1214void _debug_message(_In_ const char* func, _In_ const char* file, _In_ unsigned int line, _In_ char* s, ...) __attribute__((format(printf, 4, 5)));
1215
1216#else
1217
1218#define MSG(fn, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, s, ##__VA_ARGS__) : (void)0
1219
1220#define TRACE(s, ...) MSG(funcname, s, 3, ##__VA_ARGS__)
1221#define WARN(s, ...) MSG(funcname, s, 2, ##__VA_ARGS__)
1222#define FIXME(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1223#define ERR(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1224
1225void _debug_message(_In_ const char* func, _In_ char* s, ...) __attribute__((format(printf, 2, 3)));
1226
1227#endif
1228
1229#else
1230
1231#define TRACE(s, ...) do { } while(0)
1232#define WARN(s, ...) do { } while(0)
1233#define FIXME(s, ...) DbgPrint("Btrfs FIXME : %s : " s, funcname, ##__VA_ARGS__)
1234#define ERR(s, ...) DbgPrint("Btrfs ERR : %s : " s, funcname, ##__VA_ARGS__)
1235
1236#endif
1237
1238#ifdef DEBUG_FCB_REFCOUNTS
1239void _free_fcb(_Inout_ fcb* fcb, _In_ const char* func);
1240#define free_fcb(fcb) _free_fcb(fcb, funcname)
1241#endif
1242
1243// in fastio.c
1245
1246// in sha256.c
1247void calc_sha256(uint8_t* hash, const void* input, size_t len);
1248#define SHA256_HASH_SIZE 32
1249
1250// in blake2b-ref.c
1251void blake2b(void *out, size_t outlen, const void* in, size_t inlen);
1252#define BLAKE2_HASH_SIZE 32
1253
1254typedef struct {
1261
1262typedef struct {
1266
1273
1274typedef struct {
1276 void* ptr;
1279
1280typedef struct {
1285} ea_item;
1286
1287static const char lxuid[] = "$LXUID";
1288static const char lxgid[] = "$LXGID";
1289static const char lxmod[] = "$LXMOD";
1290static const char lxdev[] = "$LXDEV";
1291
1292// in treefuncs.c
1294 _In_ const KEY* searchkey, _In_ bool ignore, _In_opt_ PIRP Irp) __attribute__((nonnull(1,2,3,4)));
1296 uint8_t level, PIRP Irp) __attribute__((nonnull(1,2,3,4)));
1298 traverse_ptr* next_tp, bool ignore, PIRP Irp) __attribute__((nonnull(1,2,3)));
1300 traverse_ptr* prev_tp, PIRP Irp) __attribute__((nonnull(1,2,3)));
1306 _Inout_ traverse_ptr* tp) __attribute__((nonnull(1,2)));
1307void free_tree(tree* t) __attribute__((nonnull(1)));
1315 LIST_ENTRY* batchlist, PIRP Irp) __attribute__((nonnull(1,2)));
1317NTSTATUS skip_to_difference(device_extension* Vcb, traverse_ptr* tp, traverse_ptr* tp2, bool* ended1, bool* ended2) __attribute__((nonnull(1,2,3,4,5)));
1318
1319// in search.c
1321
1322_Function_class_(KSTART_ROUTINE)
1323void __stdcall mountmgr_thread(_In_ void* context);
1324
1325_Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1327
1328void disk_arrival(PUNICODE_STRING devpath);
1329bool volume_arrival(PUNICODE_STRING devpath, bool fve_callback);
1330void volume_removal(PUNICODE_STRING devpath);
1331
1332_Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1334
1336 _In_ volume_child* vc, _In_ bool skip_dev);
1338
1339// in cache.c
1340void init_cache();
1342
1343// in write.c
1346 bool wait, bool deferred_write, bool write_irp, LIST_ENTRY* rollback) __attribute__((nonnull(1,2,4,5,11)));
1353 _In_opt_ PIRP Irp, _In_opt_ chunk* c, _In_ bool file_write, _In_ uint64_t irp_offset, _In_ ULONG priority) __attribute__((nonnull(1,3,5)));
1355 uint64_t irp_offset, ULONG priority) __attribute__((nonnull(1,3)));
1357
1361
1366 _In_ bool file_write, _In_ uint64_t irp_offset) __attribute__((nonnull(1,2,3,9)));
1367
1372 _In_ bool unique, _In_opt_ _When_(return >= 0, __drv_aliasesMem) void* csum, _In_ LIST_ENTRY* rollback) __attribute__((nonnull(1,3,7)));
1373void add_extent(_In_ fcb* fcb, _In_ LIST_ENTRY* prevextle, _In_ __drv_aliasesMem extent* newext) __attribute__((nonnull(1,2,3)));
1374
1375// in dirctrl.c
1376
1379NTSTATUS __stdcall drv_directory_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1380
1383
1384// in security.c
1385
1389
1393
1394void fcb_get_sd(fcb* fcb, struct _fcb* parent, bool look_for_xattr, PIRP Irp);
1395void add_user_mapping(WCHAR* sidstring, ULONG sidstringlength, uint32_t uid);
1396void add_group_mapping(WCHAR* sidstring, ULONG sidstringlength, uint32_t gid);
1400void find_gid(struct _fcb* fcb, struct _fcb* parfcb, PSECURITY_SUBJECT_CONTEXT subjcont);
1401
1402// in fileinfo.c
1403
1407
1410NTSTATUS __stdcall drv_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1411
1415
1419
1420bool has_open_children(file_ref* fileref);
1422NTSTATUS fileref_get_filename(file_ref* fileref, PUNICODE_STRING fn, USHORT* name_offset, ULONG* preqlen);
1427
1428// in reparse.c
1433
1434// in create.c
1435
1439
1441 _In_ PUNICODE_STRING fnus, _In_opt_ file_ref* related, _In_ bool parent, _Out_opt_ USHORT* parsed, _Out_opt_ ULONG* fn_offset, _In_ POOL_TYPE pooltype,
1442 _In_ bool case_sensitive, _In_opt_ PIRP Irp);
1444 root* subvol, uint64_t inode, uint8_t type, PANSI_STRING utf8, bool always_add_hl, fcb* parent, fcb** pfcb, POOL_TYPE pooltype, PIRP Irp);
1446NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, fcb* fcb, bool ignore_size, PIRP Irp);
1449 _In_ file_ref* sf, _In_ PUNICODE_STRING name, _In_ bool case_sensitive, _In_ bool lastpart, _In_ bool streampart,
1450 _In_ POOL_TYPE pooltype, _Out_ file_ref** psf2, _In_opt_ PIRP Irp);
1452NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb* fcb, root** subvol, uint64_t* inode, dir_child** pdc, bool case_sensitive);
1453uint32_t inherit_mode(fcb* parfcb, bool is_dir);
1456
1457// in fsctl.c
1461void flush_subvol_fcbs(root* subvol);
1462bool fcb_is_inline(fcb* fcb);
1464
1465// in flushthread.c
1466
1467_Function_class_(KSTART_ROUTINE)
1468void __stdcall flush_thread(void* context);
1469
1472NTSTATUS flush_fcb(fcb* fcb, bool cache, LIST_ENTRY* batchlist, PIRP Irp);
1476NTSTATUS do_tree_writes(device_extension* Vcb, LIST_ENTRY* tree_writes, bool no_free);
1483
1484// in read.c
1485
1489
1495NTSTATUS do_read(PIRP Irp, bool wait, ULONG* bytes_read);
1497void raid6_recover2(uint8_t* sectors, uint16_t num_stripes, ULONG sector_size, uint16_t missing1, uint16_t missing2, uint8_t* out);
1500void get_sector_csum(device_extension* Vcb, void* buf, void* csum);
1501bool check_sector_csum(device_extension* Vcb, void* buf, void* csum);
1502
1503// in pnp.c
1504
1508
1511
1512// in free-space.c
1523void space_list_merge(LIST_ENTRY* spacelist, LIST_ENTRY* spacelist_size, LIST_ENTRY* deleting);
1525
1526// in extent-tree.c
1529 uint32_t refcount, bool superseded, PIRP Irp);
1537 int32_t count, bool no_csum, bool superseded, PIRP Irp);
1544
1545// in worker-thread.c
1549
1550// in registry.c
1551void read_registry(PUNICODE_STRING regpath, bool refresh);
1555void watch_registry(HANDLE regh);
1556
1557// in compress.c
1559NTSTATUS lzo_decompress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen, uint32_t inpageoff);
1562NTSTATUS zlib_compress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen, unsigned int level, unsigned int* space_left);
1563NTSTATUS lzo_compress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen, unsigned int* space_left);
1564NTSTATUS zstd_compress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen, uint32_t level, unsigned int* space_left);
1565
1566// in galois.c
1572
1573// in devctrl.c
1574
1578
1579// in calcthread.c
1580
1581_Function_class_(KSTART_ROUTINE)
1582void __stdcall calc_thread(void* context);
1583
1586 void* out, unsigned int outlen, unsigned int off, calc_job** pcj);
1588 void* out, unsigned int outlen, calc_job** pcj);
1590
1591// in balance.c
1599
1600_Function_class_(KSTART_ROUTINE)
1601void __stdcall balance_thread(void* context);
1602
1603// in volume.c
1609void add_volume_device(superblock* sb, PUNICODE_STRING devpath, uint64_t length, ULONG disk_num, ULONG part_num);
1611
1612_Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1614
1616
1617// in scrub.c
1623
1624// in send.c
1627
1628// in fsrtl.c
1630
1631// in boot.c
1632void check_system_root();
1634extern BTRFS_UUID boot_uuid;
1635
1636// based on function in sys/sysmacros.h
1637#define makedev(major, minor) (((minor) & 0xFF) | (((major) & 0xFFF) << 8) | (((uint64_t)((minor) & ~0xFF)) << 12) | (((uint64_t)((major) & ~0xFFF)) << 32))
1638
1639#ifndef __REACTOS__
1640// not in mingw yet
1641#ifndef _MSC_VER
1642typedef struct {
1648 union {
1651 };
1654
1655#define FSRTL_FCB_HEADER_V2 2
1656
1657#else
1658#define FSRTL_ADVANCED_FCB_HEADER_NEW FSRTL_ADVANCED_FCB_HEADER
1659#endif
1660#else
1661typedef struct {
1663 PFAST_MUTEX FastMutex;
1664 LIST_ENTRY FilterContexts;
1665 EX_PUSH_LOCK PushLock;
1667 union {
1668 OPLOCK Oplock;
1669 PVOID ReservedForRemote;
1670 };
1671 PVOID ReservedContext;
1673
1674#define FSRTL_FCB_HEADER_V2 2
1675#endif // __REACTOS__
1676
1677static __inline POPLOCK fcb_oplock(fcb* fcb) {
1678 if (fcb->Header.Version >= FSRTL_FCB_HEADER_V2)
1679 return &((FSRTL_ADVANCED_FCB_HEADER_NEW*)&fcb->Header)->Oplock;
1680 else
1681 return &fcb->oplock;
1682}
1683
1686 return FastIoIsNotPossible;
1687
1688 if (!FsRtlAreThereCurrentFileLocks(&fcb->lock) && !fcb->Vcb->readonly)
1689 return FastIoIsPossible;
1690
1691 return FastIoIsQuestionable;
1692}
1693
1694static __inline void print_open_trees(device_extension* Vcb) {
1695 LIST_ENTRY* le = Vcb->trees.Flink;
1696 while (le != &Vcb->trees) {
1698 tree_data* td = CONTAINING_RECORD(t->itemlist.Flink, tree_data, list_entry);
1699 ERR("tree %p: root %I64x, level %u, first key (%I64x,%x,%I64x)\n",
1700 t, t->root->id, t->header.level, td->key.obj_id, td->key.obj_type, td->key.offset);
1701
1702 le = le->Flink;
1703 }
1704}
1705
1706static __inline bool write_fcb_compressed(fcb* fcb) {
1708 return false;
1709
1710 // make sure we don't accidentally write the cache inodes or pagefile compressed
1712 return false;
1713
1714 if (fcb->Vcb->options.compress_force)
1715 return true;
1716
1718 return false;
1719
1720 if (fcb->inode_item.flags & BTRFS_INODE_COMPRESS || fcb->Vcb->options.compress)
1721 return true;
1722
1723 return false;
1724}
1725
1726#ifdef DEBUG_FCB_REFCOUNTS
1727#ifdef DEBUG_LONG_MESSAGES
1728#define increase_fileref_refcount(fileref) {\
1729 LONG rc = InterlockedIncrement(&fileref->refcount);\
1730 MSG(funcname, __FILE__, __LINE__, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1731}
1732#else
1733#define increase_fileref_refcount(fileref) {\
1734 LONG rc = InterlockedIncrement(&fileref->refcount);\
1735 MSG(funcname, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1736}
1737#endif
1738#else
1739#define increase_fileref_refcount(fileref) InterlockedIncrement(&fileref->refcount)
1740#endif
1741
1742#ifdef _MSC_VER
1743#define int3 __debugbreak()
1744#else
1745#define int3 asm("int3;")
1746#endif
1747
1748#define hex_digit(c) ((c) <= 9) ? ((c) + '0') : ((c) - 10 + 'a')
1749
1750// FIXME - find a way to catch unfreed trees again
1751
1752// from sys/stat.h
1753#define __S_IFMT 0170000 /* These bits determine file type. */
1754#define __S_IFDIR 0040000 /* Directory. */
1755#define __S_IFCHR 0020000 /* Character device. */
1756#define __S_IFBLK 0060000 /* Block device. */
1757#define __S_IFREG 0100000 /* Regular file. */
1758#define __S_IFIFO 0010000 /* FIFO. */
1759#define __S_IFLNK 0120000 /* Symbolic link. */
1760#define __S_IFSOCK 0140000 /* Socket. */
1761#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
1762
1763#ifndef S_ISDIR
1764#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
1765#endif
1766
1767#ifndef S_IRUSR
1768#define S_IRUSR 0000400
1769#endif
1770
1771#ifndef S_IWUSR
1772#define S_IWUSR 0000200
1773#endif
1774
1775#ifndef S_IXUSR
1776#define S_IXUSR 0000100
1777#endif
1778
1779#ifdef __REACTOS__
1780#define S_IFDIR __S_IFDIR
1781#define S_IFREG __S_IFREG
1782#endif /* __REACTOS__ */
1783
1784#ifndef S_IRGRP
1785#define S_IRGRP (S_IRUSR >> 3)
1786#endif
1787
1788#ifndef S_IWGRP
1789#define S_IWGRP (S_IWUSR >> 3)
1790#endif
1791
1792#ifndef S_IXGRP
1793#define S_IXGRP (S_IXUSR >> 3)
1794#endif
1795
1796#ifndef S_IROTH
1797#define S_IROTH (S_IRGRP >> 3)
1798#endif
1799
1800#ifndef S_IWOTH
1801#define S_IWOTH (S_IWGRP >> 3)
1802#endif
1803
1804#ifndef S_IXOTH
1805#define S_IXOTH (S_IXGRP >> 3)
1806#endif
1807
1808#ifndef S_ISUID
1809#define S_ISUID 0004000
1810#endif
1811
1812#ifndef S_ISGID
1813#define S_ISGID 0002000
1814#endif
1815
1816#ifndef S_ISVTX
1817#define S_ISVTX 0001000
1818#endif
1819
1820// based on functions in sys/sysmacros.h
1821#define major(rdev) ((((rdev) >> 8) & 0xFFF) | ((uint32_t)((rdev) >> 32) & ~0xFFF))
1822#define minor(rdev) (((rdev) & 0xFF) | ((uint32_t)((rdev) >> 12) & ~0xFF))
1823
1824static __inline uint64_t fcb_alloc_size(fcb* fcb) {
1826 return 0;
1828 return fcb->inode_item.st_blocks;
1829 else
1830 return sector_align(fcb->inode_item.st_size, fcb->Vcb->superblock.sector_size);
1831}
1832
1834
1836 ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount);
1837
1839 PVOID Buffer, PETHREAD IoIssuerThread);
1840
1842 PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread);
1843
1844#ifndef CC_ENABLE_DISK_IO_ACCOUNTING
1845#define CC_ENABLE_DISK_IO_ACCOUNTING 0x00000010
1846#endif
1847
1848#if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1849typedef struct _ECP_LIST ECP_LIST;
1850typedef struct _ECP_LIST *PECP_LIST;
1851#endif
1852
1854
1856
1858
1860
1863
1865
1867
1869
1870#ifndef __REACTOS__
1871#ifndef _MSC_VER
1873#endif
1874
1875// not in DDK headers - taken from winternl.h
1885 union {
1888 };
1891
1892typedef struct _PEB_LDR_DATA {
1897
1904
1906
1907typedef struct _PEB {
1921#endif /* __REACTOS__ */
1922
1923#ifdef _MSC_VER
1927 IN PROCESSINFOCLASS ProcessInformationClass,
1928 OUT PVOID ProcessInformation,
1929 IN ULONG ProcessInformationLength,
1931);
1932#endif
unsigned char BOOLEAN
_STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y)
Definition: _cstdlib.h:137
#define VOID
Definition: acefi.h:82
unsigned short int uint16_t
Definition: acefiex.h:54
static int inbuf
Definition: adnsresfilter.c:73
LONG NTSTATUS
Definition: precomp.h:26
static __inline uint32_t get_extent_data_refcount(uint8_t type, void *data)
Definition: btrfs_drv.h:1065
xor_func do_xor
Definition: btrfs.c:127
void void void NTSTATUS void NTSTATUS skip_to_difference(device_extension *Vcb, traverse_ptr *tp, traverse_ptr *tp2, bool *ended1, bool *ended2) __attribute__((nonnull(1
NTSTATUS __stdcall compat_FsRtlValidateReparsePointBuffer(IN ULONG BufferLength, IN PREPARSE_DATA_BUFFER ReparseBuffer)
Definition: fsrtl.c:32
NTSTATUS load_stored_free_space_cache(device_extension *Vcb, chunk *c, bool load_only, PIRP Irp)
Definition: free-space.c:466
void mark_fcb_dirty(_In_ fcb *fcb)
Definition: btrfs.c:1695
NTSTATUS read_file(fcb *fcb, uint8_t *data, uint64_t start, uint64_t length, ULONG *pbr, PIRP Irp) __attribute__((nonnull(1
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER
NTSTATUS(__stdcall * tFsRtlValidateReparsePointBuffer)(ULONG BufferLength, PREPARSE_DATA_BUFFER ReparseBuffer)
Definition: btrfs_drv.h:1864
void do_shutdown(PIRP Irp)
Definition: btrfs.c:5392
uint8_t gdiv(uint8_t a, uint8_t b)
Definition: galois.c:80
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:77
batch_operation
Definition: btrfs_drv.h:470
@ Batch_InodeExtRef
Definition: btrfs_drv.h:483
@ Batch_DeleteExtentData
Definition: btrfs_drv.h:477
@ Batch_DeleteDirItem
Definition: btrfs_drv.h:473
@ Batch_DeleteXattr
Definition: btrfs_drv.h:476
@ Batch_SetXattr
Definition: btrfs_drv.h:480
@ Batch_DeleteFreeSpace
Definition: btrfs_drv.h:478
@ Batch_InodeRef
Definition: btrfs_drv.h:482
@ Batch_DeleteInode
Definition: btrfs_drv.h:472
@ Batch_DeleteInodeRef
Definition: btrfs_drv.h:474
@ Batch_Insert
Definition: btrfs_drv.h:479
@ Batch_DeleteInodeExtRef
Definition: btrfs_drv.h:475
@ Batch_DirItem
Definition: btrfs_drv.h:481
@ Batch_Delete
Definition: btrfs_drv.h:471
NTSTATUS registry_load_volume_options(device_extension *Vcb)
Definition: registry.c:36
void reap_filerefs(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1906
NTSTATUS write_file(device_extension *Vcb, PIRP Irp, bool wait, bool deferred_write) __attribute__((nonnull(1
void log_device_error(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ int error)
Definition: btrfs.c:5914
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
Definition: btrfs_drv.h:1365
_Post_satisfies_ static stripe __inline void get_raid0_offset(_In_ uint64_t off, _In_ uint64_t stripe_length, _In_ uint16_t num_stripes, _Out_ uint64_t *stripeoff, _Out_ uint16_t *stripe)
Definition: btrfs_drv.h:997
uint64_t get_extent_refcount(device_extension *Vcb, uint64_t address, uint64_t size, PIRP Irp)
Definition: extent-tree.c:1651
static __inline FAST_IO_POSSIBLE fast_io_possible(fcb *fcb)
Definition: btrfs_drv.h:1684
CACHE_MANAGER_CALLBACKS cache_callbacks
Definition: cache.c:20
NTSTATUS zlib_compress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen, unsigned int level, unsigned int *space_left)
Definition: compress.c:336
uint32_t mount_readonly
Definition: btrfs.c:84
NTSTATUS get_device_pnp_name(_In_ PDEVICE_OBJECT DeviceObject, _Out_ PUNICODE_STRING pnp_name, _Out_ const GUID **guid)
Definition: btrfs.c:4233
bool add_thread_job(device_extension *Vcb, PIRP Irp)
NTSTATUS delete_fileref(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_ bool make_orphan, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
Definition: btrfs.c:2270
void free_fileref(_Inout_ file_ref *fr)
Definition: btrfs.c:1856
VOID(NTAPI * PPS_POST_PROCESS_INIT_ROUTINE)(VOID)
Definition: btrfs_drv.h:1905
NTSTATUS stop_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3440
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER
static __inline void print_open_trees(device_extension *Vcb)
Definition: btrfs_drv.h:1694
uint64_t find_extent_shared_tree_refcount(device_extension *Vcb, uint64_t address, uint64_t parent, PIRP Irp)
Definition: extent-tree.c:2119
NTSTATUS query_balance(device_extension *Vcb, void *data, ULONG length)
Definition: balance.c:3711
uint8_t gmul(uint8_t a, uint8_t b)
Definition: galois.c:73
struct _file_ref file_ref
struct _root root
NTSTATUS flush_fcb(fcb *fcb, bool cache, LIST_ENTRY *batchlist, PIRP Irp)
Definition: flushthread.c:4924
void add_user_mapping(WCHAR *sidstring, ULONG sidstringlength, uint32_t uid)
Definition: security.c:56
_In_ uint64_t a
Definition: btrfs_drv.h:1026
void do_calc_job(device_extension *Vcb, uint8_t *data, uint32_t sectors, void *csum)
Definition: calcthread.c:141
void disk_arrival(PUNICODE_STRING devpath)
Definition: search.c:460
NTSTATUS(__stdcall * tIoUnregisterPlugPlayNotificationEx)(PVOID NotificationEntry)
Definition: btrfs_drv.h:1857
void void free_trees_root(device_extension *Vcb, root *r) __attribute__((nonnull(1
void add_trim_entry_avoid_sb(device_extension *Vcb, device *dev, uint64_t address, uint64_t size)
Definition: flushthread.c:5507
NTSTATUS resume_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3765
NTSTATUS pause_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3401
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void * data
Definition: btrfs_drv.h:1365
NTSTATUS zlib_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen)
Definition: compress.c:377
void galois_double(uint8_t *data, uint32_t len)
Definition: galois.c:109
NTSTATUS load_cache_chunk(device_extension *Vcb, chunk *c, PIRP Irp)
Definition: free-space.c:980
NTSTATUS NTSTATUS write_file2(device_extension *Vcb, PIRP Irp, LARGE_INTEGER offset, void *buf, ULONG *length, bool paging_io, bool no_cache, bool wait, bool deferred_write, bool write_irp, LIST_ENTRY *rollback) __attribute__((nonnull(1
struct _PEB * PPEB
NTSTATUS alloc_chunk(device_extension *Vcb, uint64_t flags, chunk **pc, bool full_size) __attribute__((nonnull(1
void chunk_lock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
Definition: btrfs.c:5844
void add_group_mapping(WCHAR *sidstring, ULONG sidstringlength, uint32_t gid)
Definition: security.c:145
NTSTATUS check_csum(device_extension *Vcb, uint8_t *data, uint32_t sectors, void *csum)
Definition: read.c:87
NTSTATUS NTSTATUS NTSTATUS NTSTATUS NTSTATUS excise_extents(device_extension *Vcb, fcb *fcb, uint64_t start_data, uint64_t end_data, PIRP Irp, LIST_ENTRY *rollback) __attribute__((nonnull(1
NTSTATUS send_subvol(device_extension *Vcb, void *data, ULONG datalen, PFILE_OBJECT FileObject, PIRP Irp)
Definition: send.c:3593
NTSTATUS zstd_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen)
Definition: compress.c:676
uint32_t mount_max_inline
Definition: btrfs.c:78
void void void add_rollback(_In_ LIST_ENTRY *rollback, _In_ enum rollback_type type, _In_ __drv_aliasesMem void *ptr) __attribute__((nonnull(1
#define S_ISDIR(mode)
Definition: btrfs_drv.h:1764
void raid6_recover2(uint8_t *sectors, uint16_t num_stripes, ULONG sector_size, uint16_t missing1, uint16_t missing2, uint8_t *out)
Definition: read.c:918
void blake2b(void *out, size_t outlen, const void *in, size_t inlen)
Definition: blake2b-ref.c:237
void space_list_add2(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t address, uint64_t length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1446
void reap_fileref(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1875
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:204
NTSTATUS add_space_entry(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t offset, uint64_t size)
Definition: free-space.c:190
BOOLEAN(__stdcall * tPsIsDiskCountersEnabled)()
Definition: btrfs_drv.h:1833
uint64_t get_extent_flags(device_extension *Vcb, uint64_t address, PIRP Irp)
Definition: extent-tree.c:1835
static const char lxgid[]
Definition: btrfs_drv.h:1288
void void void NTSTATUS void NTSTATUS NTSTATUS remove_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
Definition: search.c:407
NTSTATUS create_root(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ uint64_t id, _Out_ root **rootptr, _In_ bool no_tree, _In_ uint64_t offset, _In_opt_ PIRP Irp)
Definition: btrfs.c:1271
void void void NTSTATUS commit_batch_list(_Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp) __attribute__((nonnull(1
NTSTATUS utf16_to_utf8(char *dest, ULONG dest_max, ULONG *dest_len, WCHAR *src, ULONG src_len)
Definition: btrfs.c:894
struct _RTL_USER_PROCESS_PARAMETERS RTL_USER_PROCESS_PARAMETERS
struct _LDR_DATA_TABLE_ENTRY * PLDR_DATA_TABLE_ENTRY
uint32_t sid_to_uid(PSID sid)
Definition: security.c:310
NTSTATUS bool find_data_address_in_chunk(device_extension *Vcb, chunk *c, uint64_t length, uint64_t *address) __attribute__((nonnull(1
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER FSCTL_GET_INTEGRITY_INFORMATION_BUFFER
NTSTATUS get_reparse_point(PFILE_OBJECT FileObject, void *buffer, DWORD buflen, ULONG_PTR *retlen)
Definition: reparse.c:27
static __inline uint64_t unix_time_to_win(BTRFS_TIME *t)
Definition: btrfs_drv.h:985
static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME *out)
Definition: btrfs_drv.h:989
uint32_t inherit_mode(fcb *parfcb, bool is_dir)
Definition: create.c:1948
NTSTATUS lzo_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen, uint32_t inpageoff)
Definition: compress.c:278
void(__stdcall * xor_func)(uint8_t *buf1, uint8_t *buf2, uint32_t len)
Definition: btrfs_drv.h:1131
void flush_subvol_fcbs(root *subvol)
Definition: fsctl.c:243
NTSTATUS registry_mark_volume_unmounted(BTRFS_UUID *uuid)
Definition: registry.c:385
struct _fcb fcb
Definition: btrfs_drv.h:1364
NTSTATUS update_dev_item(device_extension *Vcb, device *device, PIRP Irp)
Definition: flushthread.c:4093
void chunk_unlock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
Definition: btrfs.c:5891
return n
Definition: btrfs_drv.h:1030
uint32_t mount_no_trim
Definition: btrfs.c:81
NTSTATUS mountmgr_add_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
Definition: volume.c:832
struct _RTL_USER_PROCESS_PARAMETERS * PRTL_USER_PROCESS_PARAMETERS
struct _fcb_nonpaged fcb_nonpaged
NTSTATUS uid_to_sid(uint32_t uid, PSID *sid)
Definition: security.c:229
#define __drv_aliasesMem
Definition: btrfs_drv.h:203
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool prealloc
Definition: btrfs_drv.h:1364
uint32_t mount_compress
Definition: btrfs.c:72
NTSTATUS add_calc_job_comp(device_extension *Vcb, uint8_t compression, void *in, unsigned int inlen, void *out, unsigned int outlen, calc_job **pcj)
Definition: calcthread.c:237
KSPIN_LOCK fve_data_lock
Definition: search.c:63
void fcb_get_sd(fcb *fcb, struct _fcb *parent, bool look_for_xattr, PIRP Irp)
Definition: security.c:511
#define ERR(s,...)
Definition: btrfs_drv.h:1234
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t decoded_size
Definition: btrfs_drv.h:1365
NTSTATUS do_write_file(fcb *fcb, uint64_t start_data, uint64_t end_data, void *data, PIRP Irp, bool file_write, uint32_t irp_offset, LIST_ENTRY *rollback) __attribute__((nonnull(1
void free_fcb(_Inout_ fcb *fcb)
Definition: btrfs.c:1734
NTSTATUS do_write_job(device_extension *Vcb, PIRP Irp)
Definition: worker-thread.c:68
NTSTATUS increase_extent_refcount_data(device_extension *Vcb, uint64_t address, uint64_t size, uint64_t root, uint64_t inode, uint64_t offset, uint32_t refcount, PIRP Irp)
Definition: extent-tree.c:892
NTSTATUS NTSTATUS NTSTATUS void free_write_data_stripes(write_data_context *wtc) __attribute__((nonnull(1)))
BTRFS_UUID boot_uuid
Definition: boot.c:33
ULONG get_reparse_tag_fcb(fcb *fcb)
Definition: dirctrl.c:83
uint64_t get_extent_data_ref_hash2(uint64_t root, uint64_t objid, uint64_t offset)
Definition: extent-tree.c:35
void space_list_subtract2(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t address, uint64_t length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:2155
VOID(__stdcall * tCcSetAdditionalCacheAttributesEx)(PFILE_OBJECT FileObject, ULONG Flags)
Definition: btrfs_drv.h:1853
uint32_t mount_allow_degraded
Definition: btrfs.c:83
NTSTATUS NTSTATUS void free_tree(tree *t) __attribute__((nonnull(1)))
BOOLEAN(__stdcall * tFsRtlCheckLockForOplockRequest)(PFILE_LOCK FileLock, PLARGE_INTEGER AllocationSize)
Definition: btrfs_drv.h:1866
void init_cache()
Definition: cache.c:85
uint32_t mount_skip_balance
Definition: btrfs.c:79
NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
Definition: btrfs.c:3876
write_data_status
Definition: btrfs_drv.h:914
@ WriteDataStatus_Pending
Definition: btrfs_drv.h:915
@ WriteDataStatus_Ignore
Definition: btrfs_drv.h:920
@ WriteDataStatus_Cancelled
Definition: btrfs_drv.h:919
@ WriteDataStatus_Error
Definition: btrfs_drv.h:917
@ WriteDataStatus_Cancelling
Definition: btrfs_drv.h:918
@ WriteDataStatus_Success
Definition: btrfs_drv.h:916
void mark_fileref_dirty(_In_ file_ref *fileref)
Definition: btrfs.c:1717
NTSTATUS stream_set_end_of_file_information(device_extension *Vcb, uint16_t end, fcb *fcb, file_ref *fileref, bool advance_only)
Definition: fileinfo.c:3170
NTSTATUS do_read_job(PIRP Irp)
Definition: worker-thread.c:26
uint32_t find_extent_shared_data_refcount(device_extension *Vcb, uint64_t address, uint64_t parent, PIRP Irp)
Definition: extent-tree.c:2220
uint32_t mount_zlib_level
Definition: btrfs.c:75
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
NTSTATUS open_fileref_child(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusive_lock_held_(_Curr_->fcb_lock) _In_ device_extension *Vcb, _In_ file_ref *sf, _In_ PUNICODE_STRING name, _In_ bool case_sensitive, _In_ bool lastpart, _In_ bool streampart, _In_ POOL_TYPE pooltype, _Out_ file_ref **psf2, _In_opt_ PIRP Irp)
Definition: create.c:1459
NTSTATUS NTSTATUS read_stream(fcb *fcb, uint8_t *data, uint64_t start, ULONG length, ULONG *pbr) __attribute__((nonnull(1
NTSTATUS query_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode, void *data, ULONG length)
Definition: scrub.c:3301
NTSTATUS pause_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3749
VOID(__stdcall * tFsRtlUpdateDiskCounters)(ULONG64 BytesRead, ULONG64 BytesWritten)
Definition: btrfs_drv.h:1855
ULONG get_file_attributes(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ uint64_t inode, _In_ uint8_t type, _In_ bool dotfile, _In_ bool ignore_xa, _In_opt_ PIRP Irp)
Definition: btrfs.c:2664
static __inline uint64_t make_file_id(root *r, uint64_t inode)
Definition: btrfs_drv.h:1012
NTSTATUS open_fileref(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusive_lock_held_(_Curr_->fcb_lock) _In_ device_extension *Vcb, _Out_ file_ref **pfr, _In_ PUNICODE_STRING fnus, _In_opt_ file_ref *related, _In_ bool parent, _Out_opt_ USHORT *parsed, _Out_opt_ ULONG *fn_offset, _In_ POOL_TYPE pooltype, _In_ bool case_sensitive, _In_opt_ PIRP Irp)
Definition: create.c:1690
NTSTATUS add_calc_job_decomp(device_extension *Vcb, uint8_t compression, void *in, unsigned int inlen, void *out, unsigned int outlen, unsigned int off, calc_job **pcj)
Definition: calcthread.c:183
#define _Lock_level_order_(a, b)
Definition: btrfs_drv.h:205
NTSTATUS vol_read(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:144
NTSTATUS update_chunk_caches(device_extension *Vcb, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:2043
NTSTATUS flush_partial_stripe(device_extension *Vcb, chunk *c, partial_stripe *ps)
Definition: flushthread.c:5958
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1365
uint32_t mount_zstd_level
Definition: btrfs.c:76
_In_ fcb _In_ chunk _In_ uint64_t start_data
Definition: btrfs_drv.h:1364
NTSTATUS set_reparse_point(PIRP Irp)
Definition: reparse.c:409
struct _write_data_context write_data_context
bool has_open_children(file_ref *fileref)
Definition: fileinfo.c:442
NTSTATUS pnp_query_remove_device(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:23
NTSTATUS vol_close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:95
calc_thread_type
Definition: btrfs_drv.h:627
@ calc_thread_comp_lzo
Definition: btrfs_drv.h:636
@ calc_thread_sha256
Definition: btrfs_drv.h:630
@ calc_thread_decomp_zlib
Definition: btrfs_drv.h:632
@ calc_thread_crc32c
Definition: btrfs_drv.h:628
@ calc_thread_blake2
Definition: btrfs_drv.h:631
@ calc_thread_xxhash
Definition: btrfs_drv.h:629
@ calc_thread_decomp_zstd
Definition: btrfs_drv.h:634
@ calc_thread_comp_zstd
Definition: btrfs_drv.h:637
@ calc_thread_comp_zlib
Definition: btrfs_drv.h:635
@ calc_thread_decomp_lzo
Definition: btrfs_drv.h:633
void add_changed_extent_ref(chunk *c, uint64_t address, uint64_t size, uint64_t root, uint64_t objid, uint64_t offset, uint32_t count, bool no_csum)
Definition: extent-tree.c:2076
NTSTATUS load_csum(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, void *csum, uint64_t start, uint64_t length, PIRP Irp)
Definition: create.c:453
NTSTATUS decrease_extent_refcount_tree(device_extension *Vcb, uint64_t address, uint64_t size, uint64_t root, uint8_t level, PIRP Irp)
Definition: extent-tree.c:1560
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:278
void remove_fcb_from_subvol(_In_ _Requires_exclusive_lock_held_(_Curr_->Vcb->fcb_lock) fcb *fcb)
Definition: fileinfo.c:937
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7877
uint32_t mount_nodatacow
Definition: btrfs.c:86
bool check_sector_csum(device_extension *Vcb, void *buf, void *csum)
Definition: read.c:202
uint32_t mount_compress_type
Definition: btrfs.c:74
static const char lxdev[]
Definition: btrfs_drv.h:1290
void init_fast_io_dispatch(FAST_IO_DISPATCH **fiod)
Definition: fastio.c:535
struct _volume_device_extension volume_device_extension
void boot_add_device(DEVICE_OBJECT *pdo)
Definition: boot.c:318
static __inline POPLOCK fcb_oplock(fcb *fcb)
Definition: btrfs_drv.h:1677
NTSTATUS remove_device(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3799
struct _tree tree
bool check_superblock_checksum(superblock *sb)
Definition: btrfs.c:2825
NTSTATUS NTSTATUS NTSTATUS NTSTATUS NTSTATUS chunk * get_chunk_from_address(device_extension *Vcb, uint64_t address) __attribute__((nonnull(1)))
NTSTATUS NTSTATUS NTSTATUS NTSTATUS extend_file(fcb *fcb, file_ref *fileref, uint64_t end, bool prealloc, PIRP Irp, LIST_ENTRY *rollback) __attribute__((nonnull(1
void free_vol(volume_device_extension *vde)
Definition: volume.c:50
NTSTATUS stop_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3784
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback) __attribute__((nonnull(1
void find_gid(struct _fcb *fcb, struct _fcb *parfcb, PSECURITY_SUBJECT_CONTEXT subjcont)
Definition: security.c:924
VOID(__stdcall * tPsUpdateDiskCounters)(PEPROCESS Process, ULONG64 BytesRead, ULONG64 BytesWritten, ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount)
Definition: btrfs_drv.h:1835
NTSTATUS start_balance(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3511
NTSTATUS load_tree(device_extension *Vcb, uint64_t addr, uint8_t *buf, root *r, tree **pt) __attribute__((nonnull(1
_In_ uint16_t _Out_ ULONG * atts
Definition: btrfs_drv.h:1107
NTSTATUS(__stdcall * tFsRtlGetEcpListFromIrp)(PIRP Irp, PECP_LIST *EcpList)
Definition: btrfs_drv.h:1859
void galois_divpower(uint8_t *data, uint8_t div, uint32_t readlen)
Definition: galois.c:55
void watch_registry(HANDLE regh)
Definition: registry.c:1036
void void void NTSTATUS void clear_batch_list(device_extension *Vcb, LIST_ENTRY *batchlist) __attribute__((nonnull(1
void queue_notification_fcb(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
Definition: btrfs.c:1667
NTSTATUS increase_extent_refcount(device_extension *Vcb, uint64_t address, uint64_t size, uint8_t type, void *data, KEY *firstitem, uint8_t level, PIRP Irp)
Definition: extent-tree.c:454
void check_system_root()
Definition: boot.c:336
rollback_type
Definition: btrfs_drv.h:1267
@ ROLLBACK_DELETE_EXTENT
Definition: btrfs_drv.h:1269
@ ROLLBACK_ADD_SPACE
Definition: btrfs_drv.h:1270
@ ROLLBACK_SUBTRACT_SPACE
Definition: btrfs_drv.h:1271
@ ROLLBACK_INSERT_EXTENT
Definition: btrfs_drv.h:1268
NTSTATUS NTSTATUS NTSTATUS truncate_file(fcb *fcb, uint64_t end, PIRP Irp, LIST_ENTRY *rollback) __attribute__((nonnull(1
uint32_t mount_no_root_dir
Definition: btrfs.c:85
NTSTATUS dismount_volume(device_extension *Vcb, bool shutdown, PIRP Irp)
Definition: fsctl.c:2584
NTSTATUS write_compressed(fcb *fcb, uint64_t start_data, uint64_t end_data, void *data, PIRP Irp, LIST_ENTRY *rollback)
Definition: compress.c:875
uint32_t mount_flush_interval
Definition: btrfs.c:77
#define __attribute__(x)
Definition: btrfs_drv.h:1197
NTSTATUS clear_free_space_cache(device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp)
Definition: free-space.c:59
NTSTATUS write_data_phys(_In_ PDEVICE_OBJECT device, _In_ PFILE_OBJECT fileobj, _In_ uint64_t address, _In_reads_bytes_(length) void *data, _In_ uint32_t length)
Definition: flushthread.c:70
NTSTATUS update_chunk_caches_tree(device_extension *Vcb, PIRP Irp)
Definition: free-space.c:2113
NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, uint64_t inode, file_ref **pfr, PIRP Irp)
Definition: create.c:4136
NTSTATUS set_reparse_point2(fcb *fcb, REPARSE_DATA_BUFFER *rdb, ULONG buflen, ccb *ccb, file_ref *fileref, PIRP Irp, LIST_ENTRY *rollback)
Definition: reparse.c:307
NTSTATUS NTSTATUS bool bool find_prev_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, const traverse_ptr *tp, traverse_ptr *prev_tp, PIRP Irp) __attribute__((nonnull(1
NTSTATUS NTSTATUS do_load_tree(device_extension *Vcb, tree_holder *th, root *r, tree *t, tree_data *td, PIRP Irp) __attribute__((nonnull(1
BOOLEAN(__stdcall * tFsRtlAreThereCurrentOrInProgressFileLocks)(PFILE_LOCK FileLock)
Definition: btrfs_drv.h:1868
void space_list_add(chunk *c, uint64_t address, uint64_t length, LIST_ENTRY *rollback)
Definition: free-space.c:2146
_Ret_maybenull_ root * find_default_subvol(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
Definition: btrfs.c:3981
struct _PEB_LDR_DATA * PPEB_LDR_DATA
NTSTATUS bool void NTSTATUS add_extent_to_fcb(_In_ fcb *fcb, _In_ uint64_t offset, _In_reads_bytes_(edsize) EXTENT_DATA *ed, _In_ uint16_t edsize, _In_ bool unique, _In_opt_ _When_(return >=0, __drv_aliasesMem) void *csum, _In_ LIST_ENTRY *rollback) __attribute__((nonnull(1
NTSTATUS(__stdcall * tFsRtlGetNextExtraCreateParameter)(PECP_LIST EcpList, PVOID CurrentEcpContext, LPGUID NextEcpType, PVOID *NextEcpContext, ULONG *NextEcpContextSize)
Definition: btrfs_drv.h:1861
NTSTATUS NTSTATUS NTSTATUS write_data_complete(device_extension *Vcb, uint64_t address, void *data, uint32_t length, PIRP Irp, chunk *c, bool file_write, uint64_t irp_offset, ULONG priority) __attribute__((nonnull(1
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
NTSTATUS open_fcb(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, uint64_t inode, uint8_t type, PANSI_STRING utf8, bool always_add_hl, fcb *parent, fcb **pfcb, POOL_TYPE pooltype, PIRP Irp)
Definition: create.c:706
void init_device(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ bool get_nums)
Definition: btrfs.c:3416
NTSTATUS read_send_buffer(device_extension *Vcb, PFILE_OBJECT FileObject, void *data, ULONG datalen, ULONG_PTR *retlen, KPROCESSOR_MODE processor_mode)
Definition: send.c:3839
void calc_sha256(uint8_t *hash, const void *input, size_t len)
Definition: sha256.c:126
void volume_removal(PUNICODE_STRING devpath)
Definition: search.c:795
NTSTATUS NTSTATUS bool bool void free_trees(device_extension *Vcb) __attribute__((nonnull(1)))
_In_ uint16_t len
Definition: btrfs_drv.h:1107
static const char lxmod[]
Definition: btrfs_drv.h:1289
void update_extent_flags(device_extension *Vcb, uint64_t address, uint64_t flags, PIRP Irp)
Definition: extent-tree.c:1876
NTSTATUS sync_read_phys(_In_ PDEVICE_OBJECT DeviceObject, _In_ PFILE_OBJECT FileObject, _In_ uint64_t StartingOffset, _In_ ULONG Length, _Out_writes_bytes_(Length) PUCHAR Buffer, _In_ bool override)
Definition: btrfs.c:2732
static const char lxuid[]
Definition: btrfs_drv.h:1287
struct _tree_data tree_data
void trim_whole_device(device *dev)
Definition: fsctl.c:2716
NTSTATUS vol_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:755
uint8_t gpow2(uint8_t e)
Definition: galois.c:69
struct _device_extension device_extension
struct _FILE_ID_128 * PFILE_ID_128
struct _ccb ccb
uint32_t no_pnp
Definition: btrfs.c:87
void add_fcb_to_subvol(_In_ _Requires_exclusive_lock_held_(_Curr_->Vcb->fcb_lock) fcb *fcb)
Definition: fileinfo.c:888
void protect_superblocks(_Inout_ chunk *c)
Definition: btrfs.c:3777
NTSTATUS check_file_name_valid(_In_ PUNICODE_STRING us, _In_ bool posix, _In_ bool stream)
Definition: btrfs.c:5797
void init_file_cache(_In_ PFILE_OBJECT FileObject, _In_ CC_FILE_SIZES *ccfs)
Definition: btrfs.c:4069
BOOLEAN(__stdcall * tCcCopyWriteEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PETHREAD IoIssuerThread)
Definition: btrfs_drv.h:1838
NTSTATUS decrease_extent_refcount(device_extension *Vcb, uint64_t address, uint64_t size, uint8_t type, void *data, KEY *firstitem, uint8_t level, uint64_t parent, bool superseded, PIRP Irp)
Definition: extent-tree.c:903
NTSTATUS lzo_compress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen, unsigned int *space_left)
Definition: compress.c:727
NTSTATUS find_item(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _Out_ traverse_ptr *tp, _In_ const KEY *searchkey, _In_ bool ignore, _In_opt_ PIRP Irp) __attribute__((nonnull(1
NTSTATUS delete_reparse_point(PIRP Irp)
Definition: reparse.c:482
NTSTATUS insert_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ uint64_t obj_id, _In_ uint8_t obj_type, _In_ uint64_t offset, _In_reads_bytes_opt_(size) _When_(return >=0, __drv_aliasesMem) void *data, _In_ uint16_t size, _Out_opt_ traverse_ptr *ptp, _In_opt_ PIRP Irp) __attribute__((nonnull(1
NTSTATUS bool void NTSTATUS void add_extent(_In_ fcb *fcb, _In_ LIST_ENTRY *prevextle, _In_ __drv_aliasesMem extent *newext) __attribute__((nonnull(1
void get_sector_csum(device_extension *Vcb, void *buf, void *csum)
Definition: read.c:182
void remove_volume_child(_Inout_ _Requires_exclusive_lock_held_(_Curr_->child_lock) _Releases_exclusive_lock_(_Curr_->child_lock) _In_ volume_device_extension *vde, _In_ volume_child *vc, _In_ bool skip_dev)
Definition: search.c:531
uint32_t mount_no_barrier
Definition: btrfs.c:80
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:2001
void calc_tree_checksum(device_extension *Vcb, tree_header *th)
Definition: flushthread.c:1806
void read_registry(PUNICODE_STRING regpath, bool refresh)
Definition: registry.c:777
bool fcb_is_inline(fcb *fcb)
Definition: fsctl.c:3246
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP Irp
Definition: btrfs_drv.h:1365
bool is_extent_unique(device_extension *Vcb, uint64_t address, uint64_t size, PIRP Irp)
Definition: extent-tree.c:1697
NTSTATUS NTSTATUS void clear_rollback(LIST_ENTRY *rollback) __attribute__((nonnull(1)))
NTSTATUS registry_mark_volume_mounted(BTRFS_UUID *uuid)
Definition: registry.c:242
bool volume_arrival(PUNICODE_STRING devpath, bool fve_callback)
Definition: search.c:693
struct _FILE_ID_128 FILE_ID_128
NTSTATUS fileref_get_filename(file_ref *fileref, PUNICODE_STRING fn, USHORT *name_offset, ULONG *preqlen)
Definition: fileinfo.c:4245
NTSTATUS do_tree_writes(device_extension *Vcb, LIST_ENTRY *tree_writes, bool no_free)
Definition: flushthread.c:1620
NTSTATUS start_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3260
void do_unlock_volume(device_extension *Vcb)
Definition: fsctl.c:2326
struct _DUPLICATE_EXTENTS_DATA DUPLICATE_EXTENTS_DATA
NTSTATUS look_for_balance_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb)
Definition: balance.c:3628
NTSTATUS update_changed_extent_ref(device_extension *Vcb, chunk *c, uint64_t address, uint64_t size, uint64_t root, uint64_t objid, uint64_t offset, int32_t count, bool no_csum, bool superseded, PIRP Irp)
Definition: extent-tree.c:1951
void space_list_merge(LIST_ENTRY *spacelist, LIST_ENTRY *spacelist_size, LIST_ENTRY *deleting)
Definition: free-space.c:1657
struct _DUPLICATE_EXTENTS_DATA * PDUPLICATE_EXTENTS_DATA
bool check_tree_checksum(device_extension *Vcb, tree_header *th)
Definition: read.c:128
NTSTATUS get_tree_new_address(device_extension *Vcb, tree *t, PIRP Irp, LIST_ENTRY *rollback)
Definition: flushthread.c:878
void send_notification_fileref(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
Definition: btrfs.c:1517
void insert_dir_child_into_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:1470
uint32_t mount_compress_force
Definition: btrfs.c:73
NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP *Pirp, uint32_t type)
Definition: fsctl.c:5345
#define FSRTL_FCB_HEADER_V2
Definition: btrfs_drv.h:1655
static __inline uint16_t get_extent_data_len(uint8_t type)
Definition: btrfs_drv.h:1043
void reap_fcbs(device_extension *Vcb)
Definition: btrfs.c:1841
NTSTATUS dev_ioctl(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG ControlCode, _In_reads_bytes_opt_(InputBufferSize) PVOID InputBuffer, _In_ ULONG InputBufferSize, _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ bool Override, _Out_opt_ IO_STATUS_BLOCK *iosb)
Definition: btrfs.c:2954
NTSTATUS allocate_cache(device_extension *Vcb, bool *changed, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1382
void calc_thread_main(device_extension *Vcb, calc_job *cj)
Definition: calcthread.c:22
fcb * create_fcb(device_extension *Vcb, POOL_TYPE pool_type)
Definition: create.c:91
BOOLEAN(__stdcall * tCcCopyReadEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread)
Definition: btrfs_drv.h:1841
NTSTATUS NTSTATUS bool find_next_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, const traverse_ptr *tp, traverse_ptr *next_tp, bool ignore, PIRP Irp) __attribute__((nonnull(1
struct _root_cache root_cache
NTSTATUS vol_write(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:225
bool find_metadata_address_in_chunk(device_extension *Vcb, chunk *c, uint64_t *address)
Definition: flushthread.c:744
NTSTATUS utf8_to_utf16(WCHAR *dest, ULONG dest_max, ULONG *dest_len, char *src, ULONG src_len)
Definition: btrfs.c:811
void get_tree_checksum(device_extension *Vcb, tree_header *th, void *csum)
Definition: read.c:108
ULONG get_reparse_tag(device_extension *Vcb, root *subvol, uint64_t inode, uint8_t type, ULONG atts, bool lxss, PIRP Irp)
Definition: dirctrl.c:107
NTSTATUS NTSTATUS NTSTATUS do_read(PIRP Irp, bool wait, ULONG *bytes_read)
Definition: read.c:3328
NTSTATUS fcb_get_new_sd(fcb *fcb, file_ref *parfileref, ACCESS_STATE *as)
Definition: security.c:988
NTSTATUS add_dir_child(fcb *fcb, uint64_t inode, bool subvol, PANSI_STRING utf8, PUNICODE_STRING name, uint8_t type, dir_child **pdc)
Definition: create.c:1871
prop_compression_type
Definition: btrfs_drv.h:267
@ PropCompression_None
Definition: btrfs_drv.h:268
@ PropCompression_LZO
Definition: btrfs_drv.h:270
@ PropCompression_Zlib
Definition: btrfs_drv.h:269
@ PropCompression_ZSTD
Definition: btrfs_drv.h:271
uint32_t mount_clear_cache
Definition: btrfs.c:82
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER FSCTL_SET_INTEGRITY_INFORMATION_BUFFER
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
file_ref * create_fileref(device_extension *Vcb)
Definition: create.c:160
struct _PEB PEB
NTSTATUS NTSTATUS delete_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _Inout_ traverse_ptr *tp) __attribute__((nonnull(1
static __inline void * map_user_buffer(PIRP Irp, ULONG priority)
Definition: btrfs_drv.h:977
void space_list_subtract(chunk *c, uint64_t address, uint64_t length, LIST_ENTRY *rollback)
Definition: free-space.c:2234
void remove_dir_child_from_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:744
static __inline uint64_t fcb_alloc_size(fcb *fcb)
Definition: btrfs_drv.h:1824
NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb *fcb, root **subvol, uint64_t *inode, dir_child **pdc, bool case_sensitive)
Definition: create.c:182
uint32_t get_num_of_processors()
Definition: btrfs.c:4080
void reap_fcb(fcb *fcb)
Definition: btrfs.c:1743
struct _PEB_LDR_DATA PEB_LDR_DATA
NTSTATUS decrease_extent_refcount_data(device_extension *Vcb, uint64_t address, uint64_t size, uint64_t root, uint64_t inode, uint64_t offset, uint32_t refcount, bool superseded, PIRP Irp)
Definition: extent-tree.c:1548
NTSTATUS vol_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:36
NTSTATUS bool void get_raid56_lock_range(chunk *c, uint64_t address, uint64_t length, uint64_t *lockaddr, uint64_t *locklen) __attribute__((nonnull(1
static __inline bool is_subvol_readonly(root *r, PIRP Irp)
Definition: btrfs_drv.h:1033
bool is_tree_unique(device_extension *Vcb, tree *t, PIRP Irp)
Definition: flushthread.c:3243
NTSTATUS resume_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3422
void add_checksum_entry(device_extension *Vcb, uint64_t address, ULONG length, void *csum, PIRP Irp)
Definition: flushthread.c:2602
NTSTATUS NTSTATUS find_item_to_level(device_extension *Vcb, root *r, traverse_ptr *tp, const KEY *searchkey, bool ignore, uint8_t level, PIRP Irp) __attribute__((nonnull(1
NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, fcb *fcb, bool ignore_size, PIRP Irp)
Definition: create.c:510
_Ret_maybenull_ device * find_device_from_uuid(_In_ device_extension *Vcb, _In_ BTRFS_UUID *uuid)
Definition: btrfs.c:3299
void add_volume_device(superblock *sb, PUNICODE_STRING devpath, uint64_t length, ULONG disk_num, ULONG part_num)
Definition: volume.c:1077
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t _In_ bool file_write
Definition: btrfs_drv.h:1366
static __inline bool write_fcb_compressed(fcb *fcb)
Definition: btrfs_drv.h:1706
NTSTATUS zstd_compress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen, uint32_t level, unsigned int *space_left)
Definition: compress.c:805
r l[0]
Definition: byte_order.h:167
return
Definition: dirsup.c:529
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:291
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
FT_UInt sid
Definition: cffcmap.c:139
Definition: bufpool.h:45
Definition: Header.h:9
Definition: list.h:37
#define _Releases_exclusive_lock_(lock)
#define _Requires_lock_held_(lock)
#define _Acquires_exclusive_lock_(lock)
#define _Acquires_shared_lock_(lock)
#define _Requires_lock_not_held_(lock)
#define _Create_lock_level_(level)
#define _Releases_lock_(lock)
#define _Requires_exclusive_lock_held_(lock)
static uint64_t __inline sector_align(uint64_t n, uint64_t a)
_In_ PIRP Irp
Definition: csq.h:116
INT32 int32_t
Definition: types.h:71
UINT32 uint32_t
Definition: types.h:75
UINT64 uint64_t
Definition: types.h:77
#define NTSTATUS
Definition: precomp.h:20
static WCHAR superseded[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1817
#define crc32(crc, buf, len)
Definition: inflate.c:1081
const WCHAR * action
Definition: action.c:7479
#define pt(x, y)
Definition: drawing.c:79
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
superblock * sb
Definition: btrfs.c:4261
r parent
Definition: btrfs.c:3010
bool log_started
Definition: btrfs.c:88
_In_ uint64_t _In_ uint64_t _In_ uint64_t generation
Definition: btrfs.c:2996
uint32_t debug_log_level
Definition: btrfs.c:71
#define TYPE_EXTENT_DATA_REF
Definition: btrfs.h:38
#define BTRFS_SUBVOL_READONLY
Definition: btrfs.h:109
#define TYPE_SHARED_BLOCK_REF
Definition: btrfs.h:40
#define TYPE_SHARED_DATA_REF
Definition: btrfs.h:41
#define TYPE_TREE_BLOCK_REF
Definition: btrfs.h:37
#define BTRFS_ROOT_ROOT
Definition: btrfs.h:54
#define TYPE_EXTENT_REF_V0
Definition: btrfs.h:39
bool insert_extent_chunk(_In_ device_extension *Vcb, _In_ fcb *fcb, _In_ chunk *c, _In_ uint64_t start_data, _In_ uint64_t length, _In_ bool prealloc, _In_opt_ void *data, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback, _In_ uint8_t compression, _In_ uint64_t decoded_size, _In_ bool file_write, _In_ uint64_t irp_offset)
Definition: write.c:2824
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:322
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_In_ PECP_LIST _In_opt_ PVOID CurrentEcpContext
Definition: fltkernel.h:2621
_In_ PECP_LIST _In_opt_ PVOID _Out_opt_ LPGUID _Outptr_opt_ PVOID * NextEcpContext
Definition: fltkernel.h:2623
_In_ PECP_LIST _In_opt_ PVOID _Out_opt_ LPGUID NextEcpType
Definition: fltkernel.h:2622
_Must_inspect_result_ _In_ FSRTL_ALLOCATE_ECPLIST_FLAGS _Outptr_ PECP_LIST * EcpList
Definition: fltkernel.h:2511
_In_ PECP_LIST _In_opt_ PVOID _Out_opt_ LPGUID _Outptr_opt_ PVOID _Out_opt_ ULONG * NextEcpContextSize
Definition: fltkernel.h:2624
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define printf
Definition: freeldr.h:94
localAdvHdr FileContextSupportPointer
Definition: fsrtlfuncs.h:1704
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
struct _ECP_LIST * PECP_LIST
Definition: fsrtltypes.h:139
@ FastIoIsQuestionable
Definition: fsrtltypes.h:242
@ FastIoIsNotPossible
Definition: fsrtltypes.h:240
@ FastIoIsPossible
Definition: fsrtltypes.h:241
enum _FAST_IO_POSSIBLE FAST_IO_POSSIBLE
#define FSRTL_FLAG2_IS_PAGING_FILE
Definition: fsrtltypes.h:57
GLuint start
Definition: gl.h:1545
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLsizeiptr size
Definition: glext.h:5919
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
GLuint address
Definition: glext.h:9393
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum const GLvoid * addr
Definition: glext.h:9621
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLenum GLenum GLenum input
Definition: glext.h:9031
GLintptr offset
Definition: glext.h:5920
enum _PROCESSINFOCLASS PROCESSINFOCLASS
Definition: loader.c:63
Definition: msctf.idl:511
#define C_ASSERT(e)
Definition: intsafe.h:73
const char * filename
Definition: ioapi.h:137
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031
#define e
Definition: ke_i.h:82
static const WCHAR dc[]
const GUID * guid
__u8 sector_size[2]
Definition: mkdosfs.c:3
__u8 sectors[2]
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
unsigned __int64 ULONG64
Definition: imports.h:198
static PVOID ptr
Definition: dispmode.c:27
static const BYTE us[]
Definition: encode.c:689
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
static char * dest
Definition: rtl.c:135
static int priority
Definition: timer.c:163
#define _Function_class_(x)
Definition: ms_sal.h:2946
#define _Out_opt_
Definition: ms_sal.h:346
#define _Success_(expr)
Definition: ms_sal.h:259
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
#define _Inout_
Definition: ms_sal.h:378
#define _Out_writes_bytes_(size)
Definition: ms_sal.h:350
#define _Ret_maybenull_
Definition: ms_sal.h:529
#define _In_z_
Definition: ms_sal.h:313
#define _Out_
Definition: ms_sal.h:345
#define _When_(expr, annos)
Definition: ms_sal.h:254
#define _In_
Definition: ms_sal.h:308
#define _In_reads_bytes_opt_(size)
Definition: ms_sal.h:322
#define _In_opt_
Definition: ms_sal.h:309
#define _Post_satisfies_(cond)
Definition: ms_sal.h:588
#define _Out_writes_bytes_opt_(size)
Definition: ms_sal.h:351
BYTE uint8_t
Definition: msvideo1.c:66
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define UserMode
Definition: asm.h:35
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define uint16_t
Definition: nsiface.idl:60
#define bool
Definition: nsiface.idl:72
ULONG ACCESS_MASK
Definition: nt_native.h:40
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1564
#define true
Definition: osdep.h:36
DRIVER_ADD_DEVICE AddDevice
Definition: parport.h:72
#define BOOLEAN
Definition: pedump.c:73
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define Vcb
Definition: cdprocs.h:1415
#define BTRFS_INODE_NOCOMPRESS
Definition: propsheet.h:79
#define BTRFS_INODE_COMPRESS
Definition: propsheet.h:87
#define BTRFS_INODE_NODATACOW
Definition: propsheet.h:77
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
static FILE * out
Definition: regtests2xml.c:44
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
Definition: sockctrl.c:506
#define __kernel_entry
Definition: specstrings.h:355
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
uint32_t count
Definition: btrfs.h:420
uint32_t count
Definition: btrfs.h:433
FSRTL_COMMON_FCB_HEADER Header
Definition: btrfs_drv.h:1643
uint32_t st_mode
Definition: btrfs.h:295
uint32_t flags
Definition: btrfs.h:297
uint64_t st_size
Definition: btrfs.h:289
uint64_t st_blocks
Definition: btrfs.h:290
Definition: btrfs.h:143
uint8_t obj_type
Definition: btrfs.h:145
uint64_t obj_id
Definition: btrfs.h:144
uint64_t offset
Definition: btrfs.h:146
uint32_t count
Definition: btrfs.h:442
LARGE_INTEGER ByteCount
Definition: shellext.h:202
LARGE_INTEGER SourceFileOffset
Definition: shellext.h:200
LARGE_INTEGER TargetFileOffset
Definition: shellext.h:201
UCHAR Identifier[16]
Definition: btrfs_drv.h:162
Definition: btrfs_drv.h:1876
BYTE Reserved4[8]
Definition: btrfs_drv.h:1883
PVOID Reserved1[2]
Definition: btrfs_drv.h:1877
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
PVOID DllBase
Definition: btrfs_drv.h:1880
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1878
ULONG TimeDateStamp
Definition: btrfs_drv.h:1889
PVOID Reserved3[2]
Definition: btrfs_drv.h:1881
PVOID Reserved5[3]
Definition: btrfs_drv.h:1884
PVOID Reserved6
Definition: btrfs_drv.h:1887
PVOID Reserved2[2]
Definition: btrfs_drv.h:1879
ULONG CheckSum
Definition: btrfs_drv.h:1886
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
BYTE Reserved1[8]
Definition: btrfs_drv.h:1893
PVOID Reserved2[3]
Definition: btrfs_drv.h:1894
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1895
PVOID Reserved5[52]
Definition: btrfs_drv.h:1915
PVOID Reserved3[2]
Definition: btrfs_drv.h:1911
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1912
BYTE Reserved6[128]
Definition: btrfs_drv.h:1917
PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine
Definition: btrfs_drv.h:1916
ULONG SessionId
Definition: btrfs_drv.h:1919
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
BYTE Reserved2[1]
Definition: btrfs_drv.h:1910
BYTE Reserved1[2]
Definition: btrfs_drv.h:1908
BYTE Reserved4[104]
Definition: btrfs_drv.h:1914
BYTE BeingDebugged
Definition: btrfs_drv.h:1909
PVOID Reserved7[1]
Definition: btrfs_drv.h:1918
UNICODE_STRING CommandLine
Definition: btrfs_drv.h:1902
UNICODE_STRING ImagePathName
Definition: btrfs_drv.h:1901
Definition: iotypes.h:189
CSHORT NodeSize
Definition: btrfs_drv.h:372
bool reserving
Definition: btrfs_drv.h:381
NTSTATUS send_status
Definition: btrfs_drv.h:393
bool user_set_change_time
Definition: btrfs_drv.h:390
bool user_set_access_time
Definition: btrfs_drv.h:388
bool lxss
Definition: btrfs_drv.h:391
ULONG disposition
Definition: btrfs_drv.h:373
bool manage_volume_privilege
Definition: btrfs_drv.h:379
send_info * send
Definition: btrfs_drv.h:392
uint64_t query_dir_offset
Definition: btrfs_drv.h:375
bool allow_extended_dasd_io
Definition: btrfs_drv.h:380
ACCESS_MASK access
Definition: btrfs_drv.h:382
bool user_set_write_time
Definition: btrfs_drv.h:389
bool user_set_creation_time
Definition: btrfs_drv.h:387
UNICODE_STRING query_string
Definition: btrfs_drv.h:376
USHORT NodeType
Definition: btrfs_drv.h:371
UNICODE_STRING filename
Definition: btrfs_drv.h:384
bool specific_file
Definition: btrfs_drv.h:378
file_ref * fileref
Definition: btrfs_drv.h:383
ULONG ea_index
Definition: btrfs_drv.h:385
bool case_sensitive
Definition: btrfs_drv.h:386
bool has_wildcard
Definition: btrfs_drv.h:377
ULONG options
Definition: btrfs_drv.h:374
LIST_ENTRY * trees_ptrs[256]
Definition: btrfs_drv.h:811
PNOTIFY_SYNC NotifySync
Definition: btrfs_drv.h:788
root * checksum_root
Definition: btrfs_drv.h:800
ERESOURCE dirty_subvols_lock
Definition: btrfs_drv.h:819
drv_calc_threads calcthreads
Definition: btrfs_drv.h:824
LIST_ENTRY DirNotifyList
Definition: btrfs_drv.h:789
ERESOURCE load_lock
Definition: btrfs_drv.h:786
LIST_ENTRY devices
Definition: btrfs_drv.h:764
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:762
LIST_ENTRY all_fcbs
Definition: btrfs_drv.h:813
LIST_ENTRY roots
Definition: btrfs_drv.h:795
bool chunk_usage_found
Definition: btrfs_drv.h:806
mount_options options
Definition: btrfs_drv.h:760
LIST_ENTRY drop_roots
Definition: btrfs_drv.h:796
ERESOURCE chunk_lock
Definition: btrfs_drv.h:820
scrub_info scrub
Definition: btrfs_drv.h:826
uint64_t system_flags
Definition: btrfs_drv.h:794
NPAGED_LOOKASIDE_LIST fcb_np_lookaside
Definition: btrfs_drv.h:838
PAGED_LOOKASIDE_LIST name_bit_lookaside
Definition: btrfs_drv.h:836
PAGED_LOOKASIDE_LIST fileref_lookaside
Definition: btrfs_drv.h:834
ERESOURCE fileref_lock
Definition: btrfs_drv.h:785
LIST_ENTRY dirty_fcbs
Definition: btrfs_drv.h:814
bool log_to_phys_loaded
Definition: btrfs_drv.h:805
LIST_ENTRY sys_chunks
Definition: btrfs_drv.h:807
superblock superblock
Definition: btrfs_drv.h:769
KEVENT flush_thread_finished
Definition: btrfs_drv.h:823
unsigned int sector_shift
Definition: btrfs_drv.h:770
uint64_t data_flags
Definition: btrfs_drv.h:792
LIST_ENTRY list_entry
Definition: btrfs_drv.h:839
KTIMER flush_thread_timer
Definition: btrfs_drv.h:822
root * extent_root
Definition: btrfs_drv.h:799
_Has_lock_level_(tree_lock) ERESOURCE tree_lock
LIST_ENTRY trees
Definition: btrfs_drv.h:809
LIST_ENTRY dirty_subvols
Definition: btrfs_drv.h:818
PFILE_OBJECT locked_fileobj
Definition: btrfs_drv.h:779
ERESOURCE dirty_filerefs_lock
Definition: btrfs_drv.h:817
PAGED_LOOKASIDE_LIST tree_data_lookaside
Definition: btrfs_drv.h:831
balance_info balance
Definition: btrfs_drv.h:825
FAST_MUTEX trees_list_mutex
Definition: btrfs_drv.h:812
PAGED_LOOKASIDE_LIST fcb_lookaside
Definition: btrfs_drv.h:835
PAGED_LOOKASIDE_LIST traverse_ptr_lookaside
Definition: btrfs_drv.h:832
LIST_ENTRY dirty_filerefs
Definition: btrfs_drv.h:816
ERESOURCE send_load_lock
Definition: btrfs_drv.h:827
bool lock_paused_balance
Definition: btrfs_drv.h:775
uint64_t metadata_flags
Definition: btrfs_drv.h:793
root * data_reloc_root
Definition: btrfs_drv.h:803
bool disallow_dismount
Definition: btrfs_drv.h:776
_Has_lock_level_(fcb_lock) ERESOURCE fcb_lock
NPAGED_LOOKASIDE_LIST range_lock_lookaside
Definition: btrfs_drv.h:837
LIST_ENTRY trees_hash
Definition: btrfs_drv.h:810
HANDLE flush_thread_handle
Definition: btrfs_drv.h:821
LIST_ENTRY chunks
Definition: btrfs_drv.h:808
LIST_ENTRY send_ops
Definition: btrfs_drv.h:829
ERESOURCE dirty_fcbs_lock
Definition: btrfs_drv.h:815
PFILE_OBJECT root_file
Definition: btrfs_drv.h:830
PAGED_LOOKASIDE_LIST batch_item_lookaside
Definition: btrfs_drv.h:833
file_ref * root_fileref
Definition: btrfs_drv.h:782
struct _volume_device_extension * vde
Definition: btrfs_drv.h:763
unsigned int csum_size
Definition: btrfs_drv.h:771
uint64_t devices_loaded
Definition: btrfs_drv.h:768
ERESOURCE resource
Definition: btrfs_drv.h:220
FAST_MUTEX HeaderMutex
Definition: btrfs_drv.h:218
ERESOURCE dir_children_lock
Definition: btrfs_drv.h:222
SECTION_OBJECT_POINTERS segment_object
Definition: btrfs_drv.h:219
ERESOURCE paging_resource
Definition: btrfs_drv.h:221
bool ads
Definition: btrfs_drv.h:330
bool marked_as_orphan
Definition: btrfs_drv.h:309
LIST_ENTRY list_entry_all
Definition: btrfs_drv.h:337
ULONG ealen
Definition: btrfs_drv.h:303
LIST_ENTRY xattrs
Definition: btrfs_drv.h:308
LIST_ENTRY hardlinks
Definition: btrfs_drv.h:304
bool case_sensitive_set
Definition: btrfs_drv.h:311
FILE_LOCK lock
Definition: btrfs_drv.h:294
LIST_ENTRY dir_children_index
Definition: btrfs_drv.h:314
ULONG atts
Definition: btrfs_drv.h:297
bool atts_deleted
Definition: btrfs_drv.h:322
bool sd_dirty
Definition: btrfs_drv.h:321
bool deleted
Definition: btrfs_drv.h:295
POOL_TYPE pool_type
Definition: btrfs_drv.h:286
struct _file_ref * fileref
Definition: btrfs_drv.h:305
LIST_ENTRY extents
Definition: btrfs_drv.h:300
uint64_t inode
Definition: btrfs_drv.h:289
SECURITY_DESCRIPTOR * sd
Definition: btrfs_drv.h:293
bool case_sensitive
Definition: btrfs_drv.h:310
bool csum_loaded
Definition: btrfs_drv.h:299
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:296
ANSI_STRING adsdata
Definition: btrfs_drv.h:334
ANSI_STRING adsxattr
Definition: btrfs_drv.h:333
INODE_ITEM inode_item
Definition: btrfs_drv.h:292
bool created
Definition: btrfs_drv.h:328
LIST_ENTRY dir_children_hash
Definition: btrfs_drv.h:315
LIST_ENTRY ** hash_ptrs_uc
Definition: btrfs_drv.h:318
uint8_t type
Definition: btrfs_drv.h:291
bool dirty
Definition: btrfs_drv.h:320
struct _device_extension * Vcb
Definition: btrfs_drv.h:287
LIST_ENTRY dir_children_hash_uc
Definition: btrfs_drv.h:316
OPLOCK oplock
Definition: btrfs_drv.h:312
struct _root * subvol
Definition: btrfs_drv.h:288
ULONG adsmaxlen
Definition: btrfs_drv.h:332
LIST_ENTRY list_entry
Definition: btrfs_drv.h:336
ANSI_STRING reparse_xattr
Definition: btrfs_drv.h:301
LIST_ENTRY ** hash_ptrs
Definition: btrfs_drv.h:317
bool xattrs_changed
Definition: btrfs_drv.h:327
uint32_t hash
Definition: btrfs_drv.h:290
bool sd_deleted
Definition: btrfs_drv.h:321
uint32_t adshash
Definition: btrfs_drv.h:331
bool reparse_xattr_changed
Definition: btrfs_drv.h:324
LONG refcount
Definition: btrfs_drv.h:285
bool extents_changed
Definition: btrfs_drv.h:323
bool atts_changed
Definition: btrfs_drv.h:322
enum prop_compression_type prop_compression
Definition: btrfs_drv.h:307
bool ea_changed
Definition: btrfs_drv.h:325
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:338
struct _fcb_nonpaged * nonpaged
Definition: btrfs_drv.h:284
SHARE_ACCESS share_access
Definition: btrfs_drv.h:298
ANSI_STRING ea_xattr
Definition: btrfs_drv.h:302
bool prop_compression_changed
Definition: btrfs_drv.h:326
bool inode_item_changed
Definition: btrfs_drv.h:306
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:283
bool deleted
Definition: btrfs_drv.h:347
LONG refcount
Definition: btrfs_drv.h:350
struct _file_ref * parent
Definition: btrfs_drv.h:352
fcb * fcb
Definition: btrfs_drv.h:342
dir_child * dc
Definition: btrfs_drv.h:353
bool dirty
Definition: btrfs_drv.h:355
bool posix_delete
Definition: btrfs_drv.h:346
uint64_t oldindex
Definition: btrfs_drv.h:344
LIST_ENTRY list_entry
Definition: btrfs_drv.h:357
LIST_ENTRY children
Definition: btrfs_drv.h:349
LONG open_count
Definition: btrfs_drv.h:351
bool delete_on_close
Definition: btrfs_drv.h:345
ANSI_STRING oldutf8
Definition: