ReactOS  0.4.12-dev-708-g95ed44e
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 #ifndef BTRFS_DRV_H_DEFINED
19 #define BTRFS_DRV_H_DEFINED
20 
21 #ifndef __REACTOS__
22 #undef _WIN32_WINNT
23 #undef NTDDI_VERSION
24 
25 #define _WIN32_WINNT 0x0601
26 #define NTDDI_VERSION 0x06020000 // Win 8
27 #define _CRT_SECURE_NO_WARNINGS
28 #define _NO_CRT_STDIO_INLINE
29 #endif /* __REACTOS__ */
30 
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable:4163)
34 #pragma warning(disable:4311)
35 #pragma warning(disable:4312)
36 #else
37 #pragma GCC diagnostic push
38 #pragma GCC diagnostic ignored "-Wsign-compare"
39 #pragma GCC diagnostic ignored "-Wsign-conversion"
40 #endif
41 
42 #include <ntifs.h>
43 #include <ntddk.h>
44 #ifdef __REACTOS__
45 #include <ntdddisk.h>
46 #endif /* __REACTOS__ */
47 #include <mountmgr.h>
48 #ifdef __REACTOS__
49 #include <rtlfuncs.h>
50 #include <iotypes.h>
51 #include <pseh/pseh2.h>
52 #endif /* __REACTOS__ */
53 #include <windef.h>
54 #include <wdm.h>
55 
56 #ifdef _MSC_VER
57 #pragma warning(pop)
58 #else
59 #pragma GCC diagnostic pop
60 #endif
61 
62 #include <stdio.h>
63 #include <stdarg.h>
64 #include <stddef.h>
65 #ifndef __REACTOS__
66 // Not actually used
67 #include <emmintrin.h>
68 #endif /* __REACTOS__ */
69 #include "btrfs.h"
70 #include "btrfsioctl.h"
71 
72 #ifdef _DEBUG
73 // #define DEBUG_FCB_REFCOUNTS
74 // #define DEBUG_LONG_MESSAGES
75 // #define DEBUG_FLUSH_TIMES
76 // #define DEBUG_STATS
77 // #define DEBUG_CHUNK_LOCKS
78 #define DEBUG_PARANOID
79 #endif
80 
81 #define UNUSED(x) (void)(x)
82 
83 #define BTRFS_NODE_TYPE_CCB 0x2295
84 #define BTRFS_NODE_TYPE_FCB 0x2296
85 
86 #define ALLOC_TAG 0x7442484D //'MHBt'
87 #define ALLOC_TAG_ZLIB 0x7A42484D //'MHBz'
88 
89 #define UID_NOBODY 65534
90 #define GID_NOBODY 65534
91 
92 #define EA_NTACL "security.NTACL"
93 #define EA_NTACL_HASH 0x45922146
94 
95 #define EA_DOSATTRIB "user.DOSATTRIB"
96 #define EA_DOSATTRIB_HASH 0x914f9939
97 
98 #define EA_REPARSE "user.reparse"
99 #define EA_REPARSE_HASH 0xfabad1fe
100 
101 #define EA_EA "user.EA"
102 #define EA_EA_HASH 0x8270dd43
103 
104 #define EA_PROP_COMPRESSION "btrfs.compression"
105 #define EA_PROP_COMPRESSION_HASH 0x20ccdf69
106 
107 #define MAX_EXTENT_SIZE 0x8000000 // 128 MB
108 #define COMPRESSED_EXTENT_SIZE 0x20000 // 128 KB
109 
110 #define READ_AHEAD_GRANULARITY COMPRESSED_EXTENT_SIZE // really ought to be a multiple of COMPRESSED_EXTENT_SIZE
111 
112 #define IO_REPARSE_TAG_LXSS_SYMLINK 0xa000001d // undocumented?
113 
114 #define IO_REPARSE_TAG_LXSS_SOCKET 0x80000023
115 #define IO_REPARSE_TAG_LXSS_FIFO 0x80000024
116 #define IO_REPARSE_TAG_LXSS_CHARDEV 0x80000025
117 #define IO_REPARSE_TAG_LXSS_BLOCKDEV 0x80000026
118 
119 #define BTRFS_VOLUME_PREFIX L"\\Device\\Btrfs{"
120 
121 #ifdef _MSC_VER
122 #define try __try
123 #define except __except
124 #define finally __finally
125 #else
126 #define try if (1)
127 #define except(x) if (0 && (x))
128 #define finally if (1)
129 #endif
130 
131 #ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING
132 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
133 #endif
134 
135 #ifndef FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
136 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
137 #endif
138 
139 typedef struct _DUPLICATE_EXTENTS_DATA {
145 
146 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_ACCESS)
147 
150  WORD Reserved;
151  DWORD Flags;
155 
158  WORD Reserved;
159  DWORD Flags;
161 
162 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
163 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
164 
165 #ifndef __REACTOS__
166 #ifndef _MSC_VER
167 #define __drv_aliasesMem
168 #define _Requires_lock_held_(a)
169 #define _Requires_exclusive_lock_held_(a)
170 #define _Releases_lock_(a)
171 #define _Out_writes_bytes_opt_(a)
172 #define _Pre_satisfies_(a)
173 #define _Post_satisfies_(a)
174 #define _Releases_exclusive_lock_(a)
175 #define _Dispatch_type_(a)
176 #define _Create_lock_level_(a)
177 #define _Lock_level_order_(a,b)
178 #define _Has_lock_level_(a)
179 #define _Requires_lock_not_held_(a)
180 #define _Acquires_exclusive_lock_(a)
181 #define _Acquires_shared_lock_(a)
182 #endif
183 #endif
184 
185 _Create_lock_level_(tree_lock)
186 _Create_lock_level_(fcb_lock)
187 _Lock_level_order_(tree_lock, fcb_lock)
188 
189 struct _device_extension;
190 
191 typedef struct _fcb_nonpaged {
197 } fcb_nonpaged;
198 
199 struct _root;
200 
201 typedef struct {
208 
210 
212 } extent;
213 
214 typedef struct {
220 } hardlink;
221 
222 struct _file_ref;
223 
224 typedef struct {
238 } dir_child;
239 
245 };
246 
247 typedef struct {
252  char data[1];
253 } xattr;
254 
255 typedef struct _fcb {
261  struct _root* subvol;
282 
288 
298 
304 
308 } fcb;
309 
310 typedef struct {
314 
315 typedef struct _file_ref {
326  struct _file_ref* parent;
329 
331 
334 } file_ref;
335 
336 typedef struct {
338  struct _ccb* ccb;
339  void* context;
343 } send_info;
344 
345 typedef struct _ccb {
369 } ccb;
370 
371 struct _device_extension;
372 
373 typedef struct {
376  struct _tree* tree;
377 } tree_holder;
378 
379 typedef struct _tree_data {
384 
385  union {
387 
388  struct {
391  };
392  };
393 } tree_data;
394 
395 typedef struct _tree {
401  struct _tree* parent;
403  struct _root* root;
414 } tree;
415 
416 typedef struct {
418 } root_nonpaged;
419 
420 typedef struct _root {
422  LONGLONG lastinode; // signed so we can use InterlockedIncrement64
434 } root;
435 
450 };
451 
452 typedef struct {
454  void* data;
456  enum batch_operation operation;
458 } batch_item;
459 
460 typedef struct {
461  root* r;
464 } batch_root;
465 
466 typedef struct {
469 } traverse_ptr;
470 
471 typedef struct _root_cache {
473  struct _root_cache* next;
474 } root_cache;
475 
476 typedef struct {
481 } space;
482 
483 typedef struct {
493  ULONG disk_num;
494  ULONG part_num;
495  UINT64 stats[5];
501 } device;
502 
503 typedef struct {
508 } range_lock;
509 
510 typedef struct {
517 
518 typedef struct {
548 
551 } chunk;
552 
553 typedef struct {
565 
566 typedef struct {
568 
569  union {
572  };
573 
576 
577 typedef struct {
579  void* data;
582 } sys_chunk;
583 
584 typedef struct {
588  LONG pos, done;
592 } calc_job;
593 
594 typedef struct {
600 
601 typedef struct {
608 
609 typedef struct {
625 } mount_options;
626 
627 #define VCB_TYPE_FS 1
628 #define VCB_TYPE_CONTROL 2
629 #define VCB_TYPE_VOLUME 3
630 #define VCB_TYPE_PDO 4
631 
632 #ifdef DEBUG_STATS
633 typedef struct {
635  UINT64 data_read;
636  UINT64 read_total_time;
637  UINT64 read_csum_time;
638  UINT64 read_disk_time;
639 
640  UINT64 num_opens;
641  UINT64 open_total_time;
642  UINT64 num_overwrites;
643  UINT64 overwrite_total_time;
644  UINT64 num_creates;
645  UINT64 create_total_time;
646  UINT64 open_fcb_calls;
647  UINT64 open_fcb_time;
648  UINT64 open_fileref_child_calls;
649  UINT64 open_fileref_child_time;
650  UINT64 fcb_lock_time;
651 } debug_stats;
652 #endif
653 
654 #define BALANCE_OPTS_DATA 0
655 #define BALANCE_OPTS_METADATA 1
656 #define BALANCE_OPTS_SYSTEM 2
657 
658 typedef struct {
672 } balance_info;
673 
674 typedef struct {
681 
682  union {
683  struct {
688  } data;
689 
690  struct {
694  } metadata;
695  };
696 } scrub_error;
697 
698 typedef struct {
715 } scrub_info;
716 
718 
719 typedef struct _device_extension {
725 #ifdef DEBUG_STATS
726  debug_stats stats;
727 #endif
728 #ifdef DEBUG_CHUNK_LOCKS
729  LONG chunk_locks_held;
730 #endif
744  _Has_lock_level_(fcb_lock) ERESOURCE fcb_lock;
746  _Has_lock_level_(tree_lock) ERESOURCE tree_lock;
800 
801 typedef struct {
807 
808 typedef struct {
822 } volume_child;
823 
824 struct pdo_device_extension;
825 
826 typedef struct _volume_device_extension {
838 
839 typedef struct pdo_device_extension {
845 
850 
853 
854 typedef struct {
858 } uid_map;
859 
860 typedef struct {
864 } gid_map;
865 
873 };
874 
875 struct _write_data_context;
876 
877 typedef struct {
887 
888 typedef struct _write_data_context {
896 
897 typedef struct {
903 } tree_write;
904 
905 typedef struct {
908 } name_bit;
909 
911 _Acquires_shared_lock_(Vcb->fcb_lock)
912 static __inline void acquire_fcb_lock_shared(device_extension* Vcb) {
913 #ifdef DEBUG_STATS
914  LARGE_INTEGER time1, time2;
915 
916  if (ExAcquireResourceSharedLite(&Vcb->fcb_lock, FALSE))
917  return;
918 
920 #endif
921 
922  ExAcquireResourceSharedLite(&Vcb->fcb_lock, TRUE);
923 
924 #ifdef DEBUG_STATS
926  Vcb->stats.fcb_lock_time += time2.QuadPart - time1.QuadPart;
927 #endif
928 }
929 
930 _Requires_lock_not_held_(Vcb->fcb_lock)
932 static __inline void acquire_fcb_lock_exclusive(device_extension* Vcb) {
933 #ifdef DEBUG_STATS
934  LARGE_INTEGER time1, time2;
935 
936  if (ExAcquireResourceExclusiveLite(&Vcb->fcb_lock, FALSE))
937  return;
938 
940 #endif
941 
943 
944 #ifdef DEBUG_STATS
946  Vcb->stats.fcb_lock_time += time2.QuadPart - time1.QuadPart;
947 #endif
948 }
949 
951 _Releases_lock_(Vcb->fcb_lock)
952 static __inline void release_fcb_lock(device_extension* Vcb) {
953  ExReleaseResourceLite(&Vcb->fcb_lock);
954 }
955 
956 static __inline void* map_user_buffer(PIRP Irp, ULONG priority) {
957  if (!Irp->MdlAddress) {
958  return Irp->UserBuffer;
959  } else {
960  return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, priority);
961  }
962 }
963 
964 static __inline UINT64 unix_time_to_win(BTRFS_TIME* t) {
965  return (t->seconds * 10000000) + (t->nanoseconds / 100) + 116444736000000000;
966 }
967 
968 static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME* out) {
969  ULONGLONG l = (ULONGLONG)t.QuadPart - 116444736000000000;
970 
971  out->seconds = l / 10000000;
972  out->nanoseconds = (UINT32)((l % 10000000) * 100);
973 }
974 
975 _Post_satisfies_(*stripe>=0&&*stripe<num_stripes)
976 static __inline void get_raid0_offset(_In_ UINT64 off, _In_ UINT64 stripe_length, _In_ UINT16 num_stripes, _Out_ UINT64* stripeoff, _Out_ UINT16* stripe) {
977  UINT64 initoff, startoff;
978 
979  startoff = off % (num_stripes * stripe_length);
980  initoff = (off / (num_stripes * stripe_length)) * stripe_length;
981 
982  *stripe = (UINT16)(startoff / stripe_length);
983  *stripeoff = initoff + startoff - (*stripe * stripe_length);
984 }
985 
986 /* We only have 64 bits for a file ID, which isn't technically enough to be
987  * unique on Btrfs. We fudge it by having three bytes for the subvol and
988  * five for the inode, which should be good enough.
989  * Inodes are also 64 bits on Linux, but the Linux driver seems to get round
990  * this by tricking it into thinking subvols are separate volumes. */
991 static __inline UINT64 make_file_id(root* r, UINT64 inode) {
992  return (r->id << 40) | (inode & 0xffffffffff);
993 }
994 
995 #define keycmp(key1, key2)\
996  ((key1.obj_id < key2.obj_id) ? -1 :\
997  ((key1.obj_id > key2.obj_id) ? 1 :\
998  ((key1.obj_type < key2.obj_type) ? -1 :\
999  ((key1.obj_type > key2.obj_type) ? 1 :\
1000  ((key1.offset < key2.offset) ? -1 :\
1001  ((key1.offset > key2.offset) ? 1 :\
1002  0))))))
1003 
1004 _Post_satisfies_(return>=n)
1006  if (n & (a - 1))
1007  n = (n + a) & ~(a - 1);
1008 
1009  return n;
1010 }
1011 
1012 __inline static BOOL is_subvol_readonly(root* r, PIRP Irp) {
1013  if (!(r->root_item.flags & BTRFS_SUBVOL_READONLY))
1014  return FALSE;
1015 
1016  if (!r->reserved)
1017  return TRUE;
1018 
1019  return (!Irp || Irp->RequestorMode == UserMode) && PsGetCurrentProcess() != r->reserved ? TRUE : FALSE;
1020 }
1021 
1023  switch (type) {
1024  case TYPE_TREE_BLOCK_REF:
1025  return sizeof(TREE_BLOCK_REF);
1026 
1027  case TYPE_EXTENT_DATA_REF:
1028  return sizeof(EXTENT_DATA_REF);
1029 
1030  case TYPE_EXTENT_REF_V0:
1031  return sizeof(EXTENT_REF_V0);
1032 
1033  case TYPE_SHARED_BLOCK_REF:
1034  return sizeof(SHARED_BLOCK_REF);
1035 
1036  case TYPE_SHARED_DATA_REF:
1037  return sizeof(SHARED_DATA_REF);
1038 
1039  default:
1040  return 0;
1041  }
1042 }
1043 
1044 __inline static UINT32 get_extent_data_refcount(UINT8 type, void* data) {
1045  switch (type) {
1046  case TYPE_TREE_BLOCK_REF:
1047  return 1;
1048 
1049  case TYPE_EXTENT_DATA_REF:
1050  {
1052  return edr->count;
1053  }
1054 
1055  case TYPE_EXTENT_REF_V0:
1056  {
1057  EXTENT_REF_V0* erv0 = (EXTENT_REF_V0*)data;
1058  return erv0->count;
1059  }
1060 
1061  case TYPE_SHARED_BLOCK_REF:
1062  return 1;
1063 
1064  case TYPE_SHARED_DATA_REF:
1065  {
1067  return sdr->count;
1068  }
1069 
1070  default:
1071  return 0;
1072  }
1073 }
1074 
1075 // in btrfs.c
1078 
1079 _Success_(return)
1080 BOOL get_file_attributes_from_xattr(_In_reads_bytes_(len) char* val, _In_ UINT16 len, _Out_ ULONG* atts);
1081 
1083  _In_ UINT8 type, _In_ BOOL dotfile, _In_ BOOL ignore_xa, _In_opt_ PIRP Irp);
1084 
1086 BOOL get_xattr(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, _In_ root* subvol, _In_ UINT64 inode, _In_z_ char* name, _In_ UINT32 crc32,
1088 
1089 #ifndef DEBUG_FCB_REFCOUNTS
1091 #endif
1096  _Out_ root** rootptr, _In_ BOOL no_tree, _In_ UINT64 offset, _In_opt_ PIRP Irp);
1099  _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ BOOLEAN Override, _Out_opt_ IO_STATUS_BLOCK* iosb);
1103 
1104 #ifdef DEBUG_CHUNK_LOCKS
1105 #define acquire_chunk_lock(c, Vcb) { ExAcquireResourceExclusiveLite(&c->lock, TRUE); InterlockedIncrement(&Vcb->chunk_locks_held); }
1106 #define release_chunk_lock(c, Vcb) { InterlockedDecrement(&Vcb->chunk_locks_held); ExReleaseResourceLite(&c->lock); }
1107 #else
1108 #define acquire_chunk_lock(c, Vcb) ExAcquireResourceExclusiveLite(&(c)->lock, TRUE)
1109 #define release_chunk_lock(c, Vcb) ExReleaseResourceLite(&(c)->lock)
1110 #endif
1111 
1112 _Ret_z_
1115 void mark_fcb_dirty(_In_ fcb* fcb);
1116 void mark_fileref_dirty(_In_ file_ref* fileref);
1127 #ifdef __REACTOS__
1129 #else
1131 #endif
1132 
1133 #ifdef _MSC_VER
1134 #define funcname __FUNCTION__
1135 #else
1136 #define funcname __func__
1137 #endif
1138 
1139 extern BOOL have_sse2;
1140 
1141 extern UINT32 mount_compress;
1144 extern UINT32 mount_zlib_level;
1145 extern UINT32 mount_zstd_level;
1147 extern UINT32 mount_max_inline;
1148 extern UINT32 mount_skip_balance;
1149 extern UINT32 mount_no_barrier;
1150 extern UINT32 mount_no_trim;
1151 extern UINT32 mount_clear_cache;
1153 extern UINT32 mount_readonly;
1154 extern UINT32 no_pnp;
1155 
1156 #ifdef _DEBUG
1157 
1158 extern BOOL log_started;
1159 extern UINT32 debug_log_level;
1160 
1161 #ifdef DEBUG_LONG_MESSAGES
1162 
1163 #define MSG(fn, file, line, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, file, line, s, ##__VA_ARGS__) : 0
1164 
1165 #define TRACE(s, ...) MSG(funcname, __FILE__, __LINE__, s, 3, ##__VA_ARGS__)
1166 #define WARN(s, ...) MSG(funcname, __FILE__, __LINE__, s, 2, ##__VA_ARGS__)
1167 #define FIXME(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1168 #define ERR(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1169 
1170 void _debug_message(_In_ const char* func, _In_ const char* file, _In_ unsigned int line, _In_ char* s, ...);
1171 
1172 #else
1173 
1174 #define MSG(fn, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, s, ##__VA_ARGS__) : 0
1175 
1176 #define TRACE(s, ...) MSG(funcname, s, 3, ##__VA_ARGS__)
1177 #define WARN(s, ...) MSG(funcname, s, 2, ##__VA_ARGS__)
1178 #define FIXME(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1179 #define ERR(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1180 
1181 void _debug_message(_In_ const char* func, _In_ char* s, ...);
1182 
1183 #endif
1184 
1185 #else
1186 
1187 #define TRACE(s, ...)
1188 #define WARN(s, ...)
1189 #define FIXME(s, ...) DbgPrint("Btrfs FIXME : %s : " s, funcname, ##__VA_ARGS__)
1190 #define ERR(s, ...) DbgPrint("Btrfs ERR : %s : " s, funcname, ##__VA_ARGS__)
1191 
1192 #endif
1193 
1194 #ifdef DEBUG_FCB_REFCOUNTS
1195 void _free_fcb(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) _In_ device_extension* Vcb, _Inout_ fcb* fcb, _In_ const char* func);
1196 #define free_fcb(Vcb, fcb) _free_fcb(Vcb, fcb, funcname)
1197 #endif
1198 
1199 // in fastio.c
1201 
1202 // in crc32c.c
1203 UINT32 calc_crc32c(_In_ UINT32 seed, _In_reads_bytes_(msglen) UINT8* msg, _In_ ULONG msglen);
1204 
1205 typedef struct {
1211 } rollback_space;
1212 
1213 typedef struct {
1216 } rollback_extent;
1217 
1223 };
1224 
1225 typedef struct {
1227  void* ptr;
1229 } rollback_item;
1230 
1231 typedef struct {
1236 } ea_item;
1237 
1238 static const char lxuid[] = "$LXUID";
1239 static const char lxgid[] = "$LXGID";
1240 static const char lxmod[] = "$LXMOD";
1241 static const char lxdev[] = "$LXDEV";
1242 
1243 // in treefuncs.c
1245  _In_ const KEY* searchkey, _In_ BOOL ignore, _In_opt_ PIRP Irp);
1251  _In_ UINT8 obj_type, _In_ UINT64 offset, _In_reads_bytes_opt_(size) _When_(return >= 0, __drv_aliasesMem) void* data,
1254 tree* free_tree(tree* t);
1262 void clear_batch_list(device_extension* Vcb, LIST_ENTRY* batchlist);
1264 
1265 // in search.c
1267 
1268 _Function_class_(KSTART_ROUTINE)
1269 #ifdef __REACTOS__
1270 void NTAPI mountmgr_thread(_In_ void* context);
1271 #else
1272 void mountmgr_thread(_In_ void* context);
1273 #endif
1274 
1275 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1276 #ifdef __REACTOS__
1278 #else
1280 #endif
1281 
1285 
1286 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1287 #ifdef __REACTOS__
1288 NTSTATUS NTAPI volume_notification(PVOID NotificationStructure, PVOID Context);
1289 #else
1290 NTSTATUS volume_notification(PVOID NotificationStructure, PVOID Context);
1291 #endif
1292 
1294  _In_ volume_child* vc, _In_ BOOL skip_dev);
1295 
1296 // in cache.c
1298 void free_cache();
1300 
1301 // in write.c
1314 
1318 
1323 
1327 void get_raid56_lock_range(chunk* c, UINT64 address, UINT64 length, UINT64* lockaddr, UINT64* locklen);
1333 void add_extent(_In_ fcb* fcb, _In_ LIST_ENTRY* prevextle, _In_ __drv_aliasesMem extent* newext);
1334 
1335 // in dirctrl.c
1336 
1339 NTSTATUS NTAPI drv_directory_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1340 
1343 
1344 // in security.c
1345 
1348 NTSTATUS NTAPI drv_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1349 
1352 NTSTATUS NTAPI drv_set_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1353 
1354 void fcb_get_sd(fcb* fcb, struct _fcb* parent, BOOL look_for_xattr, PIRP Irp);
1355 void add_user_mapping(WCHAR* sidstring, ULONG sidstringlength, UINT32 uid);
1356 void add_group_mapping(WCHAR* sidstring, ULONG sidstringlength, UINT32 gid);
1359 NTSTATUS fcb_get_new_sd(fcb* fcb, file_ref* parfileref, ACCESS_STATE* as);
1360 void find_gid(struct _fcb* fcb, struct _fcb* parfcb, PSECURITY_SUBJECT_CONTEXT subjcont);
1361 
1362 // in fileinfo.c
1363 
1366 NTSTATUS NTAPI drv_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1367 
1370 NTSTATUS NTAPI drv_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1371 
1375 
1379 
1380 BOOL has_open_children(file_ref* fileref);
1382 NTSTATUS fileref_get_filename(file_ref* fileref, PUNICODE_STRING fn, USHORT* name_offset, ULONG* preqlen);
1386 
1387 // in reparse.c
1392 
1393 // in create.c
1394 
1398 
1400  _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,
1401  _In_ BOOL case_sensitive, _In_opt_ PIRP Irp);
1403  root* subvol, UINT64 inode, UINT8 type, PANSI_STRING utf8, fcb* parent, fcb** pfcb, POOL_TYPE pooltype, PIRP Irp);
1405 NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, fcb* fcb, BOOL ignore_size, PIRP Irp);
1408  _In_ file_ref* sf, _In_ PUNICODE_STRING name, _In_ BOOL case_sensitive, _In_ BOOL lastpart, _In_ BOOL streampart,
1409  _In_ POOL_TYPE pooltype, _Out_ file_ref** psf2, _In_opt_ PIRP Irp);
1411 NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb* fcb, root** subvol, UINT64* inode, dir_child** pdc, BOOL case_sensitive);
1412 UINT32 inherit_mode(fcb* parfcb, BOOL is_dir);
1414 
1415 // in fsctl.c
1419 void flush_subvol_fcbs(root* subvol);
1421 
1422 // in flushthread.c
1423 
1424 _Function_class_(KSTART_ROUTINE)
1425 #ifdef __REACTOS__
1426 void NTAPI flush_thread(void* context);
1427 #else
1428 void flush_thread(void* context);
1429 #endif
1430 
1436 NTSTATUS do_tree_writes(device_extension* Vcb, LIST_ENTRY* tree_writes, BOOL no_free);
1441  _In_opt_ _When_(return >= 0, __drv_aliasesMem) void* data, UINT16 datalen, enum batch_operation operation);
1444 
1445 // in read.c
1446 
1450 
1453  _In_ ULONG priority);
1456 NTSTATUS do_read(PIRP Irp, BOOLEAN wait, ULONG* bytes_read);
1458 void raid6_recover2(UINT8* sectors, UINT16 num_stripes, ULONG sector_size, UINT16 missing1, UINT16 missing2, UINT8* out);
1459 
1460 // in pnp.c
1461 
1465 
1468 
1469 // in free-space.c
1481 
1482 // in extent-tree.c
1485  UINT32 refcount, BOOL superseded, PIRP Irp);
1493  INT32 count, BOOL no_csum, BOOL superseded, PIRP Irp);
1500 
1501 // in worker-thread.c
1502 void do_read_job(PIRP Irp);
1505 
1506 // in registry.c
1507 void read_registry(PUNICODE_STRING regpath, BOOL refresh);
1511 void watch_registry(HANDLE regh);
1512 
1513 // in compress.c
1515 NTSTATUS lzo_decompress(UINT8* inbuf, UINT32 inlen, UINT8* outbuf, UINT32 outlen, UINT32 inpageoff);
1518 
1519 // in galois.c
1521 void galois_divpower(UINT8* data, UINT8 div, UINT32 readlen);
1522 UINT8 gpow2(UINT8 e);
1523 UINT8 gmul(UINT8 a, UINT8 b);
1524 UINT8 gdiv(UINT8 a, UINT8 b);
1525 
1526 // in devctrl.c
1527 
1530 NTSTATUS NTAPI drv_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1531 
1532 // in calcthread.c
1533 
1534 _Function_class_(KSTART_ROUTINE)
1535 #ifdef __REACTOS__
1536 void NTAPI calc_thread(void* context);
1537 #else
1538 void calc_thread(void* context);
1539 #endif
1540 
1542 void free_calc_job(calc_job* cj);
1543 
1544 // in balance.c
1552 
1553 _Function_class_(KSTART_ROUTINE)
1554 #ifdef __REACTOS__
1555 void NTAPI balance_thread(void* context);
1556 #else
1557 void balance_thread(void* context);
1558 #endif
1559 
1560 // in volume.c
1581 void add_volume_device(superblock* sb, PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath, UINT64 length, ULONG disk_num, ULONG part_num);
1583 
1584 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1585 #ifdef __REACTOS__
1587 #else
1589 #endif
1590 
1591 // in scrub.c
1597 
1598 // in send.c
1601 
1602 // based on function in sys/sysmacros.h
1603 #define makedev(major, minor) (((minor) & 0xFF) | (((major) & 0xFFF) << 8) | (((UINT64)((minor) & ~0xFF)) << 12) | (((UINT64)((major) & ~0xFFF)) << 32))
1604 
1605 #define fast_io_possible(fcb) (!FsRtlAreThereCurrentFileLocks(&fcb->lock) && !fcb->Vcb->readonly ? FastIoIsPossible : FastIoIsQuestionable)
1606 
1607 static __inline void print_open_trees(device_extension* Vcb) {
1608  LIST_ENTRY* le = Vcb->trees.Flink;
1609  while (le != &Vcb->trees) {
1611  tree_data* td = CONTAINING_RECORD(t->itemlist.Flink, tree_data, list_entry);
1612  ERR("tree %p: root %llx, level %u, first key (%llx,%x,%llx)\n",
1613  t, t->root->id, t->header.level, td->key.obj_id, td->key.obj_type, td->key.offset);
1614 
1615  le = le->Flink;
1616  }
1617 }
1618 
1619 static __inline BOOL write_fcb_compressed(fcb* fcb) {
1620  // make sure we don't accidentally write the cache inodes or pagefile compressed
1622  return FALSE;
1623 
1624  if (fcb->Vcb->options.compress_force)
1625  return TRUE;
1626 
1628  return FALSE;
1629 
1630  if (fcb->inode_item.flags & BTRFS_INODE_COMPRESS || fcb->Vcb->options.compress)
1631  return TRUE;
1632 
1633  return FALSE;
1634 }
1635 
1636 static __inline void do_xor(UINT8* buf1, UINT8* buf2, UINT32 len) {
1637  UINT32 j;
1638 #ifndef __REACTOS__
1639  __m128i x1, x2;
1640 #endif
1641 
1642 #ifndef __REACTOS__
1643  if (have_sse2 && ((uintptr_t)buf1 & 0xf) == 0 && ((uintptr_t)buf2 & 0xf) == 0) {
1644  while (len >= 16) {
1645  x1 = _mm_load_si128((__m128i*)buf1);
1646  x2 = _mm_load_si128((__m128i*)buf2);
1647  x1 = _mm_xor_si128(x1, x2);
1648  _mm_store_si128((__m128i*)buf1, x1);
1649 
1650  buf1 += 16;
1651  buf2 += 16;
1652  len -= 16;
1653  }
1654  }
1655 #endif
1656 
1657  for (j = 0; j < len; j++) {
1658  *buf1 ^= *buf2;
1659  buf1++;
1660  buf2++;
1661  }
1662 }
1663 
1664 #ifdef DEBUG_FCB_REFCOUNTS
1665 #ifdef DEBUG_LONG_MESSAGES
1666 #define increase_fileref_refcount(fileref) {\
1667  LONG rc = InterlockedIncrement(&fileref->refcount);\
1668  MSG(funcname, __FILE__, __LINE__, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1669 }
1670 #else
1671 #define increase_fileref_refcount(fileref) {\
1672  LONG rc = InterlockedIncrement(&fileref->refcount);\
1673  MSG(funcname, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1674 }
1675 #endif
1676 #else
1677 #define increase_fileref_refcount(fileref) InterlockedIncrement(&fileref->refcount)
1678 #endif
1679 
1680 #ifdef _MSC_VER
1681 #define int3 __debugbreak()
1682 #else
1683 #define int3 asm("int3;")
1684 #endif
1685 
1686 #define hex_digit(c) ((c) <= 9) ? ((c) + '0') : ((c) - 10 + 'a')
1687 
1688 // FIXME - find a way to catch unfreed trees again
1689 
1690 // from sys/stat.h
1691 #define __S_IFMT 0170000 /* These bits determine file type. */
1692 #define __S_IFDIR 0040000 /* Directory. */
1693 #define __S_IFCHR 0020000 /* Character device. */
1694 #define __S_IFBLK 0060000 /* Block device. */
1695 #define __S_IFREG 0100000 /* Regular file. */
1696 #define __S_IFIFO 0010000 /* FIFO. */
1697 #define __S_IFLNK 0120000 /* Symbolic link. */
1698 #define __S_IFSOCK 0140000 /* Socket. */
1699 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
1700 
1701 #ifndef S_ISDIR
1702 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
1703 #endif
1704 
1705 #ifndef S_IRUSR
1706 #define S_IRUSR 0000400
1707 #endif
1708 
1709 #ifndef S_IWUSR
1710 #define S_IWUSR 0000200
1711 #endif
1712 
1713 #ifndef S_IXUSR
1714 #define S_IXUSR 0000100
1715 #endif
1716 
1717 #ifdef __REACTOS__
1718 #define S_IFDIR __S_IFDIR
1719 #define S_IFREG __S_IFREG
1720 #endif /* __REACTOS__ */
1721 
1722 #ifndef S_IRGRP
1723 #define S_IRGRP (S_IRUSR >> 3)
1724 #endif
1725 
1726 #ifndef S_IWGRP
1727 #define S_IWGRP (S_IWUSR >> 3)
1728 #endif
1729 
1730 #ifndef S_IXGRP
1731 #define S_IXGRP (S_IXUSR >> 3)
1732 #endif
1733 
1734 #ifndef S_IROTH
1735 #define S_IROTH (S_IRGRP >> 3)
1736 #endif
1737 
1738 #ifndef S_IWOTH
1739 #define S_IWOTH (S_IWGRP >> 3)
1740 #endif
1741 
1742 #ifndef S_IXOTH
1743 #define S_IXOTH (S_IXGRP >> 3)
1744 #endif
1745 
1746 #ifndef S_ISUID
1747 #define S_ISUID 0004000
1748 #endif
1749 
1750 #ifndef S_ISGID
1751 #define S_ISGID 0002000
1752 #endif
1753 
1754 #ifndef S_ISVTX
1755 #define S_ISVTX 0001000
1756 #endif
1757 
1758 // based on functions in sys/sysmacros.h
1759 #define major(rdev) ((((rdev) >> 8) & 0xFFF) | ((UINT32)((rdev) >> 32) & ~0xFFF))
1760 #define minor(rdev) (((rdev) & 0xFF) | ((UINT32)((rdev) >> 12) & ~0xFF))
1761 
1762 static __inline UINT64 fcb_alloc_size(fcb* fcb) {
1763  if (S_ISDIR(fcb->inode_item.st_mode))
1764  return 0;
1765  else if (fcb->atts & FILE_ATTRIBUTE_SPARSE_FILE)
1766  return fcb->inode_item.st_blocks;
1767  else
1768  return sector_align(fcb->inode_item.st_size, fcb->Vcb->superblock.sector_size);
1769 }
1770 
1772 
1774  ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount);
1775 
1777  PVOID Buffer, PETHREAD IoIssuerThread);
1778 
1780  PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread);
1781 
1782 #ifndef CC_ENABLE_DISK_IO_ACCOUNTING
1783 #define CC_ENABLE_DISK_IO_ACCOUNTING 0x00000010
1784 #endif
1785 
1787 
1789 
1790 #ifndef __REACTOS__
1791 #ifndef _MSC_VER
1792 
1793 #undef RtlIsNtDdiVersionAvailable
1794 
1796 
1798 #endif
1799 
1800 // not in DDK headers - taken from winternl.h
1801 typedef struct _LDR_DATA_TABLE_ENTRY {
1810  union {
1813  };
1816 
1817 typedef struct _PEB_LDR_DATA {
1822 
1829 
1831 
1832 typedef struct _PEB {
1845 } PEB,*PPEB;
1846 
1847 #ifdef _MSC_VER
1851  IN PROCESSINFOCLASS ProcessInformationClass,
1852  OUT PVOID ProcessInformation,
1853  IN ULONG ProcessInformationLength,
1855 );
1856 #endif
1857 #endif
1858 
1859 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1860 typedef struct _ECP_LIST ECP_LIST;
1861 typedef struct _ECP_LIST *PECP_LIST;
1862 #endif
1863 
1864 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_WIN7)
1865 NTSTATUS WINAPI RtlUnicodeToUTF8N(CHAR *utf8_dest, ULONG utf8_bytes_max,
1866  ULONG *utf8_bytes_written,
1867  const WCHAR *uni_src, ULONG uni_bytes);
1868 NTSTATUS WINAPI RtlUTF8ToUnicodeN(WCHAR *uni_dest, ULONG uni_bytes_max,
1869  ULONG *uni_bytes_written,
1870  const CHAR *utf8_src, ULONG utf8_bytes);
1871 #endif /* defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_WIN7) */
1872 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1876  PREPARSE_DATA_BUFFER ReparseBuffer);
1879  OUT PECP_LIST *EcpList);
1885 #endif /* defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA) */
1886 
1887 #endif
BOOL reparse_xattr_changed
Definition: btrfs_drv.h:293
BOOL reloc
Definition: btrfs_drv.h:489
void chunk_lock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ UINT64 start, _In_ UINT64 length)
Definition: btrfs.c:5123
LIST_ENTRY * list_size
Definition: btrfs_drv.h:1207
SHARED_DATA_REF sdr
Definition: btrfs_drv.h:571
void free_fileref(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) _In_ device_extension *Vcb, _Inout_ file_ref *fr)
Definition: btrfs.c:1610
struct _file_ref * parent
Definition: btrfs_drv.h:326
BOOL lock_paused_balance
Definition: btrfs_drv.h:736
Definition: cache.c:46
_Must_inspect_result_ _In_ FSRTL_ALLOCATE_ECPLIST_FLAGS _Outptr_ PECP_LIST * EcpList
Definition: fltkernel.h:2511
LIST_ENTRY list_entry
Definition: btrfs_drv.h:457
GLenum func
Definition: glext.h:6028
mount_options options
Definition: btrfs_drv.h:721
BOOL log_started
Definition: btrfs.c:84
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1203
ULONG * bmparr
Definition: btrfs_drv.h:512
UINT64 id
Definition: btrfs_drv.h:421
UINT8 * data
Definition: btrfs_drv.h:900
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
Definition: treefuncs.c:1032
UINT64 offset
Definition: btrfs_drv.h:685
struct _DUPLICATE_EXTENTS_DATA DUPLICATE_EXTENTS_DATA
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define _Ret_z_
Definition: no_sal2.h:625
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
NTSTATUS flush_fcb(fcb *fcb, BOOL cache, LIST_ENTRY *batchlist, PIRP Irp)
Definition: flushthread.c:4581
BYTE Reserved4[104]
Definition: btrfs_drv.h:1839
BOOL readonly
Definition: btrfs_drv.h:488
void clear_rollback(LIST_ENTRY *rollback)
Definition: treefuncs.c:1011
UINT64 address
Definition: btrfs_drv.h:374
BOOL log_to_phys_loaded
Definition: btrfs_drv.h:764
GLint level
Definition: gl.h:1546
struct _root * root
Definition: btrfs_drv.h:403
BOOL skip_balance
Definition: btrfs_drv.h:620
#define IN
Definition: typedefs.h:38
BOOL can_flush
Definition: btrfs_drv.h:491
BOOL stopping
Definition: btrfs_drv.h:664
return
Definition: dirsup.c:529
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER
BOOL changed
Definition: btrfs_drv.h:541
static const char lxuid[]
Definition: btrfs_drv.h:1238
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
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
UNICODE_STRING pnp_name
Definition: btrfs_drv.h:814
UINT64 length
Definition: btrfs_drv.h:505
LIST_ENTRY trees
Definition: btrfs_drv.h:768
WCHAR * debug_desc
Definition: btrfs_drv.h:327
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define TRUE
Definition: types.h:120
UINT64 chunks_left
Definition: btrfs_drv.h:661
LIST_ENTRY trees_hash
Definition: btrfs_drv.h:769
void trim_whole_device(device *dev)
Definition: fsctl.c:2680
struct _file_ref * fileref
Definition: btrfs_drv.h:234
BOOL write
Definition: btrfs_drv.h:410
UINT16 last_stripe
Definition: btrfs_drv.h:544
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ ULONG cj
Definition: winddi.h:3540
root * data_reloc_root
Definition: btrfs_drv.h:762
LIST_ENTRY space
Definition: btrfs_drv.h:497
NTSTATUS remove_device(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3777
LIST_ENTRY dirty_filerefs
Definition: btrfs_drv.h:774
NTSTATUS read_data(_In_ device_extension *Vcb, _In_ UINT64 addr, _In_ UINT32 length, _In_reads_bytes_opt_(length *sizeof(UINT32)/Vcb->superblock.sector_size) UINT32 *csum, _In_ BOOL is_tree, _Out_writes_bytes_(length) UINT8 *buf, _In_opt_ chunk *c, _Out_opt_ chunk **pc, _In_opt_ PIRP Irp, _In_ UINT64 generation, _In_ BOOL file_read, _In_ ULONG priority)
Definition: read.c:1447
BOOL sd_dirty
Definition: btrfs_drv.h:290
scrub_info scrub
Definition: btrfs_drv.h:784
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
PAGED_LOOKASIDE_LIST batch_item_lookaside
Definition: btrfs_drv.h:791
NTSTATUS write_data_complete(device_extension *Vcb, UINT64 address, void *data, UINT32 length, PIRP Irp, chunk *c, BOOL file_write, UINT64 irp_offset, ULONG priority)
Definition: write.c:2170
void init_fast_io_dispatch(FAST_IO_DISPATCH **fiod)
Definition: fastio.c:382
LIST_ENTRY list_entry
Definition: btrfs_drv.h:549
UINT64 offset
Definition: btrfs.h:125
NTSTATUS vol_query_volume_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:316
_Post_satisfies_ static stripe __inline void get_raid0_offset(_In_ UINT64 off, _In_ UINT64 stripe_length, _In_ UINT16 num_stripes, _Out_ UINT64 *stripeoff, _Out_ UINT16 *stripe)
Definition: btrfs_drv.h:976
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1235
chunk * c
Definition: btrfs_drv.h:901
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
NTSTATUS init_cache()
Definition: cache.c:101
BOOL paused
Definition: btrfs_drv.h:704
NTSTATUS extend_file(fcb *fcb, file_ref *fileref, UINT64 end, BOOL prealloc, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:3327
void add_user_mapping(WCHAR *sidstring, ULONG sidstringlength, UINT32 uid)
Definition: security.c:56
LIST_ENTRY list_entry
Definition: btrfs_drv.h:498
BOOL uniqueness_determined
Definition: btrfs_drv.h:412
BOOL find_prev_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, const traverse_ptr *tp, traverse_ptr *prev_tp, PIRP Irp)
Definition: treefuncs.c:685
rwlock_t lock
Definition: tcpcore.h:1163
BOOL case_sensitive
Definition: btrfs_drv.h:361
void space_list_add2(LIST_ENTRY *list, LIST_ENTRY *list_size, UINT64 address, UINT64 length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1410
UINT8 gmul(UINT8 a, UINT8 b)
Definition: galois.c:73
void free_write_data_stripes(write_data_context *wtc)
Definition: write.c:2299
#define _Create_lock_level_(a)
Definition: btrfs_drv.h:176
LIST_ENTRY list_entry
Definition: btrfs_drv.h:563
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:175
ULONG options
Definition: btrfs_drv.h:349
PAGED_LOOKASIDE_LIST fcb_lookaside
Definition: btrfs_drv.h:793
BOOL removing
Definition: btrfs_drv.h:665
#define IRP_MJ_QUERY_SECURITY
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:282
#define error(str)
Definition: mkdosfs.c:1605
NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, UINT64 inode, file_ref **pfr, PIRP Irp)
Definition: fileinfo.c:3191
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
struct _root_cache root_cache
NTSTATUS lzo_decompress(UINT8 *inbuf, UINT32 inlen, UINT8 *outbuf, UINT32 outlen, UINT32 inpageoff)
Definition: compress.c:278
UINT32 max_inline
Definition: btrfs_drv.h:618
NPAGED_LOOKASIDE_LIST fcb_np_lookaside
Definition: btrfs_drv.h:797
UINT64 oldindex
Definition: btrfs_drv.h:318
PAGED_LOOKASIDE_LIST traverse_ptr_lookaside
Definition: btrfs_drv.h:790
NTSTATUS excise_extents(device_extension *Vcb, fcb *fcb, UINT64 start_data, UINT64 end_data, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:2376
static const char lxdev[]
Definition: btrfs_drv.h:1241
NTSTATUS fileref_get_filename(file_ref *fileref, PUNICODE_STRING fn, USHORT *name_offset, ULONG *preqlen)
Definition: fileinfo.c:2900
UINT64 new_address
Definition: btrfs_drv.h:407
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
NTSTATUS vol_set_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:856
NTSTATUS uid_to_sid(UINT32 uid, PSID *sid)
Definition: security.c:229
Definition: http.c:6587
BOOL xattrs_changed
Definition: btrfs_drv.h:296
NTSTATUS start_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3264
LIST_ENTRY list_entry
Definition: btrfs_drv.h:432
void space_list_subtract2(LIST_ENTRY *list, LIST_ENTRY *list_size, UINT64 address, UINT64 length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1935
UINT64 subvol
Definition: btrfs_drv.h:684
UNICODE_STRING name_uc
Definition: btrfs_drv.h:232
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
UINT32 hash_uc
Definition: btrfs_drv.h:231
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
NTSTATUS vol_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:850
_In_ PIRP Irp
Definition: csq.h:116
superblock * sb
Definition: btrfs.c:3876
root * checksum_root
Definition: btrfs_drv.h:759
#define pt(x, y)
Definition: drawing.c:79
static const BYTE us[]
Definition: encode.c:689
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT64 data_scrubbed
Definition: btrfs_drv.h:711
UNICODE_STRING us
Definition: btrfs_drv.h:906
UINT32 find_extent_shared_data_refcount(device_extension *Vcb, UINT64 address, UINT64 parent, PIRP Irp)
Definition: extent-tree.c:2219
NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
Definition: btrfs.c:3513
ULONG size
Definition: btrfs_drv.h:233
_In_ ULONG * pcj
Definition: winddi.h:3642
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)
Definition: treefuncs.c:582
uint16_t * PWSTR
Definition: typedefs.h:54
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LIST_ENTRY list_entry
Definition: btrfs_drv.h:574
static __inline UINT16 get_extent_data_len(UINT8 type)
Definition: btrfs_drv.h:1022
root * root
Definition: btrfs_drv.h:472
NTSTATUS stream_set_end_of_file_information(device_extension *Vcb, UINT16 end, fcb *fcb, file_ref *fileref, BOOL advance_only)
Definition: fileinfo.c:1936
UINT32 uid
Definition: btrfs_drv.h:857
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _tree tree
int ignore(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:296
NTSTATUS write_file2(device_extension *Vcb, PIRP Irp, LARGE_INTEGER offset, void *buf, ULONG *length, BOOLEAN paging_io, BOOLEAN no_cache, BOOLEAN wait, BOOLEAN deferred_write, BOOLEAN write_irp, LIST_ENTRY *rollback)
Definition: write.c:4143
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7287
#define IRP_MJ_SET_SECURITY
struct _device_extension device_extension
unsigned char * PUCHAR
Definition: retypes.h:3
UINT64 inode
Definition: btrfs_drv.h:262
BOOL seeding
Definition: btrfs_drv.h:487
fcb * create_fcb(device_extension *Vcb, POOL_TYPE pool_type)
Definition: create.c:45
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:484
char CHAR
Definition: xmlstorage.h:175
struct _root root
#define _In_reads_bytes_opt_(size)
Definition: no_sal2.h:230
superblock superblock
Definition: btrfs_drv.h:732
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
NTSTATUS registry_mark_volume_mounted(BTRFS_UUID *uuid)
Definition: registry.c:229
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PDEVICE_OBJECT device
Definition: btrfs_drv.h:829
ULONG get_file_attributes(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ UINT64 inode, _In_ UINT8 type, _In_ BOOL dotfile, _In_ BOOL ignore_xa, _In_opt_ PIRP Irp)
Definition: btrfs.c:2366
#define FSRTL_FLAG2_IS_PAGING_FILE
Definition: fsrtltypes.h:57
BOOL cancelling
Definition: btrfs_drv.h:341
BOOL find_metadata_address_in_chunk(device_extension *Vcb, chunk *c, UINT64 *address)
Definition: flushthread.c:613
BOOL is_tree_unique(device_extension *Vcb, tree *t, PIRP Irp)
Definition: flushthread.c:3038
LONG NTSTATUS
Definition: precomp.h:26
PAGED_LOOKASIDE_LIST tree_data_lookaside
Definition: btrfs_drv.h:789
batch_operation
Definition: btrfs_drv.h:436
VOID(* tCcSetAdditionalCacheAttributesEx)(PFILE_OBJECT FileObject, ULONG Flags)
Definition: btrfs_drv.h:1786
BOOL specific_file
Definition: btrfs_drv.h:353
BOOL unique
Definition: btrfs_drv.h:204
#define ERR(s,...)
Definition: btrfs_drv.h:1190
GLintptr offset
Definition: glext.h:5920
tree_holder treeholder
Definition: btrfs_drv.h:386
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_ BOOLEAN Override, _Out_opt_ IO_STATUS_BLOCK *iosb)
Definition: btrfs.c:2603
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1820
enum prop_compression_type prop_compression
Definition: btrfs_drv.h:280
BOOL manage_volume_privilege
Definition: btrfs_drv.h:354
ANSI_STRING ea_xattr
Definition: btrfs_drv.h:275
KEVENT event
Definition: btrfs_drv.h:701
ERESOURCE range_locks_lock
Definition: btrfs_drv.h:532
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:406
NTSTATUS update_chunk_caches(device_extension *Vcb, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1814
NTSTATUS flush_partial_stripe(device_extension *Vcb, chunk *c, partial_stripe *ps)
Definition: flushthread.c:5549
#define TYPE_TREE_BLOCK_REF
Definition: btrfs.h:31
void init_file_cache(_In_ PFILE_OBJECT FileObject, _In_ CC_FILE_SIZES *ccfs)
Definition: btrfs.c:3702
GLdouble n
Definition: glext.h:7729
NTSTATUS load_tree(device_extension *Vcb, UINT64 addr, root *r, tree **pt, UINT64 generation, PIRP Irp)
Definition: treefuncs.c:20
BYTE Reserved2[1]
Definition: btrfs_drv.h:1835
NTSTATUS add_extent_to_fcb(_In_ fcb *fcb, _In_ UINT64 offset, _In_reads_bytes_(edsize) EXTENT_DATA *ed, _In_ UINT16 edsize, _In_ BOOL unique, _In_opt_ _When_(return >=0, __drv_aliasesMem) UINT32 *csum, _In_ LIST_ENTRY *rollback)
Definition: write.c:2728
ERESOURCE chunk_lock
Definition: btrfs_drv.h:778
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:268
ERESOURCE dirty_filerefs_lock
Definition: btrfs_drv.h:775
GLdouble GLdouble t
Definition: gl.h:2047
ERESOURCE load_tree_lock
Definition: btrfs_drv.h:417
tree * free_tree(tree *t)
Definition: treefuncs.c:290
NTSTATUS vol_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:304
UINT32 count
Definition: btrfs.h:406
#define _Acquires_exclusive_lock_(a)
Definition: btrfs_drv.h:180
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:433
BOOL allow_degraded
Definition: btrfs_drv.h:624
NTSTATUS decrease_extent_refcount(device_extension *Vcb, UINT64 address, UINT64 size, UINT8 type, void *data, KEY *firstitem, UINT8 level, UINT64 parent, BOOL superseded, PIRP Irp)
Definition: extent-tree.c:902
UINT64 obj_id
Definition: btrfs.h:123
NTSTATUS vol_flush_buffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:310
Definition: write.c:115
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
file_ref_nonpaged * nonpaged
Definition: btrfs_drv.h:322
ANSI_STRING utf8
Definition: btrfs_drv.h:228
FT_UInt sid
Definition: cffcmap.c:139
ROOT_ITEM root_item
Definition: btrfs_drv.h:425
LIST_ENTRY list_entry
Definition: btrfs_drv.h:209
ANSI_STRING reparse_xattr
Definition: btrfs_drv.h:274
NTSTATUS WINAPI RtlUTF8ToUnicodeN(PWSTR uni_dest, ULONG uni_bytes_max, PULONG uni_bytes_written, PCCH utf8_src, ULONG utf8_bytes)
Definition: reactos.cpp:21
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:831
HANDLE thread
Definition: btrfs_drv.h:659
void free_cache()
Definition: cache.c:116
UINT32 mount_zlib_level
Definition: btrfs.c:73
LIST_ENTRY errors
Definition: btrfs_drv.h:714
GLuint buffer
Definition: glext.h:5915
UINT64 oldused
Definition: btrfs_drv.h:523
BYTE BeingDebugged
Definition: btrfs_drv.h:1834
UINT64 metadata_flags
Definition: btrfs_drv.h:752
struct _PEB_LDR_DATA * PPEB_LDR_DATA
PNOTIFY_SYNC NotifySync
Definition: btrfs_drv.h:747
UINT32 length
Definition: btrfs_drv.h:899
struct _volume_device_extension * vde
Definition: btrfs_drv.h:723
static __inline UINT64 make_file_id(root *r, UINT64 inode)
Definition: btrfs_drv.h:991
HDC dc
Definition: cylfrac.c:34
UINT32 zlib_level
Definition: btrfs_drv.h:615
UINT64 old_size
Definition: btrfs_drv.h:556
KEVENT event
Definition: btrfs_drv.h:589
UINT32 crc32
Definition: btrfs.c:3877
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:804
ERESOURCE load_lock
Definition: btrfs_drv.h:745
NTSTATUS stop_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3441
NTSTATUS add_space_entry(LIST_ENTRY *list, LIST_ENTRY *list_size, UINT64 offset, UINT64 size)
Definition: free-space.c:189
ERESOURCE send_load_lock
Definition: btrfs_drv.h:785
BOOL is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:256
NTSTATUS get_device_pnp_name(_In_ PDEVICE_OBJECT DeviceObject, _Out_ PUNICODE_STRING pnp_name, _Out_ const GUID **guid)
Definition: btrfs.c:3848
GLuint GLuint end
Definition: gl.h:1545
NTSTATUS do_read(PIRP Irp, BOOLEAN wait, ULONG *bytes_read)
Definition: read.c:3138
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2645
void free_calc_job(calc_job *cj)
Definition: calcthread.c:53
void watch_registry(HANDLE regh)
Definition: registry.c:1024
LONG open_count
Definition: btrfs_drv.h:325
RTL_BITMAP bmp
Definition: btrfs_drv.h:513
UINT64 offset
Definition: btrfs_drv.h:521
LONGLONG lastinode
Definition: btrfs_drv.h:422
ACCESS_MASK access
Definition: btrfs_drv.h:357
void free_fcb(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) _In_ device_extension *Vcb, _Inout_ fcb *fcb)
Definition: btrfs.c:1502
LIST_ENTRY fcbs
Definition: btrfs_drv.h:431
ULONG part_num
Definition: btrfs_drv.h:820
UINT8 * buf
Definition: btrfs_drv.h:413
LIST_ENTRY list_entry
Definition: btrfs_drv.h:405
FAST_MUTEX HeaderMutex
Definition: btrfs_drv.h:192
NTSTATUS vol_write(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:206
ERESOURCE paging_resource
Definition: btrfs_drv.h:195
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
LONG refcount
Definition: btrfs_drv.h:590
const char * filename
Definition: ioapi.h:135
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
static USHORT PathLength
BOOLEAN(* tCcCopyReadEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread)
Definition: btrfs_drv.h:1779
LIST_ENTRY old_refs
Definition: btrfs_drv.h:562
UINT16 size
Definition: btrfs_drv.h:389
void add_checksum_entry(device_extension *Vcb, UINT64 address, ULONG length, UINT32 *csum, PIRP Irp)
Definition: flushthread.c:2438
PSID sid
Definition: btrfs_drv.h:862
NTSTATUS query_balance(device_extension *Vcb, void *data, ULONG length)
Definition: balance.c:3689
UINT8 type
Definition: btrfs_drv.h:227
device * device
Definition: btrfs_drv.h:881
UINT64 generation
Definition: btrfs_drv.h:811
BOOL find_data_address_in_chunk(device_extension *Vcb, chunk *c, UINT64 length, UINT64 *address)
LIST_ENTRY list_entry
Definition: btrfs_drv.h:907
void do_read_job(PIRP Irp)
Definition: worker-thread.c:26
LARGE_INTEGER resume_time
Definition: btrfs_drv.h:707
device ** devices
Definition: btrfs_drv.h:524
void add_changed_extent_ref(chunk *c, UINT64 address, UINT64 size, UINT64 root, UINT64 objid, UINT64 offset, UINT32 count, BOOL no_csum)
Definition: extent-tree.c:2075
LIST_ENTRY devices
Definition: btrfs_drv.h:724
#define _Requires_exclusive_lock_held_(a)
Definition: btrfs_drv.h:169
CHAR InputBuffer[80]
Definition: conmgr.c:33
PAGED_LOOKASIDE_LIST name_bit_lookaside
Definition: btrfs_drv.h:794
#define _In_opt_
Definition: no_sal2.h:213
struct _DUPLICATE_EXTENTS_DATA * PDUPLICATE_EXTENTS_DATA
balance_info balance
Definition: btrfs_drv.h:783
NTSTATUS stop_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3762
NTSTATUS error
Definition: btrfs_drv.h:712
SECTION_OBJECT_POINTERS segment_object
Definition: btrfs_drv.h:193
UNICODE_STRING filename
Definition: btrfs_drv.h:359
NTSTATUS mountmgr_add_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
Definition: volume.c:877
VOID(NTAPI * PPS_POST_PROCESS_INIT_ROUTINE)(VOID)
Definition: btrfs_drv.h:1830
UINT32 st_mode
Definition: btrfs.h:273
UINT8 obj_type
Definition: btrfs.h:124
struct _write_data_context * context
Definition: btrfs_drv.h:878
KTIMER flush_thread_timer
Definition: btrfs_drv.h:780
BTRFS_UUID uuid
Definition: btrfs_drv.h:809
static WCHAR superseded[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1817
LIST_ENTRY list_entry_all
Definition: btrfs_drv.h:306
UNICODE_STRING query_string
Definition: btrfs_drv.h:351
static USHORT USHORT * NewLength
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL had_drive_letter
Definition: btrfs_drv.h:817
KEVENT finished
Definition: btrfs_drv.h:671
NTSTATUS increase_extent_refcount(device_extension *Vcb, UINT64 address, UINT64 size, UINT8 type, void *data, KEY *firstitem, UINT8 level, PIRP Irp)
Definition: extent-tree.c:453
void * data
Definition: btrfs_drv.h:454
Definition: fs.h:78
UINT64 size
Definition: btrfs_drv.h:478
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
struct _RTL_USER_PROCESS_PARAMETERS * PRTL_USER_PROCESS_PARAMETERS
UNICODE_STRING bus_name
Definition: btrfs_drv.h:805
UNICODE_STRING name
Definition: btrfs_drv.h:828
PVOID DllBase
Definition: btrfs_drv.h:1805
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:843
NTSTATUS allocate_cache(device_extension *Vcb, BOOL *changed, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1346
UNICODE_STRING bus_name
Definition: btrfs_drv.h:833
BOOL ea_changed
Definition: btrfs_drv.h:294
root * extent_root
Definition: btrfs_drv.h:758
BOOL allow_extended_dasd_io
Definition: btrfs_drv.h:355
NTSTATUS write_compressed(fcb *fcb, UINT64 start_data, UINT64 end_data, void *data, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:4101
static __inline void do_xor(UINT8 *buf1, UINT8 *buf2, UINT32 len)
Definition: btrfs_drv.h:1636
LIST_ENTRY list_entry
Definition: btrfs_drv.h:381
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:338
ERESOURCE dirty_subvols_lock
Definition: btrfs_drv.h:777
KEY firstitem
Definition: btrfs_drv.h:693
struct _PEB * PPEB
fcb * old_cache
Definition: btrfs_drv.h:526
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:259
struct _device_extension * Vcb
Definition: btrfs_drv.h:400
UINT64 count
Definition: btrfs_drv.h:557
BOOL user_set_access_time
Definition: btrfs_drv.h:363
NTSTATUS update_chunk_caches_tree(device_extension *Vcb, PIRP Irp)
Definition: free-space.c:1884
BOOL has_wildcard
Definition: btrfs_drv.h:352
SECURITY_DESCRIPTOR * sd
Definition: btrfs_drv.h:265
const GUID * guid
PSID sid
Definition: btrfs_drv.h:856
root_nonpaged * nonpaged
Definition: btrfs_drv.h:424
file_ref * create_fileref(device_extension *Vcb)
Definition: create.c:113
EXTENT_DATA_REF edr
Definition: btrfs_drv.h:570
void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath)
Definition: search.c:261
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
tree * tree
Definition: btrfs_drv.h:467
PVOID Reserved3[2]
Definition: btrfs_drv.h:1836
LIST_ENTRY drop_roots
Definition: btrfs_drv.h:755
chunk * chunk
Definition: btrfs_drv.h:1210
LIST_ENTRY send_ops
Definition: btrfs_drv.h:787
_Function_class_(KSTART_ROUTINE) void mountmgr_thread(_In_ void *context)
Definition: balance.c:3029
ULONG change_count
Definition: btrfs_drv.h:492
static __inline UINT64 unix_time_to_win(BTRFS_TIME *t)
Definition: btrfs_drv.h:964
unsigned int UINT32
UINT16 datalen
Definition: btrfs_drv.h:203
LIST_ENTRY items
Definition: btrfs_drv.h:462
ERESOURCE changed_extents_lock
Definition: btrfs_drv.h:535
UINT32 sectors
Definition: btrfs_drv.h:587
UINT64 devices_loaded
Definition: btrfs_drv.h:731
chunk * get_chunk_from_address(device_extension *Vcb, UINT64 address)
Definition: write.c:93
struct _tree * tree
Definition: btrfs_drv.h:376
CACHE_MANAGER_CALLBACKS * cache_callbacks
Definition: cache.c:20
LIST_ENTRY list_entry
Definition: btrfs_drv.h:798
#define BTRFS_INODE_COMPRESS
Definition: propsheet.h:87
long LONG
Definition: pedump.c:60
UINT32 mount_no_trim
Definition: btrfs.c:79
Definition: devices.h:37
ANSI_STRING value
Definition: btrfs_drv.h:1233
LIST_ENTRY list_entry
Definition: btrfs_drv.h:305
_In_ ULONG BufferLength
Definition: usbdlib.h:225
ULONG num_errors
Definition: btrfs_drv.h:713
#define e
Definition: ke_i.h:82
UINT64 offset
Definition: btrfs_drv.h:202
BOOLEAN(* tPsIsDiskCountersEnabled)()
Definition: btrfs_drv.h:1771
UINT32 mount_no_barrier
Definition: btrfs.c:78
UINT8 compress_type
Definition: btrfs_drv.h:613
UINT64 chunks_left
Definition: btrfs_drv.h:710
#define _Releases_lock_(a)
Definition: btrfs_drv.h:170
BOOL stopping
Definition: btrfs_drv.h:703
BOOL disallow_dismount
Definition: btrfs_drv.h:737
UINT32 calc_crc32c(_In_ UINT32 seed, _In_reads_bytes_(msglen) UINT8 *msg, _In_ ULONG msglen)
Definition: crc32c.c:112
unsigned int uintptr_t
Definition: crtdefs.h:300
#define IRP_MJ_SET_EA
static PVOID ptr
Definition: dispmode.c:27
NTSTATUS open_fcb(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, UINT64 inode, UINT8 type, PANSI_STRING utf8, fcb *parent, fcb **pfcb, POOL_TYPE pooltype, PIRP Irp)
Definition: create.c:571
PEPROCESS PsGetThreadProcess(_In_ PETHREAD Thread)
#define __drv_aliasesMem
Definition: btrfs_drv.h:167
tree_data * paritem
Definition: btrfs_drv.h:402
NTKERNELAPI NTSTATUS NTAPI FsRtlValidateReparsePointBuffer(IN ULONG BufferLength, IN PREPARSE_DATA_BUFFER ReparseBuffer)
Definition: fsrtl.c:173
#define PsGetCurrentProcess
Definition: psfuncs.h:17
BOOL dirty
Definition: btrfs_drv.h:426
VOID(* tPsUpdateDiskCounters)(PEPROCESS Process, ULONG64 BytesRead, ULONG64 BytesWritten, ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount)
Definition: btrfs_drv.h:1773
BOOL is_extent_unique(device_extension *Vcb, UINT64 address, UINT64 size, PIRP Irp)
Definition: extent-tree.c:1696
_In_ UINT16 len
Definition: btrfs_drv.h:1080
void flush_subvol_fcbs(root *subvol)
Definition: fsctl.c:244
BOOL prop_compression_changed
Definition: btrfs_drv.h:295
LIST_ENTRY list_entry_balance
Definition: btrfs_drv.h:550
PFILE_OBJECT root_file
Definition: btrfs_drv.h:788
LIST_ENTRY list_entry
Definition: btrfs_drv.h:514
BOOL is_unique
Definition: btrfs_drv.h:411
KAFFINITY * PKAFFINITY
Definition: basetsd.h:197
struct _RTL_USER_PROCESS_PARAMETERS RTL_USER_PROCESS_PARAMETERS
struct pdo_device_extension pdo_device_extension
unsigned char BOOLEAN
BOOL shrinking
Definition: btrfs_drv.h:666
#define _Out_writes_bytes_opt_(a)
Definition: btrfs_drv.h:171
LIST_ENTRY ** hash_ptrs_uc
Definition: btrfs_drv.h:287
UINT msg
Definition: msvc.h:92
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER FSCTL_SET_INTEGRITY_INFORMATION_BUFFER
void galois_divpower(UINT8 *data, UINT8 div, UINT32 readlen)
Definition: galois.c:55
void mark_fcb_dirty(_In_ fcb *fcb)
Definition: btrfs.c:1464
BOOL clear_cache
Definition: btrfs_drv.h:623
smooth NULL
Definition: ftsmooth.c:416
void mark_fileref_dirty(_In_ file_ref *fileref)
Definition: btrfs.c:1486
root * r
Definition: btrfs_drv.h:461
char ext[3]
Definition: mkdosfs.c:358
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:812
#define _Out_writes_bytes_(size)
Definition: no_sal2.h:370
#define _Out_
Definition: no_sal2.h:323
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS decrease_extent_refcount_tree(device_extension *Vcb, UINT64 address, UINT64 size, UINT64 root, UINT8 level, PIRP Irp)
Definition: extent-tree.c:1559
BOOL updated_extents
Definition: btrfs_drv.h:409
Definition: parser.c:48
void add_trim_entry_avoid_sb(device_extension *Vcb, device *dev, UINT64 address, UINT64 size)
Definition: flushthread.c:5124
UINT64 used
Definition: btrfs_drv.h:522
NTSTATUS vol_file_system_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:342
HANDLE thread
Definition: btrfs_drv.h:337
struct _tree * parent
Definition: btrfs_drv.h:401
LIST_ENTRY job_list
Definition: btrfs_drv.h:603
_In_ fcb _In_ chunk _In_ UINT64 start_data
Definition: btrfs_drv.h:1321
NTSTATUS write_data(_In_ device_extension *Vcb, _In_ UINT64 address, _In_reads_bytes_(length) void *data, _In_ UINT32 length, _In_ write_data_context *wtc, _In_opt_ PIRP Irp, _In_opt_ chunk *c, _In_ BOOL file_write, _In_ UINT64 irp_offset, _In_ ULONG priority)
Definition: write.c:1886
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
NTSTATUS vol_power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:862
Definition: bufpool.h:45
BOOL stats_changed
Definition: btrfs_drv.h:496
LARGE_INTEGER finish_time
Definition: btrfs_drv.h:706
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
struct pdo_device_extension * pdode
Definition: btrfs_drv.h:832
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:777
_In_ UINT64 a
Definition: btrfs_drv.h:1005
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
NTSTATUS do_write_file(fcb *fcb, UINT64 start_data, UINT64 end_data, void *data, PIRP Irp, BOOL file_write, UINT32 irp_offset, LIST_ENTRY *rollback)
Definition: write.c:3947
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
BOOL readonly
Definition: btrfs_drv.h:537
BOOL extents_changed
Definition: btrfs_drv.h:292
ULONG ea_index
Definition: btrfs_drv.h:360
UINT64 address
Definition: btrfs_drv.h:898
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
NTSTATUS commit_batch_list(_Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp)
Definition: treefuncs.c:2263
LIST_ENTRY list_entry
Definition: btrfs_drv.h:507
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)
Definition: treefuncs.c:536
NTSTATUS find_item_to_level(device_extension *Vcb, root *r, traverse_ptr *tp, const KEY *searchkey, BOOL ignore, UINT8 level, PIRP Irp)
Definition: treefuncs.c:557
LONG refcount
Definition: btrfs_drv.h:324
#define TYPE_EXTENT_DATA_REF
Definition: btrfs.h:32
FILE_LOCK lock
Definition: btrfs_drv.h:266
NTSTATUS increase_extent_refcount_data(device_extension *Vcb, UINT64 address, UINT64 size, UINT64 root, UINT64 inode, UINT64 offset, UINT32 refcount, PIRP Irp)
Definition: extent-tree.c:891
NTSTATUS write_compressed_bit(fcb *fcb, UINT64 start_data, UINT64 end_data, void *data, BOOL *compressed, PIRP Irp, LIST_ENTRY *rollback)
Definition: compress.c:1093
GLuint GLfloat * val
Definition: glext.h:7180
NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
Definition: btrfs.c:5390
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
void find_gid(struct _fcb *fcb, struct _fcb *parfcb, PSECURITY_SUBJECT_CONTEXT subjcont)
Definition: security.c:841
UINT32 * csum
Definition: btrfs_drv.h:207
r l[0]
Definition: byte_order.h:167
#define BTRFS_ROOT_ROOT
Definition: btrfs.h:48
BOOL removable
Definition: btrfs_drv.h:486
ULONG ealen
Definition: btrfs_drv.h:276
void free_trees_root(device_extension *Vcb, root *r)
Definition: treefuncs.c:740
static __inline UINT64 fcb_alloc_size(fcb *fcb)
Definition: btrfs_drv.h:1762
BOOL created
Definition: btrfs_drv.h:536
NTSTATUS read_stream(fcb *fcb, UINT8 *data, UINT64 start, ULONG length, ULONG *pbr)
Definition: read.c:2707
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:256
#define IRP_MJ_QUERY_EA
FAST_MUTEX
Definition: extypes.h:17
void init_device(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ BOOL get_nums)
Definition: btrfs.c:3059
ERESOURCE dirty_fcbs_lock
Definition: btrfs_drv.h:773
NTSTATUS send_status
Definition: btrfs_drv.h:368
LARGE_INTEGER start_time
Definition: btrfs_drv.h:705
int64_t LONGLONG
Definition: typedefs.h:66
#define _Requires_lock_not_held_(a)
Definition: btrfs_drv.h:179
#define _Out_opt_
Definition: no_sal2.h:339
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LARGE_INTEGER SourceFileOffset
Definition: shellext.h:176
UINT64 query_dir_offset
Definition: btrfs_drv.h:350
LONG send_ops
Definition: btrfs_drv.h:430
#define TYPE_SHARED_DATA_REF
Definition: btrfs.h:35
NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, fcb *fcb, BOOL ignore_size, PIRP Irp)
Definition: create.c:436
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LIST_ENTRY DirNotifyList
Definition: btrfs_drv.h:748
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1228
NTSTATUS do_tree_writes(device_extension *Vcb, LIST_ENTRY *tree_writes, BOOL no_free)
Definition: flushthread.c:1489
BOOL user_set_creation_time
Definition: btrfs_drv.h:362
LIST_ENTRY dir_children_hash_uc
Definition: btrfs_drv.h:285
BOOL add_thread_job(device_extension *Vcb, PIRP Irp)
unsigned int BOOL
Definition: ntddk_ex.h:94
LIST_ENTRY list_entry
Definition: btrfs_drv.h:680
void space_list_subtract(chunk *c, BOOL deleting, UINT64 address, UINT64 length, LIST_ENTRY *rollback)
Definition: free-space.c:2014
GLsizeiptr size
Definition: glext.h:5919
LIST_ENTRY dir_children_index
Definition: btrfs_drv.h:283
struct _fcb fcb
Definition: btrfs_drv.h:1321
void clear_batch_list(device_extension *Vcb, LIST_ENTRY *batchlist)
Definition: treefuncs.c:1186
WCHAR * debug_desc
Definition: btrfs_drv.h:271
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ UINT8 _In_ UINT64 _In_ BOOL _In_ UINT64 irp_offset
Definition: btrfs_drv.h:1321
#define _Acquires_shared_lock_(a)
Definition: btrfs_drv.h:181
UCHAR flags
Definition: btrfs_drv.h:1234
NTKERNELAPI NTSTATUS NTAPI FsRtlGetEcpListFromIrp(IN PIRP Irp, OUT PECP_LIST *EcpList)
Definition: fsrtl.c:273
UINT32 adshash
Definition: btrfs_drv.h:300
NTSTATUS vol_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:286
#define __kernel_entry
Definition: specstrings.h:50
r parent
Definition: btrfs.c:2659
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
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:1225
static __inline BOOL is_subvol_readonly(root *r, PIRP Irp)
Definition: btrfs_drv.h:1012
NTSTATUS status
Definition: btrfs_drv.h:669
UINT16 filename_length
Definition: btrfs_drv.h:686
LIST_ENTRY xattrs
Definition: btrfs_drv.h:281
UINT64 index
Definition: btrfs_drv.h:226
NTSTATUS vol_shutdown(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:844
_STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y)
Definition: _cstdlib.h:137
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ UINT8 _In_ UINT64 _In_ BOOL file_write
Definition: btrfs_drv.h:1321
BOOL created
Definition: btrfs_drv.h:321
UINT64 address
Definition: btrfs_drv.h:511
static __inline void print_open_trees(device_extension *Vcb)
Definition: btrfs_drv.h:1607
NTKERNELAPI NTSTATUS NTAPI FsRtlGetNextExtraCreateParameter(IN PECP_LIST EcpList, IN PVOID CurrentEcpContext, OUT LPGUID NextEcpType OPTIONAL, OUT PVOID *NextEcpContext, OUT PULONG NextEcpContextSize OPTIONAL)
Definition: fsrtl.c:283
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
INT POOL_TYPE
Definition: typedefs.h:76
KEVENT finished
Definition: btrfs_drv.h:702
LIST_ENTRY itemlist
Definition: btrfs_drv.h:404
uint64_t ULONGLONG
Definition: typedefs.h:65
KEVENT cleared_event
Definition: btrfs_drv.h:340
KEVENT range_locks_event
Definition: btrfs_drv.h:533
LIST_ENTRY range_locks
Definition: btrfs_drv.h:531
#define _Ret_maybenull_
Definition: no_sal2.h:590
UINT16 datalen
Definition: btrfs_drv.h:455
UINT64 start
Definition: btrfs_drv.h:504
BYTE Reserved1[8]
Definition: btrfs_drv.h:1818
struct _file_ref file_ref
BOOL dirty
Definition: btrfs_drv.h:289
#define Vcb
Definition: cdprocs.h:1425
rollback_type
Definition: btrfs_drv.h:1218
static __inline void * map_user_buffer(PIRP Irp, ULONG priority)
Definition: btrfs_drv.h:956
#define S_ISDIR(mode)
Definition: btrfs_drv.h:1702
UINT8 gpow2(UINT8 e)
Definition: galois.c:69
ULONG CheckSum
Definition: btrfs_drv.h:1811
const GLubyte * c
Definition: glext.h:8905
BOOL atts_changed
Definition: btrfs_drv.h:291
LIST_ENTRY sys_chunks
Definition: btrfs_drv.h:766
_Ret_maybenull_ device * find_device_from_uuid(_In_ device_extension *Vcb, _In_ BTRFS_UUID *uuid)
Definition: btrfs.c:2943
LIST_ENTRY list_entry
Definition: btrfs_drv.h:851
NTSTATUS load_stored_free_space_cache(device_extension *Vcb, chunk *c, BOOL load_only, PIRP Irp)
Definition: free-space.c:453
UINT32 gid
Definition: btrfs_drv.h:863
UINT64 system_flags
Definition: btrfs_drv.h:753
PFILE_OBJECT locked_fileobj
Definition: btrfs_drv.h:739
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
PVOID Reserved6
Definition: btrfs_drv.h:1812
KEVENT event
Definition: btrfs_drv.h:670
NTSTATUS vol_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:34
void log_device_error(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ int error)
Definition: btrfs.c:5193
__m128i
Definition: emmintrin.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
NPAGED_LOOKASIDE_LIST fileref_np_lookaside
Definition: btrfs_drv.h:796
#define TYPE_EXTENT_REF_V0
Definition: btrfs.h:33
BOOL fcb_is_inline(fcb *fcb)
Definition: fsctl.c:3208
GLuint address
Definition: glext.h:9393
UINT32 count
Definition: btrfs.h:393
LIST_ENTRY list_entry
Definition: btrfs_drv.h:581
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
LIST_ENTRY hardlinks
Definition: btrfs_drv.h:277
_Success_(return) BOOL get_file_attributes_from_xattr(_In_reads_bytes_(len) char *val
ERESOURCE lock
Definition: btrfs_drv.h:604
struct _file_ref * fileref
Definition: btrfs_drv.h:278
LIST_ENTRY list_entry_index
Definition: btrfs_drv.h:235
LIST_ENTRY extents
Definition: btrfs_drv.h:273
NTSTATUS add_calc_job(device_extension *Vcb, UINT8 *data, UINT32 sectors, UINT32 *csum, calc_job **pcj)
Definition: calcthread.c:22
#define _Inout_
Definition: no_sal2.h:244
BOOL deleted
Definition: btrfs_drv.h:267
UINT64 subvol_id
Definition: btrfs_drv.h:619
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ERESOURCE fileref_lock
Definition: btrfs_drv.h:311
struct _LDR_DATA_TABLE_ENTRY * PLDR_DATA_TABLE_ENTRY
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER FSCTL_GET_INTEGRITY_INFORMATION_BUFFER
void get_raid56_lock_range(chunk *c, UINT64 address, UINT64 length, UINT64 *lockaddr, UINT64 *locklen)
Definition: write.c:2154
NTSTATUS sync_read_phys(_In_ PDEVICE_OBJECT DeviceObject, _In_ UINT64 StartingOffset, _In_ ULONG Length, _Out_writes_bytes_(Length) PUCHAR Buffer, _In_ BOOL override)
Definition: btrfs.c:2435
ERESOURCE child_lock
Definition: btrfs_drv.h:848
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
NTSTATUS zstd_decompress(UINT8 *inbuf, UINT32 inlen, UINT8 *outbuf, UINT32 outlen)
Definition: compress.c:1133
struct _tree_data tree_data
void * notification_entry
Definition: btrfs_drv.h:818
PDEVICE_OBJECT mounted_device
Definition: btrfs_drv.h:830
LARGE_INTEGER duration
Definition: btrfs_drv.h:708
* PFILE_OBJECT
Definition: iotypes.h:1954
BOOL loaded
Definition: xmlview.c:54
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL received
Definition: btrfs_drv.h:427
NTSTATUS update_changed_extent_ref(device_extension *Vcb, chunk *c, UINT64 address, UINT64 size, UINT64 root, UINT64 objid, UINT64 offset, INT32 count, BOOL no_csum, BOOL superseded, PIRP Irp)
Definition: extent-tree.c:1950
BYTE Reserved4[8]
Definition: btrfs_drv.h:1808
ULONG disk_num
Definition: btrfs_drv.h:819
struct _ccb * ccb
Definition: btrfs_drv.h:338
USHORT NodeType
Definition: btrfs_drv.h:346
GLbitfield flags
Definition: glext.h:7161
void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath)
Definition: search.c:506
BOOL parity
Definition: btrfs_drv.h:679
LIST_ENTRY list_entry
Definition: btrfs_drv.h:902
UINT8 level
Definition: btrfs_drv.h:692
#define TYPE_SHARED_BLOCK_REF
Definition: btrfs.h:34
UINT32 mount_readonly
Definition: btrfs.c:82
NTSTATUS read_file(fcb *fcb, UINT8 *data, UINT64 start, UINT64 length, ULONG *pbr, PIRP Irp)
Definition: read.c:2737
LIST_ENTRY list_entry
Definition: btrfs_drv.h:463
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
LIST_ENTRY trim_list
Definition: btrfs_drv.h:500
BOOL inode_item_changed
Definition: btrfs_drv.h:279
ANSI_STRING name
Definition: btrfs_drv.h:1232
NTSTATUS update_dev_item(device_extension *Vcb, device *device, PIRP Irp)
Definition: flushthread.c:3865
WCHAR * file_desc_fileref(_In_ file_ref *fileref)
Definition: btrfs.c:1295
PEPROCESS reserved
Definition: btrfs_drv.h:428
unsigned __int64 ULONG64
Definition: imports.h:198
UINT64 st_blocks
Definition: btrfs.h:268
BOOL ads
Definition: btrfs_drv.h:299
dir_child * dc
Definition: btrfs_drv.h:328
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ UINT8 _In_ UINT64 decoded_size
Definition: btrfs_drv.h:1321
tree_data * item
Definition: btrfs_drv.h:468
PVOID Reserved2[2]
Definition: btrfs_drv.h:1804
unsigned char UCHAR
Definition: xmlstorage.h:181
LIST_ENTRY listentry
Definition: btrfs_drv.h:861
LIST_ENTRY children
Definition: btrfs_drv.h:323
NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP *Pirp, UINT32 type)
Definition: fsctl.c:4794
PFILE_OBJECT fileobj
Definition: btrfs_drv.h:813
UINT32 mount_skip_balance
Definition: btrfs.c:77
struct _fcb_nonpaged fcb_nonpaged
UNICODE_STRING ImagePathName
Definition: btrfs_drv.h:1826
LIST_ENTRY dirty_subvols
Definition: btrfs_drv.h:776
GLenum const GLvoid * addr
Definition: glext.h:9621
tree_header header
Definition: btrfs_drv.h:396
ULONG SessionId
Definition: btrfs_drv.h:1844
void fcb_get_sd(fcb *fcb, struct _fcb *parent, BOOL look_for_xattr, PIRP Irp)
Definition: security.c:511
PETHREAD thread
Definition: btrfs_drv.h:506
prop_compression_type
Definition: btrfs_drv.h:240
_In_ PECP_LIST _In_opt_ PVOID CurrentEcpContext
Definition: fltkernel.h:2621
LONG refcount
Definition: btrfs_drv.h:258
Definition: parse.h:22
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:1397
BYTE Reserved1[2]
Definition: btrfs_drv.h:1833
BOOLEAN RtlIsNtDdiVersionAvailable(ULONG Version)
ULONG num_trim_entries
Definition: btrfs_drv.h:499
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ UINT8 compression
Definition: btrfs_drv.h:1321
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1838
PAGED_LOOKASIDE_LIST fileref_lookaside
Definition: btrfs_drv.h:792
NTSTATUS do_load_tree(device_extension *Vcb, tree_holder *th, root *r, tree *t, tree_data *td, BOOL *loaded, PIRP Irp)
Definition: treefuncs.c:253
BOOL recovered
Definition: btrfs_drv.h:677
#define VOID
Definition: acefi.h:82
LIST_ENTRY changed_extents
Definition: btrfs_drv.h:530
tree_holder treeholder
Definition: btrfs_drv.h:423
UINT64 find_extent_shared_tree_refcount(device_extension *Vcb, UINT64 address, UINT64 parent, PIRP Irp)
Definition: extent-tree.c:2118
UINT32 flush_interval
Definition: btrfs_drv.h:617
LIST_ENTRY all_fcbs
Definition: btrfs_drv.h:771
LIST_ENTRY list_entry_hash_uc
Definition: btrfs_drv.h:237
UINT32 * csum
Definition: btrfs_drv.h:586
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:333
Definition: btrfs_drv.h:1801
UINT32 debug_log_level
Definition: btrfs.c:69
GLenum GLsizei len
Definition: glext.h:6722
UINT32 count
Definition: btrfs.h:415
unsigned char BYTE
Definition: mem.h:68
UINT32 hash
Definition: btrfs_drv.h:229
UINT32 mount_allow_degraded
Definition: btrfs.c:81
NTSTATUS get_tree_new_address(device_extension *Vcb, tree *t, PIRP Irp, LIST_ENTRY *rollback)
Definition: flushthread.c:747
BOOL dirty
Definition: btrfs_drv.h:330
GLdouble s
Definition: gl.h:2039
Definition: _list.h:228
NTSTATUS vol_cleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:328
UINT64 total_chunks
Definition: btrfs_drv.h:709
NTSTATUS create_root(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ UINT64 id, _Out_ root **rootptr, _In_ BOOL no_tree, _In_ UINT64 offset, _In_opt_ PIRP Irp)
Definition: btrfs.c:1009
_In_ PECP_LIST _In_opt_ PVOID _Out_opt_ LPGUID _Outptr_opt_ PVOID _Out_opt_ ULONG * NextEcpContextSize
Definition: fltkernel.h:2621
UINT64 get_extent_data_ref_hash2(UINT64 root, UINT64 objid, UINT64 offset)
Definition: extent-tree.c:34
fcb * fcb
Definition: btrfs_drv.h:316
void add_volume_device(superblock *sb, PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath, UINT64 length, ULONG disk_num, ULONG part_num)
Definition: volume.c:1000
Definition: typedefs.h:117
UNICODE_STRING CommandLine
Definition: btrfs_drv.h:1827
NTSTATUS decrease_extent_refcount_data(device_extension *Vcb, UINT64 address, UINT64 size, UINT64 root, UINT64 inode, UINT64 offset, UINT32 refcount, BOOL superseded, PIRP Irp)
Definition: extent-tree.c:1547
LIST_ENTRY dirty_fcbs
Definition: btrfs_drv.h:772
PVOID Reserved5[52]
Definition: btrfs_drv.h:1840
#define _Releases_exclusive_lock_(a)
Definition: btrfs_drv.h:174
BOOL has_new_address
Definition: btrfs_drv.h:408
BOOL seeding
Definition: btrfs_drv.h:816
NTSTATUS set_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: reparse.c:365
INODE_ITEM inode_item
Definition: btrfs_drv.h:264
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSTATUS insert_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ UINT64 obj_id, _In_ UINT8 obj_type, _In_ UINT64 offset, _In_reads_bytes_opt_(size) _When_(return >=0, __drv_aliasesMem) void *data, _In_ UINT16 size, _Out_opt_ traverse_ptr *ptp, _In_opt_ PIRP Irp)
Definition: treefuncs.c:838
BOOL atts_deleted
Definition: btrfs_drv.h:291
NTSTATUS registry_load_volume_options(device_extension *Vcb)
Definition: registry.c:36
USHORT valuelen
Definition: btrfs_drv.h:250
NTSTATUS get_reparse_point(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, void *buffer, DWORD buflen, ULONG_PTR *retlen)
Definition: reparse.c:20
#define WINAPI
Definition: msvc.h:20
BOOL compress_force
Definition: btrfs_drv.h:612
NTSTATUS start_balance(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3497
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
static __inline BOOL write_fcb_compressed(fcb *fcb)
Definition: btrfs_drv.h:1619
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
Definition: btrfs_drv.h:1321
void add_group_mapping(WCHAR *sidstring, ULONG sidstringlength, UINT32 gid)
Definition: security.c:145
NTSTATUS alloc_chunk(device_extension *Vcb, UINT64 flags, chunk **pc, BOOL full_size)
Definition: write.c:365
NTKERNELAPI ULONG NTAPI KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
Definition: ke.c:15
LIST_ENTRY partial_stripes
Definition: btrfs_drv.h:545
void raid6_recover2(UINT8 *sectors, UINT16 num_stripes, ULONG sector_size, UINT16 missing1, UINT16 missing2, UINT8 *out)
Definition: read.c:862
BOOL has_address
Definition: btrfs_drv.h:398
KEVENT flush_thread_finished
Definition: btrfs_drv.h:781
__u8 sector_size[2]
Definition: mkdosfs.c:361
LIST_ENTRY space_size
Definition: btrfs_drv.h:528
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:834
UINT32 no_pnp
Definition: btrfs.c:83
void add_extent(_In_ fcb *fcb, _In_ LIST_ENTRY *prevextle, _In_ __drv_aliasesMem extent *newext)
Definition: write.c:2359
BOOL dev_readonly
Definition: btrfs_drv.h:667
ULONG get_reparse_tag(device_extension *Vcb, root *subvol, UINT64 inode, UINT8 type, ULONG atts, BOOL lxss, PIRP Irp)
Definition: dirctrl.c:58
BOOL user_set_write_time
Definition: btrfs_drv.h:364
LIST_ENTRY list_entry
Definition: btrfs_drv.h:885
UINT64 address
Definition: btrfs_drv.h:477
NTSTATUS vol_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:292
UINT64 generation
Definition: btrfs_drv.h:375
ERESOURCE dir_children_lock
Definition: btrfs_drv.h:196
ULONG TimeDateStamp
Definition: btrfs_drv.h:1814
UINT64 root
Definition: btrfs_drv.h:691
UINT64 last_alloc
Definition: btrfs_drv.h:543
UINT64 devid
Definition: btrfs_drv.h:810
NTSTATUS check_csum(device_extension *Vcb, UINT8 *data, UINT32 sectors, UINT32 *csum)
Definition: read.c:89
LIST_ENTRY chunks
Definition: btrfs_drv.h:767
NTSTATUS load_cache_chunk(device_extension *Vcb, chunk *c, PIRP Irp)
Definition: free-space.c:947
struct _write_data_context write_data_context
LIST_ENTRY list_entry
Definition: btrfs_drv.h:342
#define _In_
Definition: no_sal2.h:204
file_ref * root_fileref
Definition: btrfs_drv.h:742
struct _ECP_LIST * PECP_LIST
Definition: fsrtltypes.h:139
ULONG balance_num
Definition: btrfs_drv.h:668
HANDLE thread
Definition: btrfs_drv.h:699
NTSTATUS send_subvol(device_extension *Vcb, void *data, ULONG datalen, PFILE_OBJECT FileObject, PIRP Irp)
Definition: send.c:3596
NTSTATUS load_csum(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, UINT32 *csum, UINT64 start, UINT64 length, PIRP Irp)
Definition: create.c:382
#define _Lock_level_order_(a, b)
Definition: btrfs_drv.h:177
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:1752
extent * ext
Definition: btrfs_drv.h:1215
Definition: btrfs.h:122
ULONG get_reparse_tag_fcb(fcb *fcb)
Definition: dirctrl.c:34
void do_write_job(device_extension *Vcb, PIRP Irp)
Definition: worker-thread.c:66
UINT64 num_reads
Definition: btrfs.c:65
PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine
Definition: btrfs_drv.h:1841
BOOL is_metadata
Definition: btrfs_drv.h:678
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void * data
Definition: btrfs_drv.h:1321
BOOL ignore
Definition: btrfs_drv.h:205
NTSTATUS vol_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:777
const WCHAR * action
Definition: action.c:7779
BOOL chunk_usage_found
Definition: btrfs_drv.h:765
_Ret_z_ WCHAR * file_desc(_In_ PFILE_OBJECT FileObject)
Definition: btrfs.c:1332
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:236
ULONG atts
Definition: btrfs_drv.h:269
NTSTATUS query_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode, void *data, ULONG length)
Definition: scrub.c:3302
ERESOURCE resource
Definition: btrfs_drv.h:194
UINT64 address
Definition: btrfs_drv.h:675
UINT64 st_size
Definition: btrfs.h:267
struct _fcb_nonpaged * nonpaged
Definition: btrfs_drv.h:257
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
BOOL reloc
Definition: btrfs_drv.h:538
LIST_ENTRY roots
Definition: btrfs_drv.h:754
UINT32 mount_compress_force
Definition: btrfs.c:71
drv_calc_threads calcthreads
Definition: btrfs_drv.h:782
void * context
Definition: btrfs_drv.h:339
unsigned short USHORT
Definition: pedump.c:61
ERESOURCE stats_lock
Definition: btrfs_drv.h:700
#define _In_z_
Definition: no_sal2.h:239
GLuint start
Definition: gl.h:1545
static const char lxgid[]
Definition: btrfs_drv.h:1239
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1803
ULONG disposition
Definition: btrfs_drv.h:348
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1837
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
NTSTATUS calc_csum(_In_ device_extension *Vcb, _In_reads_bytes_(sectors *Vcb->superblock.sector_size) UINT8 *data, _In_ UINT32 sectors, _Out_writes_bytes_(sectors *sizeof(UINT32)) UINT32 *csum)
Definition: write.c:2790
_In_ UINT64 _In_ UINT64 _In_ UINT64 generation
Definition: btrfs.c:2644
BOOL csum_loaded
Definition: btrfs_drv.h:272
void remove_dir_child_from_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:593
UINT8 gdiv(UINT8 a, UINT8 b)
Definition: galois.c:80
void chunk_unlock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ UINT64 start, _In_ UINT64 length)
Definition: btrfs.c:5170
static const char lxmod[]
Definition: btrfs_drv.h:1240
NTSTATUS vol_lock_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:348
void insert_dir_child_into_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:1253
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1807
BOOL cache_loaded
Definition: btrfs_drv.h:540
NTSTATUS clear_free_space_cache(device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp)
Definition: free-space.c:58
PVOID Reserved3[2]
Definition: btrfs_drv.h:1806
VOID(* tFsRtlUpdateDiskCounters)(ULONG64 BytesRead, ULONG64 BytesWritten)
Definition: btrfs_drv.h:1788
LIST_ENTRY refs
Definition: btrfs_drv.h:561
LIST_ENTRY listentry
Definition: btrfs_drv.h:855
UINT64 address
Definition: btrfs_drv.h:554
BOOL inserted
Definition: btrfs_drv.h:383
NPAGED_LOOKASIDE_LIST range_lock_lookaside
Definition: btrfs_drv.h:795
PVOID Reserved1[2]
Definition: btrfs_drv.h:1802
unsigned short UINT16
unsigned int * PULONG
Definition: retypes.h:1
struct _root * subvol
Definition: btrfs_drv.h:261
Definition: list.h:27
BOOL is_file_name_valid(_In_ PUNICODE_STRING us, _In_ BOOL posix)
Definition: btrfs.c:5101
UINT64 flags
Definition: btrfs.h:275
NTSTATUS delete_fileref(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
Definition: btrfs.c:1949
DEV_ITEM devitem
Definition: btrfs_drv.h:485
ULONG adsmaxlen
Definition: btrfs_drv.h:301
ANSI_STRING adsdata
Definition: btrfs_drv.h:303
NTSTATUS delete_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: reparse.c:440
LARGE_INTEGER TargetFileOffset
Definition: shellext.h:177
__u8 sectors[2]
Definition: mkdosfs.c:366
BOOL created
Definition: btrfs_drv.h:297
#define _When_(expr, annos)
Definition: no_sal2.h:639
ERESOURCE lock
Definition: btrfs_drv.h:534
LIST_ENTRY list_entry
Definition: btrfs_drv.h:248
#define _Post_satisfies_(a)
Definition: btrfs_drv.h:173
UINT64 address
Definition: btrfs_drv.h:1208
UINT32 mount_flush_interval
Definition: btrfs.c:75
UINT16 edsize
Definition: write.c:2828
NTSTATUS NTAPI FsRtlRemoveDotsFromPath(PWSTR OriginalString, USHORT PathLength, USHORT *NewLength)
UINT32 hash
Definition: btrfs_drv.h:397
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
drv_calc_thread * threads
Definition: btrfs_drv.h:605
USHORT size
Definition: btrfs_drv.h:580
CHUNK_ITEM * chunk_item
Definition: btrfs_drv.h:519
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
UNICODE_STRING pnp_name
Definition: btrfs.c:3878
#define IRP_MJ_READ
Definition: rdpdr.c:46