ReactOS  0.4.13-dev-479-gec9c8fd
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_CASE_SENSITIVE "user.casesensitive"
105 #define EA_CASE_SENSITIVE_HASH 0x1a9d97d4
106 
107 #define EA_PROP_COMPRESSION "btrfs.compression"
108 #define EA_PROP_COMPRESSION_HASH 0x20ccdf69
109 
110 #define MAX_EXTENT_SIZE 0x8000000 // 128 MB
111 #define COMPRESSED_EXTENT_SIZE 0x20000 // 128 KB
112 
113 #define READ_AHEAD_GRANULARITY COMPRESSED_EXTENT_SIZE // really ought to be a multiple of COMPRESSED_EXTENT_SIZE
114 
115 #define IO_REPARSE_TAG_LXSS_SYMLINK 0xa000001d // undocumented?
116 
117 #define IO_REPARSE_TAG_LXSS_SOCKET 0x80000023
118 #define IO_REPARSE_TAG_LXSS_FIFO 0x80000024
119 #define IO_REPARSE_TAG_LXSS_CHARDEV 0x80000025
120 #define IO_REPARSE_TAG_LXSS_BLOCKDEV 0x80000026
121 
122 #define BTRFS_VOLUME_PREFIX L"\\Device\\Btrfs{"
123 
124 #ifdef _MSC_VER
125 #define try __try
126 #define except __except
127 #define finally __finally
128 #else
129 #define try if (1)
130 #define except(x) if (0 && (x))
131 #define finally if (1)
132 #endif
133 
134 #ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING
135 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
136 #endif
137 
138 #ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME
139 #define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400
140 #endif
141 
142 #ifndef FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
143 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
144 #endif
145 
146 typedef struct _FILE_ID_128 {
149 
150 typedef struct _DUPLICATE_EXTENTS_DATA {
156 
157 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_ACCESS)
158 
161  WORD Reserved;
162  DWORD Flags;
166 
169  WORD Reserved;
170  DWORD Flags;
172 
173 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
174 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
175 
176 #ifndef __REACTOS__
177 #ifndef _MSC_VER
178 #define __drv_aliasesMem
179 #define _Requires_lock_held_(a)
180 #define _Requires_exclusive_lock_held_(a)
181 #define _Releases_lock_(a)
182 #define _Out_writes_bytes_opt_(a)
183 #define _Pre_satisfies_(a)
184 #define _Post_satisfies_(a)
185 #define _Releases_exclusive_lock_(a)
186 #define _Dispatch_type_(a)
187 #define _Create_lock_level_(a)
188 #define _Lock_level_order_(a,b)
189 #define _Has_lock_level_(a)
190 #define _Requires_lock_not_held_(a)
191 #define _Acquires_exclusive_lock_(a)
192 #define _Acquires_shared_lock_(a)
193 #endif
194 #endif
195 
196 _Create_lock_level_(tree_lock)
197 _Create_lock_level_(fcb_lock)
198 _Lock_level_order_(tree_lock, fcb_lock)
199 
200 struct _device_extension;
201 
202 typedef struct _fcb_nonpaged {
208 } fcb_nonpaged;
209 
210 struct _root;
211 
212 typedef struct {
219 
221 
223 } extent;
224 
225 typedef struct {
231 } hardlink;
232 
233 struct _file_ref;
234 
235 typedef struct {
249 } dir_child;
250 
256 };
257 
258 typedef struct {
263  char data[1];
264 } xattr;
265 
266 typedef struct _fcb {
272  struct _root* subvol;
297 
303 
313 
319 
323 } fcb;
324 
325 typedef struct {
328 
329 typedef struct _file_ref {
341  struct _file_ref* parent;
344 
346 
349 } file_ref;
350 
351 typedef struct {
353  struct _ccb* ccb;
354  void* context;
358 } send_info;
359 
360 typedef struct _ccb {
384 } ccb;
385 
386 struct _device_extension;
387 
388 typedef struct {
391  struct _tree* tree;
392 } tree_holder;
393 
394 typedef struct _tree_data {
399 
400  union {
402 
403  struct {
406  };
407  };
408 } tree_data;
409 
410 typedef struct {
412 } tree_nonpaged;
413 
414 typedef struct _tree {
421  struct _tree* parent;
423  struct _root* root;
434 } tree;
435 
436 typedef struct {
438 } root_nonpaged;
439 
440 typedef struct _root {
442  LONGLONG lastinode; // signed so we can use InterlockedIncrement64
457 } root;
458 
473 };
474 
475 typedef struct {
477  void* data;
479  enum batch_operation operation;
481 } batch_item;
482 
483 typedef struct {
484  root* r;
487 } batch_root;
488 
489 typedef struct {
492 } traverse_ptr;
493 
494 typedef struct _root_cache {
496  struct _root_cache* next;
497 } root_cache;
498 
499 typedef struct {
504 } space;
505 
506 typedef struct {
516  ULONG disk_num;
517  ULONG part_num;
518  UINT64 stats[5];
524 } device;
525 
526 typedef struct {
531 } range_lock;
532 
533 typedef struct {
540 
541 typedef struct {
571 
574 } chunk;
575 
576 typedef struct {
588 
589 typedef struct {
591 
592  union {
595  };
596 
599 
600 typedef struct {
602  void* data;
605 } sys_chunk;
606 
607 typedef struct {
611  LONG pos, done;
615 } calc_job;
616 
617 typedef struct {
623 
624 typedef struct {
631 
632 typedef struct {
648 } mount_options;
649 
650 #define VCB_TYPE_FS 1
651 #define VCB_TYPE_CONTROL 2
652 #define VCB_TYPE_VOLUME 3
653 #define VCB_TYPE_PDO 4
654 
655 #ifdef DEBUG_STATS
656 typedef struct {
658  UINT64 data_read;
659  UINT64 read_total_time;
660  UINT64 read_csum_time;
661  UINT64 read_disk_time;
662 
663  UINT64 num_opens;
664  UINT64 open_total_time;
665  UINT64 num_overwrites;
666  UINT64 overwrite_total_time;
667  UINT64 num_creates;
668  UINT64 create_total_time;
669  UINT64 open_fcb_calls;
670  UINT64 open_fcb_time;
671  UINT64 open_fileref_child_calls;
672  UINT64 open_fileref_child_time;
673  UINT64 fcb_lock_time;
674 } debug_stats;
675 #endif
676 
677 #define BALANCE_OPTS_DATA 0
678 #define BALANCE_OPTS_METADATA 1
679 #define BALANCE_OPTS_SYSTEM 2
680 
681 typedef struct {
695 } balance_info;
696 
697 typedef struct {
704 
705  union {
706  struct {
711  } data;
712 
713  struct {
717  } metadata;
718  };
719 } scrub_error;
720 
721 typedef struct {
738 } scrub_info;
739 
741 
742 typedef struct _device_extension {
748 #ifdef DEBUG_STATS
749  debug_stats stats;
750 #endif
751 #ifdef DEBUG_CHUNK_LOCKS
752  LONG chunk_locks_held;
753 #endif
767  _Has_lock_level_(fcb_lock) ERESOURCE fcb_lock;
770  _Has_lock_level_(tree_lock) ERESOURCE tree_lock;
825 
826 typedef struct {
832 
833 typedef struct {
847 } volume_child;
848 
849 struct pdo_device_extension;
850 
851 typedef struct _volume_device_extension {
863 
864 typedef struct pdo_device_extension {
870 
875 
878 
879 typedef struct {
883 } uid_map;
884 
885 typedef struct {
889 } gid_map;
890 
898 };
899 
900 struct _write_data_context;
901 
902 typedef struct {
912 
913 typedef struct _write_data_context {
921 
922 typedef struct {
928 } tree_write;
929 
930 typedef struct {
933 } name_bit;
934 
936 _Acquires_shared_lock_(Vcb->fcb_lock)
937 static __inline void acquire_fcb_lock_shared(device_extension* Vcb) {
938 #ifdef DEBUG_STATS
939  LARGE_INTEGER time1, time2;
940 
941  if (ExAcquireResourceSharedLite(&Vcb->fcb_lock, FALSE))
942  return;
943 
945 #endif
946 
947  ExAcquireResourceSharedLite(&Vcb->fcb_lock, TRUE);
948 
949 #ifdef DEBUG_STATS
951  Vcb->stats.fcb_lock_time += time2.QuadPart - time1.QuadPart;
952 #endif
953 }
954 
955 _Requires_lock_not_held_(Vcb->fcb_lock)
957 static __inline void acquire_fcb_lock_exclusive(device_extension* Vcb) {
958 #ifdef DEBUG_STATS
959  LARGE_INTEGER time1, time2;
960 
961  if (ExAcquireResourceExclusiveLite(&Vcb->fcb_lock, FALSE))
962  return;
963 
965 #endif
966 
968 
969 #ifdef DEBUG_STATS
971  Vcb->stats.fcb_lock_time += time2.QuadPart - time1.QuadPart;
972 #endif
973 }
974 
976 _Releases_lock_(Vcb->fcb_lock)
977 static __inline void release_fcb_lock(device_extension* Vcb) {
978  ExReleaseResourceLite(&Vcb->fcb_lock);
979 }
980 
981 static __inline void* map_user_buffer(PIRP Irp, ULONG priority) {
982  if (!Irp->MdlAddress) {
983  return Irp->UserBuffer;
984  } else {
985  return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, priority);
986  }
987 }
988 
989 static __inline UINT64 unix_time_to_win(BTRFS_TIME* t) {
990  return (t->seconds * 10000000) + (t->nanoseconds / 100) + 116444736000000000;
991 }
992 
993 static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME* out) {
994  ULONGLONG l = (ULONGLONG)t.QuadPart - 116444736000000000;
995 
996  out->seconds = l / 10000000;
997  out->nanoseconds = (UINT32)((l % 10000000) * 100);
998 }
999 
1000 _Post_satisfies_(*stripe>=0&&*stripe<num_stripes)
1001 static __inline void get_raid0_offset(_In_ UINT64 off, _In_ UINT64 stripe_length, _In_ UINT16 num_stripes, _Out_ UINT64* stripeoff, _Out_ UINT16* stripe) {
1002  UINT64 initoff, startoff;
1003 
1004  startoff = off % (num_stripes * stripe_length);
1005  initoff = (off / (num_stripes * stripe_length)) * stripe_length;
1006 
1007  *stripe = (UINT16)(startoff / stripe_length);
1008  *stripeoff = initoff + startoff - (*stripe * stripe_length);
1009 }
1010 
1011 /* We only have 64 bits for a file ID, which isn't technically enough to be
1012  * unique on Btrfs. We fudge it by having three bytes for the subvol and
1013  * five for the inode, which should be good enough.
1014  * Inodes are also 64 bits on Linux, but the Linux driver seems to get round
1015  * this by tricking it into thinking subvols are separate volumes. */
1016 static __inline UINT64 make_file_id(root* r, UINT64 inode) {
1017  return (r->id << 40) | (inode & 0xffffffffff);
1018 }
1019 
1020 #define keycmp(key1, key2)\
1021  ((key1.obj_id < key2.obj_id) ? -1 :\
1022  ((key1.obj_id > key2.obj_id) ? 1 :\
1023  ((key1.obj_type < key2.obj_type) ? -1 :\
1024  ((key1.obj_type > key2.obj_type) ? 1 :\
1025  ((key1.offset < key2.offset) ? -1 :\
1026  ((key1.offset > key2.offset) ? 1 :\
1027  0))))))
1028 
1029 _Post_satisfies_(return>=n)
1031  if (n & (a - 1))
1032  n = (n + a) & ~(a - 1);
1033 
1034  return n;
1035 }
1036 
1037 __inline static BOOL is_subvol_readonly(root* r, PIRP Irp) {
1038  if (!(r->root_item.flags & BTRFS_SUBVOL_READONLY))
1039  return FALSE;
1040 
1041  if (!r->reserved)
1042  return TRUE;
1043 
1044  return (!Irp || Irp->RequestorMode == UserMode) && PsGetCurrentProcess() != r->reserved ? TRUE : FALSE;
1045 }
1046 
1048  switch (type) {
1049  case TYPE_TREE_BLOCK_REF:
1050  return sizeof(TREE_BLOCK_REF);
1051 
1052  case TYPE_EXTENT_DATA_REF:
1053  return sizeof(EXTENT_DATA_REF);
1054 
1055  case TYPE_EXTENT_REF_V0:
1056  return sizeof(EXTENT_REF_V0);
1057 
1058  case TYPE_SHARED_BLOCK_REF:
1059  return sizeof(SHARED_BLOCK_REF);
1060 
1061  case TYPE_SHARED_DATA_REF:
1062  return sizeof(SHARED_DATA_REF);
1063 
1064  default:
1065  return 0;
1066  }
1067 }
1068 
1069 __inline static UINT32 get_extent_data_refcount(UINT8 type, void* data) {
1070  switch (type) {
1071  case TYPE_TREE_BLOCK_REF:
1072  return 1;
1073 
1074  case TYPE_EXTENT_DATA_REF:
1075  {
1077  return edr->count;
1078  }
1079 
1080  case TYPE_EXTENT_REF_V0:
1081  {
1082  EXTENT_REF_V0* erv0 = (EXTENT_REF_V0*)data;
1083  return erv0->count;
1084  }
1085 
1086  case TYPE_SHARED_BLOCK_REF:
1087  return 1;
1088 
1089  case TYPE_SHARED_DATA_REF:
1090  {
1092  return sdr->count;
1093  }
1094 
1095  default:
1096  return 0;
1097  }
1098 }
1099 
1100 // in btrfs.c
1103 
1104 _Success_(return)
1105 BOOL get_file_attributes_from_xattr(_In_reads_bytes_(len) char* val, _In_ UINT16 len, _Out_ ULONG* atts);
1106 
1108  _In_ UINT8 type, _In_ BOOL dotfile, _In_ BOOL ignore_xa, _In_opt_ PIRP Irp);
1109 
1111 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,
1113 
1114 #ifndef DEBUG_FCB_REFCOUNTS
1115 void free_fcb(_Inout_ fcb* fcb);
1116 #endif
1117 void free_fileref(_Inout_ file_ref* fr);
1121  _Out_ root** rootptr, _In_ BOOL no_tree, _In_ UINT64 offset, _In_opt_ PIRP Irp);
1124  _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ BOOLEAN Override, _Out_opt_ IO_STATUS_BLOCK* iosb);
1128 
1129 #ifdef DEBUG_CHUNK_LOCKS
1130 #define acquire_chunk_lock(c, Vcb) { ExAcquireResourceExclusiveLite(&c->lock, TRUE); InterlockedIncrement(&Vcb->chunk_locks_held); }
1131 #define release_chunk_lock(c, Vcb) { InterlockedDecrement(&Vcb->chunk_locks_held); ExReleaseResourceLite(&c->lock); }
1132 #else
1133 #define acquire_chunk_lock(c, Vcb) ExAcquireResourceExclusiveLite(&(c)->lock, TRUE)
1134 #define release_chunk_lock(c, Vcb) ExReleaseResourceLite(&(c)->lock)
1135 #endif
1136 
1137 _Ret_z_
1140 void mark_fcb_dirty(_In_ fcb* fcb);
1141 void mark_fileref_dirty(_In_ file_ref* fileref);
1152 #ifdef __REACTOS__
1154 #else
1156 #endif
1157 void reap_fcb(fcb* fcb);
1162 
1163 #ifdef _MSC_VER
1164 #define funcname __FUNCTION__
1165 #else
1166 #define funcname __func__
1167 #endif
1168 
1169 extern BOOL have_sse2;
1170 
1171 extern UINT32 mount_compress;
1174 extern UINT32 mount_zlib_level;
1175 extern UINT32 mount_zstd_level;
1177 extern UINT32 mount_max_inline;
1178 extern UINT32 mount_skip_balance;
1179 extern UINT32 mount_no_barrier;
1180 extern UINT32 mount_no_trim;
1181 extern UINT32 mount_clear_cache;
1183 extern UINT32 mount_readonly;
1184 extern UINT32 no_pnp;
1185 
1186 #ifdef _DEBUG
1187 
1188 extern BOOL log_started;
1189 extern UINT32 debug_log_level;
1190 
1191 #ifdef DEBUG_LONG_MESSAGES
1192 
1193 #define MSG(fn, file, line, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, file, line, s, ##__VA_ARGS__) : 0
1194 
1195 #define TRACE(s, ...) MSG(funcname, __FILE__, __LINE__, s, 3, ##__VA_ARGS__)
1196 #define WARN(s, ...) MSG(funcname, __FILE__, __LINE__, s, 2, ##__VA_ARGS__)
1197 #define FIXME(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1198 #define ERR(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1199 
1200 void _debug_message(_In_ const char* func, _In_ const char* file, _In_ unsigned int line, _In_ char* s, ...);
1201 
1202 #else
1203 
1204 #define MSG(fn, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, s, ##__VA_ARGS__) : 0
1205 
1206 #define TRACE(s, ...) MSG(funcname, s, 3, ##__VA_ARGS__)
1207 #define WARN(s, ...) MSG(funcname, s, 2, ##__VA_ARGS__)
1208 #define FIXME(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1209 #define ERR(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1210 
1211 void _debug_message(_In_ const char* func, _In_ char* s, ...);
1212 
1213 #endif
1214 
1215 #else
1216 
1217 #define TRACE(s, ...)
1218 #define WARN(s, ...)
1219 #define FIXME(s, ...) DbgPrint("Btrfs FIXME : %s : " s, funcname, ##__VA_ARGS__)
1220 #define ERR(s, ...) DbgPrint("Btrfs ERR : %s : " s, funcname, ##__VA_ARGS__)
1221 
1222 #endif
1223 
1224 #ifdef DEBUG_FCB_REFCOUNTS
1225 void _free_fcb(_Inout_ fcb* fcb, _In_ const char* func);
1226 #define free_fcb(fcb) _free_fcb(fcb, funcname)
1227 #endif
1228 
1229 // in fastio.c
1231 
1232 // in crc32c.c
1233 UINT32 calc_crc32c(_In_ UINT32 seed, _In_reads_bytes_(msglen) UINT8* msg, _In_ ULONG msglen);
1234 
1235 typedef struct {
1241 } rollback_space;
1242 
1243 typedef struct {
1246 } rollback_extent;
1247 
1253 };
1254 
1255 typedef struct {
1257  void* ptr;
1259 } rollback_item;
1260 
1261 typedef struct {
1266 } ea_item;
1267 
1268 static const char lxuid[] = "$LXUID";
1269 static const char lxgid[] = "$LXGID";
1270 static const char lxmod[] = "$LXMOD";
1271 static const char lxdev[] = "$LXDEV";
1272 
1273 // in treefuncs.c
1275  _In_ const KEY* searchkey, _In_ BOOL ignore, _In_opt_ PIRP Irp);
1281  _In_ UINT8 obj_type, _In_ UINT64 offset, _In_reads_bytes_opt_(size) _When_(return >= 0, __drv_aliasesMem) void* data,
1284 void free_tree(tree* t);
1292 void clear_batch_list(device_extension* Vcb, LIST_ENTRY* batchlist);
1294 
1295 // in search.c
1297 
1298 _Function_class_(KSTART_ROUTINE)
1299 #ifdef __REACTOS__
1300 void NTAPI mountmgr_thread(_In_ void* context);
1301 #else
1302 void mountmgr_thread(_In_ void* context);
1303 #endif
1304 
1305 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1306 #ifdef __REACTOS__
1308 #else
1310 #endif
1311 
1315 
1316 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1317 #ifdef __REACTOS__
1318 NTSTATUS NTAPI volume_notification(PVOID NotificationStructure, PVOID Context);
1319 #else
1320 NTSTATUS volume_notification(PVOID NotificationStructure, PVOID Context);
1321 #endif
1322 
1324  _In_ volume_child* vc, _In_ BOOL skip_dev);
1325 
1326 // in cache.c
1328 void free_cache();
1330 
1331 // in write.c
1344 
1348 
1353 
1357 void get_raid56_lock_range(chunk* c, UINT64 address, UINT64 length, UINT64* lockaddr, UINT64* locklen);
1363 void add_extent(_In_ fcb* fcb, _In_ LIST_ENTRY* prevextle, _In_ __drv_aliasesMem extent* newext);
1364 
1365 // in dirctrl.c
1366 
1369 NTSTATUS NTAPI drv_directory_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1370 
1373 
1374 // in security.c
1375 
1378 NTSTATUS NTAPI drv_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1379 
1382 NTSTATUS NTAPI drv_set_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1383 
1384 void fcb_get_sd(fcb* fcb, struct _fcb* parent, BOOL look_for_xattr, PIRP Irp);
1385 void add_user_mapping(WCHAR* sidstring, ULONG sidstringlength, UINT32 uid);
1386 void add_group_mapping(WCHAR* sidstring, ULONG sidstringlength, UINT32 gid);
1389 NTSTATUS fcb_get_new_sd(fcb* fcb, file_ref* parfileref, ACCESS_STATE* as);
1390 void find_gid(struct _fcb* fcb, struct _fcb* parfcb, PSECURITY_SUBJECT_CONTEXT subjcont);
1391 
1392 // in fileinfo.c
1393 
1396 NTSTATUS NTAPI drv_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1397 
1400 NTSTATUS NTAPI drv_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1401 
1405 
1409 
1410 BOOL has_open_children(file_ref* fileref);
1412 NTSTATUS fileref_get_filename(file_ref* fileref, PUNICODE_STRING fn, USHORT* name_offset, ULONG* preqlen);
1415 
1416 // in reparse.c
1421 
1422 // in create.c
1423 
1427 
1429  _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,
1430  _In_ BOOL case_sensitive, _In_opt_ PIRP Irp);
1432  root* subvol, UINT64 inode, UINT8 type, PANSI_STRING utf8, BOOL always_add_hl, fcb* parent, fcb** pfcb, POOL_TYPE pooltype, PIRP Irp);
1434 NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, fcb* fcb, BOOL ignore_size, PIRP Irp);
1437  _In_ file_ref* sf, _In_ PUNICODE_STRING name, _In_ BOOL case_sensitive, _In_ BOOL lastpart, _In_ BOOL streampart,
1438  _In_ POOL_TYPE pooltype, _Out_ file_ref** psf2, _In_opt_ PIRP Irp);
1440 NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb* fcb, root** subvol, UINT64* inode, dir_child** pdc, BOOL case_sensitive);
1441 UINT32 inherit_mode(fcb* parfcb, BOOL is_dir);
1444 
1445 // in fsctl.c
1449 void flush_subvol_fcbs(root* subvol);
1451 
1452 // in flushthread.c
1453 
1454 _Function_class_(KSTART_ROUTINE)
1455 #ifdef __REACTOS__
1456 void NTAPI flush_thread(void* context);
1457 #else
1458 void flush_thread(void* context);
1459 #endif
1460 
1466 NTSTATUS do_tree_writes(device_extension* Vcb, LIST_ENTRY* tree_writes, BOOL no_free);
1471  _In_opt_ _When_(return >= 0, __drv_aliasesMem) void* data, UINT16 datalen, enum batch_operation operation);
1474 
1475 // in read.c
1476 
1480 
1483  _In_ ULONG priority);
1486 NTSTATUS do_read(PIRP Irp, BOOLEAN wait, ULONG* bytes_read);
1488 void raid6_recover2(UINT8* sectors, UINT16 num_stripes, ULONG sector_size, UINT16 missing1, UINT16 missing2, UINT8* out);
1489 
1490 // in pnp.c
1491 
1495 
1498 
1499 // in free-space.c
1511 
1512 // in extent-tree.c
1515  UINT32 refcount, BOOL superseded, PIRP Irp);
1523  INT32 count, BOOL no_csum, BOOL superseded, PIRP Irp);
1530 
1531 // in worker-thread.c
1532 void do_read_job(PIRP Irp);
1535 
1536 // in registry.c
1537 void read_registry(PUNICODE_STRING regpath, BOOL refresh);
1541 void watch_registry(HANDLE regh);
1542 
1543 // in compress.c
1545 NTSTATUS lzo_decompress(UINT8* inbuf, UINT32 inlen, UINT8* outbuf, UINT32 outlen, UINT32 inpageoff);
1548 
1549 // in galois.c
1551 void galois_divpower(UINT8* data, UINT8 div, UINT32 readlen);
1552 UINT8 gpow2(UINT8 e);
1553 UINT8 gmul(UINT8 a, UINT8 b);
1554 UINT8 gdiv(UINT8 a, UINT8 b);
1555 
1556 // in devctrl.c
1557 
1560 NTSTATUS NTAPI drv_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1561 
1562 // in calcthread.c
1563 
1564 _Function_class_(KSTART_ROUTINE)
1565 #ifdef __REACTOS__
1566 void NTAPI calc_thread(void* context);
1567 #else
1568 void calc_thread(void* context);
1569 #endif
1570 
1572 void free_calc_job(calc_job* cj);
1573 
1574 // in balance.c
1582 
1583 _Function_class_(KSTART_ROUTINE)
1584 #ifdef __REACTOS__
1585 void NTAPI balance_thread(void* context);
1586 #else
1587 void balance_thread(void* context);
1588 #endif
1589 
1590 // in volume.c
1611 void add_volume_device(superblock* sb, PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath, UINT64 length, ULONG disk_num, ULONG part_num);
1613 
1614 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1615 #ifdef __REACTOS__
1617 #else
1619 #endif
1620 
1621 // in scrub.c
1627 
1628 // in send.c
1631 
1632 // based on function in sys/sysmacros.h
1633 #define makedev(major, minor) (((minor) & 0xFF) | (((major) & 0xFFF) << 8) | (((UINT64)((minor) & ~0xFF)) << 12) | (((UINT64)((major) & ~0xFFF)) << 32))
1634 
1635 #define fast_io_possible(fcb) (!FsRtlAreThereCurrentFileLocks(&fcb->lock) && !fcb->Vcb->readonly ? FastIoIsPossible : FastIoIsQuestionable)
1636 
1637 static __inline void print_open_trees(device_extension* Vcb) {
1638  LIST_ENTRY* le = Vcb->trees.Flink;
1639  while (le != &Vcb->trees) {
1641  tree_data* td = CONTAINING_RECORD(t->itemlist.Flink, tree_data, list_entry);
1642  ERR("tree %p: root %llx, level %u, first key (%llx,%x,%llx)\n",
1643  t, t->root->id, t->header.level, td->key.obj_id, td->key.obj_type, td->key.offset);
1644 
1645  le = le->Flink;
1646  }
1647 }
1648 
1649 static __inline BOOL write_fcb_compressed(fcb* fcb) {
1650  // make sure we don't accidentally write the cache inodes or pagefile compressed
1652  return FALSE;
1653 
1654  if (fcb->Vcb->options.compress_force)
1655  return TRUE;
1656 
1658  return FALSE;
1659 
1660  if (fcb->inode_item.flags & BTRFS_INODE_COMPRESS || fcb->Vcb->options.compress)
1661  return TRUE;
1662 
1663  return FALSE;
1664 }
1665 
1666 static __inline void do_xor(UINT8* buf1, UINT8* buf2, UINT32 len) {
1667  UINT32 j;
1668 #ifndef __REACTOS__
1669  __m128i x1, x2;
1670 #endif
1671 
1672 #ifndef __REACTOS__
1673  if (have_sse2 && ((uintptr_t)buf1 & 0xf) == 0 && ((uintptr_t)buf2 & 0xf) == 0) {
1674  while (len >= 16) {
1675  x1 = _mm_load_si128((__m128i*)buf1);
1676  x2 = _mm_load_si128((__m128i*)buf2);
1677  x1 = _mm_xor_si128(x1, x2);
1678  _mm_store_si128((__m128i*)buf1, x1);
1679 
1680  buf1 += 16;
1681  buf2 += 16;
1682  len -= 16;
1683  }
1684  }
1685 #endif
1686 
1687  for (j = 0; j < len; j++) {
1688  *buf1 ^= *buf2;
1689  buf1++;
1690  buf2++;
1691  }
1692 }
1693 
1694 #ifdef DEBUG_FCB_REFCOUNTS
1695 #ifdef DEBUG_LONG_MESSAGES
1696 #define increase_fileref_refcount(fileref) {\
1697  LONG rc = InterlockedIncrement(&fileref->refcount);\
1698  MSG(funcname, __FILE__, __LINE__, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1699 }
1700 #else
1701 #define increase_fileref_refcount(fileref) {\
1702  LONG rc = InterlockedIncrement(&fileref->refcount);\
1703  MSG(funcname, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1704 }
1705 #endif
1706 #else
1707 #define increase_fileref_refcount(fileref) InterlockedIncrement(&fileref->refcount)
1708 #endif
1709 
1710 #ifdef _MSC_VER
1711 #define int3 __debugbreak()
1712 #else
1713 #define int3 asm("int3;")
1714 #endif
1715 
1716 #define hex_digit(c) ((c) <= 9) ? ((c) + '0') : ((c) - 10 + 'a')
1717 
1718 // FIXME - find a way to catch unfreed trees again
1719 
1720 // from sys/stat.h
1721 #define __S_IFMT 0170000 /* These bits determine file type. */
1722 #define __S_IFDIR 0040000 /* Directory. */
1723 #define __S_IFCHR 0020000 /* Character device. */
1724 #define __S_IFBLK 0060000 /* Block device. */
1725 #define __S_IFREG 0100000 /* Regular file. */
1726 #define __S_IFIFO 0010000 /* FIFO. */
1727 #define __S_IFLNK 0120000 /* Symbolic link. */
1728 #define __S_IFSOCK 0140000 /* Socket. */
1729 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
1730 
1731 #ifndef S_ISDIR
1732 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
1733 #endif
1734 
1735 #ifndef S_IRUSR
1736 #define S_IRUSR 0000400
1737 #endif
1738 
1739 #ifndef S_IWUSR
1740 #define S_IWUSR 0000200
1741 #endif
1742 
1743 #ifndef S_IXUSR
1744 #define S_IXUSR 0000100
1745 #endif
1746 
1747 #ifdef __REACTOS__
1748 #define S_IFDIR __S_IFDIR
1749 #define S_IFREG __S_IFREG
1750 #endif /* __REACTOS__ */
1751 
1752 #ifndef S_IRGRP
1753 #define S_IRGRP (S_IRUSR >> 3)
1754 #endif
1755 
1756 #ifndef S_IWGRP
1757 #define S_IWGRP (S_IWUSR >> 3)
1758 #endif
1759 
1760 #ifndef S_IXGRP
1761 #define S_IXGRP (S_IXUSR >> 3)
1762 #endif
1763 
1764 #ifndef S_IROTH
1765 #define S_IROTH (S_IRGRP >> 3)
1766 #endif
1767 
1768 #ifndef S_IWOTH
1769 #define S_IWOTH (S_IWGRP >> 3)
1770 #endif
1771 
1772 #ifndef S_IXOTH
1773 #define S_IXOTH (S_IXGRP >> 3)
1774 #endif
1775 
1776 #ifndef S_ISUID
1777 #define S_ISUID 0004000
1778 #endif
1779 
1780 #ifndef S_ISGID
1781 #define S_ISGID 0002000
1782 #endif
1783 
1784 #ifndef S_ISVTX
1785 #define S_ISVTX 0001000
1786 #endif
1787 
1788 // based on functions in sys/sysmacros.h
1789 #define major(rdev) ((((rdev) >> 8) & 0xFFF) | ((UINT32)((rdev) >> 32) & ~0xFFF))
1790 #define minor(rdev) (((rdev) & 0xFF) | ((UINT32)((rdev) >> 12) & ~0xFF))
1791 
1792 static __inline UINT64 fcb_alloc_size(fcb* fcb) {
1793  if (S_ISDIR(fcb->inode_item.st_mode))
1794  return 0;
1795  else if (fcb->atts & FILE_ATTRIBUTE_SPARSE_FILE)
1796  return fcb->inode_item.st_blocks;
1797  else
1798  return sector_align(fcb->inode_item.st_size, fcb->Vcb->superblock.sector_size);
1799 }
1800 
1802 
1804  ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount);
1805 
1807  PVOID Buffer, PETHREAD IoIssuerThread);
1808 
1810  PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread);
1811 
1812 #ifndef CC_ENABLE_DISK_IO_ACCOUNTING
1813 #define CC_ENABLE_DISK_IO_ACCOUNTING 0x00000010
1814 #endif
1815 
1817 
1819 
1820 #ifndef __REACTOS__
1821 #ifndef _MSC_VER
1822 
1823 #undef RtlIsNtDdiVersionAvailable
1824 
1826 
1828 #endif
1829 
1830 // not in DDK headers - taken from winternl.h
1831 typedef struct _LDR_DATA_TABLE_ENTRY {
1840  union {
1843  };
1846 
1847 typedef struct _PEB_LDR_DATA {
1852 
1859 
1861 
1862 typedef struct _PEB {
1875 } PEB,*PPEB;
1876 
1877 #ifdef _MSC_VER
1881  IN PROCESSINFOCLASS ProcessInformationClass,
1882  OUT PVOID ProcessInformation,
1883  IN ULONG ProcessInformationLength,
1885 );
1886 #endif
1887 #endif
1888 
1889 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1890 typedef struct _ECP_LIST ECP_LIST;
1891 typedef struct _ECP_LIST *PECP_LIST;
1892 #endif
1893 
1894 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_WIN7)
1895 NTSTATUS WINAPI RtlUnicodeToUTF8N(CHAR *utf8_dest, ULONG utf8_bytes_max,
1896  ULONG *utf8_bytes_written,
1897  const WCHAR *uni_src, ULONG uni_bytes);
1898 NTSTATUS WINAPI RtlUTF8ToUnicodeN(WCHAR *uni_dest, ULONG uni_bytes_max,
1899  ULONG *uni_bytes_written,
1900  const CHAR *utf8_src, ULONG utf8_bytes);
1901 #endif /* defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_WIN7) */
1902 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1906  PREPARSE_DATA_BUFFER ReparseBuffer);
1909  OUT PECP_LIST *EcpList);
1915 #endif /* defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA) */
1916 
1917 #endif
BOOL reparse_xattr_changed
Definition: btrfs_drv.h:308
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 * u
Definition: glfuncs.h:240
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:2027
BOOL reloc
Definition: btrfs_drv.h:512
void chunk_lock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ UINT64 start, _In_ UINT64 length)
Definition: btrfs.c:5201
NTSTATUS do_load_tree(device_extension *Vcb, tree_holder *th, root *r, tree *t, tree_data *td, PIRP Irp)
Definition: treefuncs.c:218
LIST_ENTRY * list_size
Definition: btrfs_drv.h:1237
SHARED_DATA_REF sdr
Definition: btrfs_drv.h:594
struct _file_ref * parent
Definition: btrfs_drv.h:341
BOOL lock_paused_balance
Definition: btrfs_drv.h:759
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:480
GLenum func
Definition: glext.h:6028
mount_options options
Definition: btrfs_drv.h:744
void free_fileref(_Inout_ file_ref *fr)
Definition: btrfs.c:1630
BOOL log_started
Definition: btrfs.c:84
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1203
ULONG * bmparr
Definition: btrfs_drv.h:535
struct _FILE_ID_128 * PFILE_ID_128
UINT64 id
Definition: btrfs_drv.h:441
UINT8 * data
Definition: btrfs_drv.h:925
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
Definition: treefuncs.c:1049
UINT64 offset
Definition: btrfs_drv.h:708
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:4654
BYTE Reserved4[104]
Definition: btrfs_drv.h:1869
BOOL readonly
Definition: btrfs_drv.h:511
void clear_rollback(LIST_ENTRY *rollback)
Definition: treefuncs.c:1028
UINT64 address
Definition: btrfs_drv.h:389
BOOL log_to_phys_loaded
Definition: btrfs_drv.h:788
GLint level
Definition: gl.h:1546
struct _root * root
Definition: btrfs_drv.h:423
BOOL skip_balance
Definition: btrfs_drv.h:643
#define IN
Definition: typedefs.h:38
BOOL can_flush
Definition: btrfs_drv.h:514
BOOL stopping
Definition: btrfs_drv.h:687
return
Definition: dirsup.c:529
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER
BOOL changed
Definition: btrfs_drv.h:564
static const char lxuid[]
Definition: btrfs_drv.h:1268
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:839
UINT64 length
Definition: btrfs_drv.h:528
void reap_fcb(fcb *fcb)
Definition: btrfs.c:1522
LIST_ENTRY trees
Definition: btrfs_drv.h:792
WCHAR * debug_desc
Definition: btrfs_drv.h:342
_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:684
LIST_ENTRY trees_hash
Definition: btrfs_drv.h:793
void trim_whole_device(device *dev)
Definition: fsctl.c:2672
struct _file_ref * fileref
Definition: btrfs_drv.h:245
BOOL write
Definition: btrfs_drv.h:430
UINT16 last_stripe
Definition: btrfs_drv.h:567
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:786
LIST_ENTRY space
Definition: btrfs_drv.h:520
NTSTATUS remove_device(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3773
LIST_ENTRY dirty_filerefs
Definition: btrfs_drv.h:799
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:305
scrub_info scrub
Definition: btrfs_drv.h:809
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
PAGED_LOOKASIDE_LIST batch_item_lookaside
Definition: btrfs_drv.h:816
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:572
UINT64 offset
Definition: btrfs.h:128
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:1001
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1265
chunk * c
Definition: btrfs_drv.h:926
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
NTSTATUS init_cache()
Definition: cache.c:101
BOOL paused
Definition: btrfs_drv.h:727
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:521
BOOL uniqueness_determined
Definition: btrfs_drv.h:432
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:698
rwlock_t lock
Definition: tcpcore.h:1163
BOOL case_sensitive
Definition: btrfs_drv.h:376
void space_list_add2(LIST_ENTRY *list, LIST_ENTRY *list_size, UINT64 address, UINT64 length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1415
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:187
LIST_ENTRY list_entry
Definition: btrfs_drv.h:586
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:186
ULONG options
Definition: btrfs_drv.h:364
PAGED_LOOKASIDE_LIST fcb_lookaside
Definition: btrfs_drv.h:818
BOOL removing
Definition: btrfs_drv.h:688
#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: create.c:3964
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:641
NPAGED_LOOKASIDE_LIST fcb_np_lookaside
Definition: btrfs_drv.h:822
UINT64 oldindex
Definition: btrfs_drv.h:332
PAGED_LOOKASIDE_LIST traverse_ptr_lookaside
Definition: btrfs_drv.h:815
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:1271
UINT64 chunk_estimate_phys_size(device_extension *Vcb, chunk *c, UINT64 u)
Definition: btrfs.c:3565
NTSTATUS fileref_get_filename(file_ref *fileref, PUNICODE_STRING fn, USHORT *name_offset, ULONG *preqlen)
Definition: fileinfo.c:3172
UINT64 new_address
Definition: btrfs_drv.h:427
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:879
NTSTATUS uid_to_sid(UINT32 uid, PSID *sid)
Definition: security.c:229
Definition: http.c:6587
BOOL xattrs_changed
Definition: btrfs_drv.h:311
NTSTATUS start_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3264
LIST_ENTRY list_entry
Definition: btrfs_drv.h:455
void space_list_subtract2(LIST_ENTRY *list, LIST_ENTRY *list_size, UINT64 address, UINT64 length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1940
UINT64 subvol
Definition: btrfs_drv.h:707
UNICODE_STRING name_uc
Definition: btrfs_drv.h:243
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
UINT32 hash_uc
Definition: btrfs_drv.h:242
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
NTSTATUS vol_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:873
_In_ PIRP Irp
Definition: csq.h:116
superblock * sb
Definition: btrfs.c:3952
root * checksum_root
Definition: btrfs_drv.h:783
#define pt(x, y)
Definition: drawing.c:79
static const BYTE us[]
Definition: encode.c:689
UINT64 data_scrubbed
Definition: btrfs_drv.h:734
tree_nonpaged * nonpaged
Definition: btrfs_drv.h:415
UNICODE_STRING us
Definition: btrfs_drv.h:931
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:3585
ULONG size
Definition: btrfs_drv.h:244
_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:592
uint16_t * PWSTR
Definition: typedefs.h:54
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LIST_ENTRY list_entry
Definition: btrfs_drv.h:597
struct _FILE_ID_128 FILE_ID_128
static __inline UINT16 get_extent_data_len(UINT8 type)
Definition: btrfs_drv.h:1047
root * root
Definition: btrfs_drv.h:495
NTSTATUS stream_set_end_of_file_information(device_extension *Vcb, UINT16 end, fcb *fcb, file_ref *fileref, BOOL advance_only)
Definition: fileinfo.c:2111
UINT32 uid
Definition: btrfs_drv.h:882
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:7523
#define IRP_MJ_SET_SECURITY
struct _device_extension device_extension
unsigned char * PUCHAR
Definition: retypes.h:3
UINT64 inode
Definition: btrfs_drv.h:273
BOOL seeding
Definition: btrfs_drv.h:510
fcb * create_fcb(device_extension *Vcb, POOL_TYPE pool_type)
Definition: create.c:45
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:507
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:755
_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:854
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:2415
#define FSRTL_FLAG2_IS_PAGING_FILE
Definition: fsrtltypes.h:57
BOOL cancelling
Definition: btrfs_drv.h:356
BOOL find_metadata_address_in_chunk(device_extension *Vcb, chunk *c, UINT64 *address)
Definition: flushthread.c:627
void reap_filerefs(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1685
BOOL is_tree_unique(device_extension *Vcb, tree *t, PIRP Irp)
Definition: flushthread.c:3087
LONG NTSTATUS
Definition: precomp.h:26
PAGED_LOOKASIDE_LIST tree_data_lookaside
Definition: btrfs_drv.h:814
batch_operation
Definition: btrfs_drv.h:459
VOID(* tCcSetAdditionalCacheAttributesEx)(PFILE_OBJECT FileObject, ULONG Flags)
Definition: btrfs_drv.h:1816
BOOL specific_file
Definition: btrfs_drv.h:368
BOOL unique
Definition: btrfs_drv.h:215
#define ERR(s,...)
Definition: btrfs_drv.h:1220
GLintptr offset
Definition: glext.h:5920
tree_holder treeholder
Definition: btrfs_drv.h:401
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:2652
ERESOURCE fileref_lock
Definition: btrfs_drv.h:768
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1850
enum prop_compression_type prop_compression
Definition: btrfs_drv.h:292
BOOL manage_volume_privilege
Definition: btrfs_drv.h:369
ANSI_STRING ea_xattr
Definition: btrfs_drv.h:287
KEVENT event
Definition: btrfs_drv.h:724
ERESOURCE range_locks_lock
Definition: btrfs_drv.h:555
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:426
NTSTATUS update_chunk_caches(device_extension *Vcb, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1819
NTSTATUS flush_partial_stripe(device_extension *Vcb, chunk *c, partial_stripe *ps)
Definition: flushthread.c:5677
#define TYPE_TREE_BLOCK_REF
Definition: btrfs.h:32
void init_file_cache(_In_ PFILE_OBJECT FileObject, _In_ CC_FILE_SIZES *ccfs)
Definition: btrfs.c:3778
void free_fcb(_Inout_ fcb *fcb)
Definition: btrfs.c:1509
GLdouble n
Definition: glext.h:7729
BYTE Reserved2[1]
Definition: btrfs_drv.h:1865
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:803
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:280
ERESOURCE dirty_filerefs_lock
Definition: btrfs_drv.h:800
GLdouble GLdouble t
Definition: gl.h:2047
ERESOURCE load_tree_lock
Definition: btrfs_drv.h:437
NTSTATUS vol_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:304
UINT32 count
Definition: btrfs.h:409
#define _Acquires_exclusive_lock_(a)
Definition: btrfs_drv.h:191
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:456
BOOL allow_degraded
Definition: btrfs_drv.h:647
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:126
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:337
ANSI_STRING utf8
Definition: btrfs_drv.h:239
FT_UInt sid
Definition: cffcmap.c:139
ROOT_ITEM root_item
Definition: btrfs_drv.h:445
LIST_ENTRY list_entry
Definition: btrfs_drv.h:220
ANSI_STRING reparse_xattr
Definition: btrfs_drv.h:286
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:856
HANDLE thread
Definition: btrfs_drv.h:682
void free_cache()
Definition: cache.c:116
UINT32 mount_zlib_level
Definition: btrfs.c:73
LIST_ENTRY errors
Definition: btrfs_drv.h:737
GLuint buffer
Definition: glext.h:5915
UINT64 oldused
Definition: btrfs_drv.h:546
BYTE BeingDebugged
Definition: btrfs_drv.h:1864
UINT64 metadata_flags
Definition: btrfs_drv.h:776
struct _PEB_LDR_DATA * PPEB_LDR_DATA
PNOTIFY_SYNC NotifySync
Definition: btrfs_drv.h:771
UINT32 length
Definition: btrfs_drv.h:924
struct _volume_device_extension * vde
Definition: btrfs_drv.h:746
static __inline UINT64 make_file_id(root *r, UINT64 inode)
Definition: btrfs_drv.h:1016
HDC dc
Definition: cylfrac.c:34
UINT32 zlib_level
Definition: btrfs_drv.h:638
UINT64 old_size
Definition: btrfs_drv.h:579
KEVENT event
Definition: btrfs_drv.h:612
UINT32 crc32
Definition: btrfs.c:3953
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:829
ERESOURCE load_lock
Definition: btrfs_drv.h:769
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:810
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:3924
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:2694
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:340
RTL_BITMAP bmp
Definition: btrfs_drv.h:536
UINT64 offset
Definition: btrfs_drv.h:544
LONGLONG lastinode
Definition: btrfs_drv.h:442
ACCESS_MASK access
Definition: btrfs_drv.h:372
LIST_ENTRY fcbs
Definition: btrfs_drv.h:453
ULONG part_num
Definition: btrfs_drv.h:845
UINT8 * buf
Definition: btrfs_drv.h:433
LIST_ENTRY list_entry
Definition: btrfs_drv.h:425
FAST_MUTEX HeaderMutex
Definition: btrfs_drv.h:203
NTSTATUS vol_write(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:206
ERESOURCE paging_resource
Definition: btrfs_drv.h:206
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
LONG refcount
Definition: btrfs_drv.h:613
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:1809
LIST_ENTRY old_refs
Definition: btrfs_drv.h:585
UINT16 size
Definition: btrfs_drv.h:404
void add_checksum_entry(device_extension *Vcb, UINT64 address, ULONG length, UINT32 *csum, PIRP Irp)
Definition: flushthread.c:2452
PSID sid
Definition: btrfs_drv.h:887
NTSTATUS query_balance(device_extension *Vcb, void *data, ULONG length)
Definition: balance.c:3685
UINT8 type
Definition: btrfs_drv.h:238
device * device
Definition: btrfs_drv.h:906
UINT64 generation
Definition: btrfs_drv.h:836
BOOL find_data_address_in_chunk(device_extension *Vcb, chunk *c, UINT64 length, UINT64 *address)
LIST_ENTRY list_entry
Definition: btrfs_drv.h:932
void do_read_job(PIRP Irp)
Definition: worker-thread.c:26
LARGE_INTEGER resume_time
Definition: btrfs_drv.h:730
device ** devices
Definition: btrfs_drv.h:547
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:747
#define _Requires_exclusive_lock_held_(a)
Definition: btrfs_drv.h:180
CHAR InputBuffer[80]
Definition: conmgr.c:33
PAGED_LOOKASIDE_LIST name_bit_lookaside
Definition: btrfs_drv.h:819
#define _In_opt_
Definition: no_sal2.h:213
struct _DUPLICATE_EXTENTS_DATA * PDUPLICATE_EXTENTS_DATA
balance_info balance
Definition: btrfs_drv.h:808
NTSTATUS stop_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3758
NTSTATUS error
Definition: btrfs_drv.h:735
SECTION_OBJECT_POINTERS segment_object
Definition: btrfs_drv.h:204
UNICODE_STRING filename
Definition: btrfs_drv.h:374
NTSTATUS mountmgr_add_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
Definition: volume.c:900
VOID(NTAPI * PPS_POST_PROCESS_INIT_ROUTINE)(VOID)
Definition: btrfs_drv.h:1860
UINT32 st_mode
Definition: btrfs.h:276
UINT8 obj_type
Definition: btrfs.h:127
struct _write_data_context * context
Definition: btrfs_drv.h:903
KTIMER flush_thread_timer
Definition: btrfs_drv.h:805
BTRFS_UUID uuid
Definition: btrfs_drv.h:834
static WCHAR superseded[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1817
LIST_ENTRY list_entry_all
Definition: btrfs_drv.h:321
BOOL posix_delete
Definition: btrfs_drv.h:334
UNICODE_STRING query_string
Definition: btrfs_drv.h:366
static USHORT USHORT * NewLength
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL had_drive_letter
Definition: btrfs_drv.h:842
KEVENT finished
Definition: btrfs_drv.h:694
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:477
Definition: fs.h:78
UINT64 size
Definition: btrfs_drv.h:501
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:830
UNICODE_STRING name
Definition: btrfs_drv.h:853
PVOID DllBase
Definition: btrfs_drv.h:1835
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:868
NTSTATUS allocate_cache(device_extension *Vcb, BOOL *changed, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1351
UNICODE_STRING bus_name
Definition: btrfs_drv.h:858
BOOL ea_changed
Definition: btrfs_drv.h:309
root * extent_root
Definition: btrfs_drv.h:782
BOOL allow_extended_dasd_io
Definition: btrfs_drv.h:370
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:1666
LIST_ENTRY list_entry
Definition: btrfs_drv.h:396
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:802
KEY firstitem
Definition: btrfs_drv.h:716
struct _PEB * PPEB
fcb * old_cache
Definition: btrfs_drv.h:549
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:255
struct _device_extension * Vcb
Definition: btrfs_drv.h:420
UINT64 count
Definition: btrfs_drv.h:580
BOOL user_set_access_time
Definition: btrfs_drv.h:378
NTSTATUS update_chunk_caches_tree(device_extension *Vcb, PIRP Irp)
Definition: free-space.c:1889
BOOL has_wildcard
Definition: btrfs_drv.h:367
SECURITY_DESCRIPTOR * sd
Definition: btrfs_drv.h:277
const GUID * guid
PSID sid
Definition: btrfs_drv.h:881
root_nonpaged * nonpaged
Definition: btrfs_drv.h:444
file_ref * create_fileref(device_extension *Vcb)
Definition: create.c:113
EXTENT_DATA_REF edr
Definition: btrfs_drv.h:593
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:490
PVOID Reserved3[2]
Definition: btrfs_drv.h:1866
LIST_ENTRY drop_roots
Definition: btrfs_drv.h:779
chunk * chunk
Definition: btrfs_drv.h:1240
LIST_ENTRY send_ops
Definition: btrfs_drv.h:812
_Function_class_(KSTART_ROUTINE) void mountmgr_thread(_In_ void *context)
Definition: balance.c:3025
ULONG change_count
Definition: btrfs_drv.h:515
static __inline UINT64 unix_time_to_win(BTRFS_TIME *t)
Definition: btrfs_drv.h:989
unsigned int UINT32
UINT16 datalen
Definition: btrfs_drv.h:214
LIST_ENTRY items
Definition: btrfs_drv.h:485
ERESOURCE changed_extents_lock
Definition: btrfs_drv.h:558
UINT32 sectors
Definition: btrfs_drv.h:610
UINT64 devices_loaded
Definition: btrfs_drv.h:754
chunk * get_chunk_from_address(device_extension *Vcb, UINT64 address)
Definition: write.c:93
struct _tree * tree
Definition: btrfs_drv.h:391
CACHE_MANAGER_CALLBACKS * cache_callbacks
Definition: cache.c:20
LIST_ENTRY list_entry
Definition: btrfs_drv.h:823
unsigned int BOOL
Definition: ntddk_ex.h:94
#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:1263
LIST_ENTRY list_entry
Definition: btrfs_drv.h:320
_In_ ULONG BufferLength
Definition: usbdlib.h:225
ULONG num_errors
Definition: btrfs_drv.h:736
#define e
Definition: ke_i.h:82
UINT64 offset
Definition: btrfs_drv.h:213
BOOLEAN(* tPsIsDiskCountersEnabled)()
Definition: btrfs_drv.h:1801
UINT32 mount_no_barrier
Definition: btrfs.c:78
UINT8 compress_type
Definition: btrfs_drv.h:636
UINT64 chunks_left
Definition: btrfs_drv.h:733
#define _Releases_lock_(a)
Definition: btrfs_drv.h:181
BOOL stopping
Definition: btrfs_drv.h:726
BOOL disallow_dismount
Definition: btrfs_drv.h:760
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
PEPROCESS PsGetThreadProcess(_In_ PETHREAD Thread)
#define __drv_aliasesMem
Definition: btrfs_drv.h:178
tree_data * paritem
Definition: btrfs_drv.h:422
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:446
VOID(* tPsUpdateDiskCounters)(PEPROCESS Process, ULONG64 BytesRead, ULONG64 BytesWritten, ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount)
Definition: btrfs_drv.h:1803
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:1105
void flush_subvol_fcbs(root *subvol)
Definition: fsctl.c:244
BOOL prop_compression_changed
Definition: btrfs_drv.h:310
LIST_ENTRY list_entry_balance
Definition: btrfs_drv.h:573
PFILE_OBJECT root_file
Definition: btrfs_drv.h:813
LIST_ENTRY list_entry
Definition: btrfs_drv.h:537
BOOL is_unique
Definition: btrfs_drv.h:431
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:689
#define _Out_writes_bytes_opt_(a)
Definition: btrfs_drv.h:182
LIST_ENTRY ** hash_ptrs_uc
Definition: btrfs_drv.h:302
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:1470
BOOL marked_as_orphan
Definition: btrfs_drv.h:294
BOOL clear_cache
Definition: btrfs_drv.h:646
smooth NULL
Definition: ftsmooth.c:416
void mark_fileref_dirty(_In_ file_ref *fileref)
Definition: btrfs.c:1492
root * r
Definition: btrfs_drv.h:484
char ext[3]
Definition: mkdosfs.c:358
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:837
#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:429
Definition: parser.c:48
void add_trim_entry_avoid_sb(device_extension *Vcb, device *dev, UINT64 address, UINT64 size)
Definition: flushthread.c:5237
UINT64 used
Definition: btrfs_drv.h:545
NTSTATUS vol_file_system_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:342
HANDLE thread
Definition: btrfs_drv.h:352
struct _tree * parent
Definition: btrfs_drv.h:421
LIST_ENTRY job_list
Definition: btrfs_drv.h:626
_In_ fcb _In_ chunk _In_ UINT64 start_data
Definition: btrfs_drv.h:1351
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:885
Definition: bufpool.h:45
BOOL stats_changed
Definition: btrfs_drv.h:519
LARGE_INTEGER finish_time
Definition: btrfs_drv.h:729
NTSTATUS load_tree(device_extension *Vcb, UINT64 addr, UINT8 *buf, root *r, tree **pt)
Definition: treefuncs.c:20
_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:857
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:793
_In_ UINT64 a
Definition: btrfs_drv.h:1030
#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:560
BOOL extents_changed
Definition: btrfs_drv.h:307
ULONG ea_index
Definition: btrfs_drv.h:375
UINT64 address
Definition: btrfs_drv.h:923
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:2280
LIST_ENTRY list_entry
Definition: btrfs_drv.h:530
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:548
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:568
LONG refcount
Definition: btrfs_drv.h:339
#define TYPE_EXTENT_DATA_REF
Definition: btrfs.h:33
void reap_fileref(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1650
FILE_LOCK lock
Definition: btrfs_drv.h:278
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:5468
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:218
r l[0]
Definition: byte_order.h:167
#define BTRFS_ROOT_ROOT
Definition: btrfs.h:49
BOOL removable
Definition: btrfs_drv.h:509
ULONG ealen
Definition: btrfs_drv.h:288
void free_trees_root(device_extension *Vcb, root *r)
Definition: treefuncs.c:756
static __inline UINT64 fcb_alloc_size(fcb *fcb)
Definition: btrfs_drv.h:1792
BOOL created
Definition: btrfs_drv.h:559
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:267
#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:3111
ERESOURCE dirty_fcbs_lock
Definition: btrfs_drv.h:798
NTSTATUS send_status
Definition: btrfs_drv.h:383
LARGE_INTEGER start_time
Definition: btrfs_drv.h:728
int64_t LONGLONG
Definition: typedefs.h:66
#define _Requires_lock_not_held_(a)
Definition: btrfs_drv.h:190
#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:365
LONG send_ops
Definition: btrfs_drv.h:450
#define TYPE_SHARED_DATA_REF
Definition: btrfs.h:36
NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, fcb *fcb, BOOL ignore_size, PIRP Irp)
Definition: create.c:465
void reap_fcbs(device_extension *Vcb)
Definition: btrfs.c:1615
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LIST_ENTRY DirNotifyList
Definition: btrfs_drv.h:772
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1258
NTSTATUS do_tree_writes(device_extension *Vcb, LIST_ENTRY *tree_writes, BOOL no_free)
Definition: flushthread.c:1503
BOOL user_set_creation_time
Definition: btrfs_drv.h:377
LIST_ENTRY dir_children_hash_uc
Definition: btrfs_drv.h:300
BOOL add_thread_job(device_extension *Vcb, PIRP Irp)
LIST_ENTRY list_entry
Definition: btrfs_drv.h:703
void space_list_subtract(chunk *c, BOOL deleting, UINT64 address, UINT64 length, LIST_ENTRY *rollback)
Definition: free-space.c:2019
GLsizeiptr size
Definition: glext.h:5919
LIST_ENTRY dir_children_index
Definition: btrfs_drv.h:298
struct _fcb fcb
Definition: btrfs_drv.h:1351
void clear_batch_list(device_extension *Vcb, LIST_ENTRY *batchlist)
Definition: treefuncs.c:1203
WCHAR * debug_desc
Definition: btrfs_drv.h:283
_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:1351
void free_tree(tree *t)
Definition: treefuncs.c:260
#define _Acquires_shared_lock_(a)
Definition: btrfs_drv.h:192
UCHAR flags
Definition: btrfs_drv.h:1264
NTKERNELAPI NTSTATUS NTAPI FsRtlGetEcpListFromIrp(IN PIRP Irp, OUT PECP_LIST *EcpList)
Definition: fsrtl.c:273
UINT32 adshash
Definition: btrfs_drv.h:315
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:2708
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:1340
static __inline BOOL is_subvol_readonly(root *r, PIRP Irp)
Definition: btrfs_drv.h:1037
NTSTATUS status
Definition: btrfs_drv.h:692
UINT16 filename_length
Definition: btrfs_drv.h:709
LIST_ENTRY xattrs
Definition: btrfs_drv.h:293
UINT64 index
Definition: btrfs_drv.h:237
NTSTATUS vol_shutdown(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:867
__wchar_t WCHAR
Definition: xmlstorage.h:180
_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:1351
BOOL created
Definition: btrfs_drv.h:336
UINT64 address
Definition: btrfs_drv.h:534
static __inline void print_open_trees(device_extension *Vcb)
Definition: btrfs_drv.h:1637
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:725
LIST_ENTRY itemlist
Definition: btrfs_drv.h:424
uint64_t ULONGLONG
Definition: typedefs.h:65
KEVENT cleared_event
Definition: btrfs_drv.h:355
KEVENT range_locks_event
Definition: btrfs_drv.h:556
LIST_ENTRY range_locks
Definition: btrfs_drv.h:554
#define _Ret_maybenull_
Definition: no_sal2.h:590
UINT16 datalen
Definition: btrfs_drv.h:478
UINT64 start
Definition: btrfs_drv.h:527
BYTE Reserved1[8]
Definition: btrfs_drv.h:1848
struct _file_ref file_ref
BOOL dirty
Definition: btrfs_drv.h:304
#define Vcb
Definition: cdprocs.h:1425
rollback_type
Definition: btrfs_drv.h:1248
static __inline void * map_user_buffer(PIRP Irp, ULONG priority)
Definition: btrfs_drv.h:981
#define S_ISDIR(mode)
Definition: btrfs_drv.h:1732
UINT8 gpow2(UINT8 e)
Definition: galois.c:69
ULONG CheckSum
Definition: btrfs_drv.h:1841
#define WINAPI
Definition: msvc.h:8
const GLubyte * c
Definition: glext.h:8905
BOOL atts_changed
Definition: btrfs_drv.h:306
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, BOOL always_add_hl, fcb *parent, fcb **pfcb, POOL_TYPE pooltype, PIRP Irp)
Definition: create.c:595
UCHAR Identifier[16]
Definition: btrfs_drv.h:147
LIST_ENTRY sys_chunks
Definition: btrfs_drv.h:790
_Ret_maybenull_ device * find_device_from_uuid(_In_ device_extension *Vcb, _In_ BTRFS_UUID *uuid)
Definition: btrfs.c:2995
LIST_ENTRY list_entry
Definition: btrfs_drv.h:876
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:888
UINT64 system_flags
Definition: btrfs_drv.h:777
PFILE_OBJECT locked_fileobj
Definition: btrfs_drv.h:762
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
PVOID Reserved6
Definition: btrfs_drv.h:1842
KEVENT event
Definition: btrfs_drv.h:693
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:5271
__m128i
Definition: emmintrin.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
NPAGED_LOOKASIDE_LIST fileref_np_lookaside
Definition: btrfs_drv.h:821
#define TYPE_EXTENT_REF_V0
Definition: btrfs.h:34
BOOL fcb_is_inline(fcb *fcb)
Definition: fsctl.c:3200
GLuint address
Definition: glext.h:9393
UINT32 count
Definition: btrfs.h:396
LIST_ENTRY list_entry
Definition: btrfs_drv.h:604
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
LIST_ENTRY hardlinks
Definition: btrfs_drv.h:289
_Success_(return) BOOL get_file_attributes_from_xattr(_In_reads_bytes_(len) char *val
ERESOURCE lock
Definition: btrfs_drv.h:627
struct _file_ref * fileref
Definition: btrfs_drv.h:290
LIST_ENTRY list_entry_index
Definition: btrfs_drv.h:246
LIST_ENTRY extents
Definition: btrfs_drv.h:285
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:279
UINT64 subvol_id
Definition: btrfs_drv.h:642
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ERESOURCE fileref_lock
Definition: btrfs_drv.h:326
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:2484
ERESOURCE child_lock
Definition: btrfs_drv.h:873
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:843
PDEVICE_OBJECT mounted_device
Definition: btrfs_drv.h:855
LARGE_INTEGER duration
Definition: btrfs_drv.h:731
* PFILE_OBJECT
Definition: iotypes.h:1954
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL received
Definition: btrfs_drv.h:447
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:1838
ULONG disk_num
Definition: btrfs_drv.h:844
struct _ccb * ccb
Definition: btrfs_drv.h:353
USHORT NodeType
Definition: btrfs_drv.h:361
GLbitfield flags
Definition: glext.h:7161
void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath)
Definition: search.c:500
BOOL parity
Definition: btrfs_drv.h:702
LIST_ENTRY list_entry
Definition: btrfs_drv.h:927
UINT8 level
Definition: btrfs_drv.h:715
#define TYPE_SHARED_BLOCK_REF
Definition: btrfs.h:35
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:486
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
LIST_ENTRY trim_list
Definition: btrfs_drv.h:523
BOOL inode_item_changed
Definition: btrfs_drv.h:291
ANSI_STRING name
Definition: btrfs_drv.h:1262
NTSTATUS update_dev_item(device_extension *Vcb, device *device, PIRP Irp)
Definition: flushthread.c:3935
WCHAR * file_desc_fileref(_In_ file_ref *fileref)
Definition: btrfs.c:1301
PEPROCESS reserved
Definition: btrfs_drv.h:448
unsigned __int64 ULONG64
Definition: imports.h:198
UINT64 st_blocks
Definition: btrfs.h:271
BOOL ads
Definition: btrfs_drv.h:314
dir_child * dc
Definition: btrfs_drv.h:343
_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:1351
tree_data * item
Definition: btrfs_drv.h:491
PVOID Reserved2[2]
Definition: btrfs_drv.h:1834
unsigned char UCHAR
Definition: xmlstorage.h:181
LIST_ENTRY listentry
Definition: btrfs_drv.h:886
LIST_ENTRY children
Definition: btrfs_drv.h:338
NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP *Pirp, UINT32 type)
Definition: fsctl.c:4811
PFILE_OBJECT fileobj
Definition: btrfs_drv.h:838
UINT32 mount_skip_balance
Definition: btrfs.c:77
struct _fcb_nonpaged fcb_nonpaged
UNICODE_STRING ImagePathName
Definition: btrfs_drv.h:1856
LIST_ENTRY dirty_subvols
Definition: btrfs_drv.h:801
GLenum const GLvoid * addr
Definition: glext.h:9621
tree_header header
Definition: btrfs_drv.h:416
ULONG SessionId
Definition: btrfs_drv.h:1874
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:529
prop_compression_type
Definition: btrfs_drv.h:251
_In_ PECP_LIST _In_opt_ PVOID CurrentEcpContext
Definition: fltkernel.h:2621
LONG refcount
Definition: btrfs_drv.h:269
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:1579
BYTE Reserved1[2]
Definition: btrfs_drv.h:1863
BOOLEAN RtlIsNtDdiVersionAvailable(ULONG Version)
ULONG num_trim_entries
Definition: btrfs_drv.h:522
_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:1351
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1868
PAGED_LOOKASIDE_LIST fileref_lookaside
Definition: btrfs_drv.h:817
BOOL recovered
Definition: btrfs_drv.h:700
#define VOID
Definition: acefi.h:82
LIST_ENTRY changed_extents
Definition: btrfs_drv.h:553
tree_holder treeholder
Definition: btrfs_drv.h:443
BOOL case_sensitive_set
Definition: btrfs_drv.h:296
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:640
LIST_ENTRY all_fcbs
Definition: btrfs_drv.h:796
LIST_ENTRY list_entry_hash_uc
Definition: btrfs_drv.h:248
UINT32 * csum
Definition: btrfs_drv.h:609
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:348
Definition: btrfs_drv.h:1831
UINT32 debug_log_level
Definition: btrfs.c:69
GLenum GLsizei len
Definition: glext.h:6722
UINT32 count
Definition: btrfs.h:418
unsigned char BYTE
Definition: mem.h:68
UINT32 hash
Definition: btrfs_drv.h:240
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:761
BOOL dirty
Definition: btrfs_drv.h:345
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:732
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:1010
_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:330
void add_volume_device(superblock *sb, PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath, UINT64 length, ULONG disk_num, ULONG part_num)
Definition: volume.c:1023
Definition: typedefs.h:117
UNICODE_STRING CommandLine
Definition: btrfs_drv.h:1857
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:797
PVOID Reserved5[52]
Definition: btrfs_drv.h:1870
#define _Releases_exclusive_lock_(a)
Definition: btrfs_drv.h:185
BOOL has_new_address
Definition: btrfs_drv.h:428
BOOL seeding
Definition: btrfs_drv.h:841
NTSTATUS set_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: reparse.c:365
INODE_ITEM inode_item
Definition: btrfs_drv.h:276
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:857
BOOL atts_deleted
Definition: btrfs_drv.h:306
NTSTATUS registry_load_volume_options(device_extension *Vcb)
Definition: registry.c:36
USHORT valuelen
Definition: btrfs_drv.h:261
NTSTATUS get_reparse_point(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, void *buffer, DWORD buflen, ULONG_PTR *retlen)
Definition: reparse.c:20
BOOL compress_force
Definition: btrfs_drv.h:635
NTSTATUS start_balance(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3493
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
static __inline BOOL write_fcb_compressed(fcb *fcb)
Definition: btrfs_drv.h:1649
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
Definition: btrfs_drv.h:1351
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:568
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:418
KEVENT flush_thread_finished
Definition: btrfs_drv.h:806
__u8 sector_size[2]
Definition: mkdosfs.c:361
LIST_ENTRY space_size
Definition: btrfs_drv.h:551
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:859
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:690
ULONG get_reparse_tag(device_extension *Vcb, root *subvol, UINT64 inode, UINT8 type, ULONG atts, BOOL lxss, PIRP Irp)
Definition: dirctrl.c:101
BOOL user_set_write_time
Definition: btrfs_drv.h:379
LIST_ENTRY list_entry
Definition: btrfs_drv.h:910
UINT64 address
Definition: btrfs_drv.h:500
NTSTATUS vol_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:292
UINT64 generation
Definition: btrfs_drv.h:390
ERESOURCE dir_children_lock
Definition: btrfs_drv.h:207
ULONG TimeDateStamp
Definition: btrfs_drv.h:1844
UINT64 root
Definition: btrfs_drv.h:714
UINT64 last_alloc
Definition: btrfs_drv.h:566
UINT64 devid
Definition: btrfs_drv.h:835
NTSTATUS check_csum(device_extension *Vcb, UINT8 *data, UINT32 sectors, UINT32 *csum)
Definition: read.c:89
LIST_ENTRY chunks
Definition: btrfs_drv.h:791
NTSTATUS load_cache_chunk(device_extension *Vcb, chunk *c, PIRP Irp)
Definition: free-space.c:952
struct _write_data_context write_data_context
LIST_ENTRY list_entry
Definition: btrfs_drv.h:357
#define _In_
Definition: no_sal2.h:204
file_ref * root_fileref
Definition: btrfs_drv.h:765
struct _ECP_LIST * PECP_LIST
Definition: fsrtltypes.h:139
ULONG balance_num
Definition: btrfs_drv.h:691
HANDLE thread
Definition: btrfs_drv.h:722
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:411
#define _Lock_level_order_(a, b)
Definition: btrfs_drv.h:188
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:1780
extent * ext
Definition: btrfs_drv.h:1245
Definition: btrfs.h:125
ULONG get_reparse_tag_fcb(fcb *fcb)
Definition: dirctrl.c:77
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:1871
BOOL is_metadata
Definition: btrfs_drv.h:701
_In_ fcb _In_ chunk _In_ UINT64 _In_ UINT64 _In_ BOOL _In_opt_ void * data
Definition: btrfs_drv.h:1351
BOOL ignore
Definition: btrfs_drv.h:216
NTSTATUS vol_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:801
const WCHAR * action
Definition: action.c:7783
BOOL chunk_usage_found
Definition: btrfs_drv.h:789
_Ret_z_ WCHAR * file_desc(_In_ PFILE_OBJECT FileObject)
Definition: btrfs.c:1338
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:247
ULONG atts
Definition: btrfs_drv.h:281
NTSTATUS query_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode, void *data, ULONG length)
Definition: scrub.c:3302
ERESOURCE resource
Definition: btrfs_drv.h:205
UINT64 address
Definition: btrfs_drv.h:698
UINT64 st_size
Definition: btrfs.h:270
struct _fcb_nonpaged * nonpaged
Definition: btrfs_drv.h:268
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
BOOL reloc
Definition: btrfs_drv.h:561
LIST_ENTRY roots
Definition: btrfs_drv.h:778
UINT32 mount_compress_force
Definition: btrfs.c:71
drv_calc_threads calcthreads
Definition: btrfs_drv.h:807
void * context
Definition: btrfs_drv.h:354
unsigned short USHORT
Definition: pedump.c:61
ERESOURCE stats_lock
Definition: btrfs_drv.h:723
UINT32 hash
Definition: btrfs_drv.h:274
#define _In_z_
Definition: no_sal2.h:239
GLuint start
Definition: gl.h:1545
static const char lxgid[]
Definition: btrfs_drv.h:1269
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1833
ULONG disposition
Definition: btrfs_drv.h:363
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1867
_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:2693
BOOL csum_loaded
Definition: btrfs_drv.h:284
void remove_dir_child_from_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:738
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:5248
BOOL checked_for_orphans
Definition: btrfs_drv.h:452
static const char lxmod[]
Definition: btrfs_drv.h:1270
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:1413
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1837
BOOL cache_loaded
Definition: btrfs_drv.h:563
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:1836
VOID(* tFsRtlUpdateDiskCounters)(ULONG64 BytesRead, ULONG64 BytesWritten)
Definition: btrfs_drv.h:1818
LIST_ENTRY refs
Definition: btrfs_drv.h:584
LIST_ENTRY listentry
Definition: btrfs_drv.h:880