ReactOS  0.4.14-dev-604-gcfdd483
btrfs_drv.h
Go to the documentation of this file.
1 /* Copyright (c) Mark Harmstone 2016-17
2  *
3  * This file is part of WinBtrfs.
4  *
5  * WinBtrfs is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public Licence as published by
7  * the Free Software Foundation, either version 3 of the Licence, or
8  * (at your option) any later version.
9  *
10  * WinBtrfs is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public Licence for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public Licence
16  * along with WinBtrfs. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #pragma once
19 
20 #ifndef __REACTOS__
21 #undef _WIN32_WINNT
22 #undef NTDDI_VERSION
23 
24 #define _WIN32_WINNT 0x0601
25 #define NTDDI_VERSION 0x06020000 // Win 8
26 #define _CRT_SECURE_NO_WARNINGS
27 #define _NO_CRT_STDIO_INLINE
28 #endif /* __REACTOS__ */
29 
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable:4163)
33 #pragma warning(disable:4311)
34 #pragma warning(disable:4312)
35 #else
36 #pragma GCC diagnostic push
37 #pragma GCC diagnostic ignored "-Wsign-compare"
38 #pragma GCC diagnostic ignored "-Wsign-conversion"
39 #endif
40 
41 #include <ntifs.h>
42 #include <ntddk.h>
43 #ifdef __REACTOS__
44 #include <ntdddisk.h>
45 #endif /* __REACTOS__ */
46 #include <mountmgr.h>
47 #ifdef __REACTOS__
48 #include <rtlfuncs.h>
49 #include <iotypes.h>
50 #include <pseh/pseh2.h>
51 #endif /* __REACTOS__ */
52 #include <windef.h>
53 #include <wdm.h>
54 
55 #ifdef _MSC_VER
56 #pragma warning(pop)
57 #else
58 #pragma GCC diagnostic pop
59 #endif
60 
61 #include <stdio.h>
62 #include <stdarg.h>
63 #include <stddef.h>
64 #include <stdint.h>
65 #include <stdbool.h>
66 #ifndef __REACTOS__
67 // Not actually used
68 #include <emmintrin.h>
69 #endif /* __REACTOS__ */
70 #include "btrfs.h"
71 #include "btrfsioctl.h"
72 
73 #ifdef __REACTOS__
74 C_ASSERT(sizeof(bool) == 1);
75 #endif
76 
77 #ifdef _DEBUG
78 // #define DEBUG_FCB_REFCOUNTS
79 // #define DEBUG_LONG_MESSAGES
80 // #define DEBUG_FLUSH_TIMES
81 // #define DEBUG_CHUNK_LOCKS
82 // #define DEBUG_TRIM_EMULATION
83 #define DEBUG_PARANOID
84 #endif
85 
86 #define UNUSED(x) (void)(x)
87 
88 #define BTRFS_NODE_TYPE_CCB 0x2295
89 #define BTRFS_NODE_TYPE_FCB 0x2296
90 
91 #define ALLOC_TAG 0x7442484D //'MHBt'
92 #define ALLOC_TAG_ZLIB 0x7A42484D //'MHBz'
93 
94 #define UID_NOBODY 65534
95 #define GID_NOBODY 65534
96 
97 #define EA_NTACL "security.NTACL"
98 #define EA_NTACL_HASH 0x45922146
99 
100 #define EA_DOSATTRIB "user.DOSATTRIB"
101 #define EA_DOSATTRIB_HASH 0x914f9939
102 
103 #define EA_REPARSE "user.reparse"
104 #define EA_REPARSE_HASH 0xfabad1fe
105 
106 #define EA_EA "user.EA"
107 #define EA_EA_HASH 0x8270dd43
108 
109 #define EA_CASE_SENSITIVE "user.casesensitive"
110 #define EA_CASE_SENSITIVE_HASH 0x1a9d97d4
111 
112 #define EA_PROP_COMPRESSION "btrfs.compression"
113 #define EA_PROP_COMPRESSION_HASH 0x20ccdf69
114 
115 #define MAX_EXTENT_SIZE 0x8000000 // 128 MB
116 #define COMPRESSED_EXTENT_SIZE 0x20000 // 128 KB
117 
118 #define READ_AHEAD_GRANULARITY COMPRESSED_EXTENT_SIZE // really ought to be a multiple of COMPRESSED_EXTENT_SIZE
119 
120 #define IO_REPARSE_TAG_LXSS_SYMLINK 0xa000001d // undocumented?
121 
122 #define IO_REPARSE_TAG_LXSS_SOCKET 0x80000023
123 #define IO_REPARSE_TAG_LXSS_FIFO 0x80000024
124 #define IO_REPARSE_TAG_LXSS_CHARDEV 0x80000025
125 #define IO_REPARSE_TAG_LXSS_BLOCKDEV 0x80000026
126 
127 #define BTRFS_VOLUME_PREFIX L"\\Device\\Btrfs{"
128 
129 #ifdef _MSC_VER
130 #define try __try
131 #define except __except
132 #define finally __finally
133 #else
134 #define try if (1)
135 #define except(x) if (0 && (x))
136 #define finally if (1)
137 #endif
138 
139 #ifndef __REACTOS__
140 #ifdef __GNUC__
141 #define InterlockedIncrement64(a) __sync_add_and_fetch(a, 1)
142 #endif
143 #endif
144 
145 #ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING
146 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
147 #endif
148 
149 #ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME
150 #define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400
151 #endif
152 
153 #ifndef FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
154 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
155 #endif
156 
157 typedef struct _FILE_ID_128 {
160 
161 typedef struct _DUPLICATE_EXTENTS_DATA {
167 
168 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_ACCESS)
169 
172  WORD Reserved;
173  DWORD Flags;
177 
180  WORD Reserved;
181  DWORD Flags;
183 
184 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
185 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
186 
187 #ifndef __REACTOS__
188 #ifndef _MSC_VER
189 #define __drv_aliasesMem
190 #define _Requires_lock_held_(a)
191 #define _Requires_exclusive_lock_held_(a)
192 #define _Releases_lock_(a)
193 #define _Out_writes_bytes_opt_(a)
194 #define _Pre_satisfies_(a)
195 #define _Post_satisfies_(a)
196 #define _Releases_exclusive_lock_(a)
197 #define _Dispatch_type_(a)
198 #define _Create_lock_level_(a)
199 #define _Lock_level_order_(a,b)
200 #define _Has_lock_level_(a)
201 #define _Requires_lock_not_held_(a)
202 #define _Acquires_exclusive_lock_(a)
203 #define _Acquires_shared_lock_(a)
204 #endif
205 #endif
206 
207 _Create_lock_level_(tree_lock)
208 _Create_lock_level_(fcb_lock)
209 _Lock_level_order_(tree_lock, fcb_lock)
210 
211 struct _device_extension;
212 
213 typedef struct _fcb_nonpaged {
219 } fcb_nonpaged;
220 
221 struct _root;
222 
223 typedef struct {
226  bool unique;
227  bool ignore;
228  bool inserted;
230 
232 
234 } extent;
235 
236 typedef struct {
242 } hardlink;
243 
244 struct _file_ref;
245 
246 typedef struct {
257  bool root_dir;
261 } dir_child;
262 
268 };
269 
270 typedef struct {
274  bool dirty;
275  char data[1];
276 } xattr;
277 
278 typedef struct _fcb {
284  struct _root* subvol;
291  bool deleted;
309 
315 
316  bool dirty;
324  bool created;
325 
326  bool ads;
331 
335 } fcb;
336 
337 typedef struct {
340 
341 typedef struct _file_ref {
347  bool deleted;
348  bool created;
353  struct _file_ref* parent;
355 
356  bool dirty;
357 
360 } file_ref;
361 
362 typedef struct {
364  struct _ccb* ccb;
365  void* context;
369 } send_info;
370 
371 typedef struct _ccb {
382  bool reserving;
392  bool lxss;
395 } ccb;
396 
397 struct _device_extension;
398 
399 typedef struct {
402  struct _tree* tree;
403 } tree_holder;
404 
405 typedef struct _tree_data {
408  bool ignore;
409  bool inserted;
410 
411  union {
413 
414  struct {
417  };
418  };
419 } tree_data;
420 
421 typedef struct {
423 } tree_nonpaged;
424 
425 typedef struct _tree {
432  struct _tree* parent;
434  struct _root* root;
441  bool write;
442  bool is_unique;
445 } tree;
446 
447 typedef struct {
449 } root_nonpaged;
450 
451 typedef struct _root {
453  LONGLONG lastinode; // signed so we can use InterlockedIncrement64
457  bool dirty;
458  bool received;
468 } root;
469 
484 };
485 
486 typedef struct {
488  void* data;
490  enum batch_operation operation;
492 } batch_item;
493 
494 typedef struct {
495  root* r;
498 } batch_root;
499 
500 typedef struct {
503 } traverse_ptr;
504 
505 typedef struct _root_cache {
507  struct _root_cache* next;
508 } root_cache;
509 
510 typedef struct {
515 } space;
516 
517 typedef struct {
521  bool removable;
522  bool seeding;
523  bool readonly;
524  bool reloc;
525  bool trim;
526  bool can_flush;
528  ULONG disk_num;
529  ULONG part_num;
530  uint64_t stats[5];
536 } device;
537 
538 typedef struct {
543 } range_lock;
544 
545 typedef struct {
553 
554 typedef struct {
572  bool created;
573  bool readonly;
574  bool reloc;
577  bool changed;
584 
587 } chunk;
588 
589 typedef struct {
595  bool no_csum;
601 
602 typedef struct {
604 
605  union {
608  };
609 
612 
613 typedef struct {
615  void* data;
618 } sys_chunk;
619 
620 typedef struct {
624  LONG pos, done;
628 } calc_job;
629 
630 typedef struct {
634  bool quit;
636 
637 typedef struct {
644 
645 typedef struct {
646  bool ignore;
647  bool compress;
650  bool readonly;
658  bool no_trim;
662 } mount_options;
663 
664 #define VCB_TYPE_FS 1
665 #define VCB_TYPE_CONTROL 2
666 #define VCB_TYPE_VOLUME 3
667 #define VCB_TYPE_PDO 4
668 #define VCB_TYPE_BUS 5
669 
670 #define BALANCE_OPTS_DATA 0
671 #define BALANCE_OPTS_METADATA 1
672 #define BALANCE_OPTS_SYSTEM 2
673 
674 typedef struct {
679  bool paused;
680  bool stopping;
681  bool removing;
682  bool shrinking;
688 } balance_info;
689 
690 typedef struct {
693  bool recovered;
695  bool parity;
697 
698  union {
699  struct {
704  } data;
705 
706  struct {
710  } metadata;
711  };
712 } scrub_error;
713 
714 typedef struct {
719  bool stopping;
720  bool paused;
731 } scrub_info;
732 
734 
735 typedef struct _device_extension {
742 #ifdef DEBUG_CHUNK_LOCKS
743  LONG chunk_locks_held;
744 #endif
747  bool readonly;
748  bool removing;
749  bool locked;
753  bool trim;
759  _Has_lock_level_(fcb_lock) ERESOURCE fcb_lock;
762  _Has_lock_level_(tree_lock) ERESOURCE tree_lock;
817 
818 typedef struct {
821 
822 typedef struct {
828 
829 typedef struct {
837  bool seeding;
843 } volume_child;
844 
845 struct pdo_device_extension;
846 
847 typedef struct _volume_device_extension {
856  bool removing;
857  bool dead;
860 
861 typedef struct pdo_device_extension {
866  bool removable;
868 
873 
876 
877 typedef struct {
881 } uid_map;
882 
883 typedef struct {
887 } gid_map;
888 
896 };
897 
898 struct _write_data_context;
899 
900 typedef struct {
910 
911 typedef struct _write_data_context {
915  bool need_wait;
919 
920 typedef struct {
925  bool allocated;
927 } tree_write;
928 
929 typedef struct {
932 } name_bit;
933 
935 _Acquires_shared_lock_(Vcb->fcb_lock)
936 static __inline void acquire_fcb_lock_shared(device_extension* Vcb) {
937  ExAcquireResourceSharedLite(&Vcb->fcb_lock, true);
938 }
939 
940 _Requires_lock_not_held_(Vcb->fcb_lock)
942 static __inline void acquire_fcb_lock_exclusive(device_extension* Vcb) {
943  ExAcquireResourceExclusiveLite(&Vcb->fcb_lock, true);
944 }
945 
947 _Releases_lock_(Vcb->fcb_lock)
948 static __inline void release_fcb_lock(device_extension* Vcb) {
949  ExReleaseResourceLite(&Vcb->fcb_lock);
950 }
951 
952 static __inline void* map_user_buffer(PIRP Irp, ULONG priority) {
953  if (!Irp->MdlAddress) {
954  return Irp->UserBuffer;
955  } else {
956  return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, priority);
957  }
958 }
959 
961  return (t->seconds * 10000000) + (t->nanoseconds / 100) + 116444736000000000;
962 }
963 
964 static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME* out) {
965  ULONGLONG l = (ULONGLONG)t.QuadPart - 116444736000000000;
966 
967  out->seconds = l / 10000000;
968  out->nanoseconds = (uint32_t)((l % 10000000) * 100);
969 }
970 
971 _Post_satisfies_(*stripe>=0&&*stripe<num_stripes)
972 static __inline void get_raid0_offset(_In_ uint64_t off, _In_ uint64_t stripe_length, _In_ uint16_t num_stripes, _Out_ uint64_t* stripeoff, _Out_ uint16_t* stripe) {
973  uint64_t initoff, startoff;
974 
975  startoff = off % (num_stripes * stripe_length);
976  initoff = (off / (num_stripes * stripe_length)) * stripe_length;
977 
978  *stripe = (uint16_t)(startoff / stripe_length);
979  *stripeoff = initoff + startoff - (*stripe * stripe_length);
980 }
981 
982 /* We only have 64 bits for a file ID, which isn't technically enough to be
983  * unique on Btrfs. We fudge it by having three bytes for the subvol and
984  * five for the inode, which should be good enough.
985  * Inodes are also 64 bits on Linux, but the Linux driver seems to get round
986  * this by tricking it into thinking subvols are separate volumes. */
987 static __inline uint64_t make_file_id(root* r, uint64_t inode) {
988  return (r->id << 40) | (inode & 0xffffffffff);
989 }
990 
991 #define keycmp(key1, key2)\
992  ((key1.obj_id < key2.obj_id) ? -1 :\
993  ((key1.obj_id > key2.obj_id) ? 1 :\
994  ((key1.obj_type < key2.obj_type) ? -1 :\
995  ((key1.obj_type > key2.obj_type) ? 1 :\
996  ((key1.offset < key2.offset) ? -1 :\
997  ((key1.offset > key2.offset) ? 1 :\
998  0))))))
999 
1000 _Post_satisfies_(return>=n)
1002  if (n & (a - 1))
1003  n = (n + a) & ~(a - 1);
1004 
1005  return n;
1006 }
1007 
1008 __inline static bool is_subvol_readonly(root* r, PIRP Irp) {
1009  if (!(r->root_item.flags & BTRFS_SUBVOL_READONLY))
1010  return false;
1011 
1012  if (!r->reserved)
1013  return true;
1014 
1015  return (!Irp || Irp->RequestorMode == UserMode) && PsGetCurrentProcess() != r->reserved ? true : false;
1016 }
1017 
1019  switch (type) {
1020  case TYPE_TREE_BLOCK_REF:
1021  return sizeof(TREE_BLOCK_REF);
1022 
1023  case TYPE_EXTENT_DATA_REF:
1024  return sizeof(EXTENT_DATA_REF);
1025 
1026  case TYPE_EXTENT_REF_V0:
1027  return sizeof(EXTENT_REF_V0);
1028 
1029  case TYPE_SHARED_BLOCK_REF:
1030  return sizeof(SHARED_BLOCK_REF);
1031 
1032  case TYPE_SHARED_DATA_REF:
1033  return sizeof(SHARED_DATA_REF);
1034 
1035  default:
1036  return 0;
1037  }
1038 }
1039 
1041  switch (type) {
1042  case TYPE_TREE_BLOCK_REF:
1043  return 1;
1044 
1045  case TYPE_EXTENT_DATA_REF:
1046  {
1048  return edr->count;
1049  }
1050 
1051  case TYPE_EXTENT_REF_V0:
1052  {
1053  EXTENT_REF_V0* erv0 = (EXTENT_REF_V0*)data;
1054  return erv0->count;
1055  }
1056 
1057  case TYPE_SHARED_BLOCK_REF:
1058  return 1;
1059 
1060  case TYPE_SHARED_DATA_REF:
1061  {
1063  return sdr->count;
1064  }
1065 
1066  default:
1067  return 0;
1068  }
1069 }
1070 
1071 // in btrfs.c
1074 
1075 _Success_(return)
1076 bool get_file_attributes_from_xattr(_In_reads_bytes_(len) char* val, _In_ uint16_t len, _Out_ ULONG* atts);
1077 
1079  _In_ uint8_t type, _In_ bool dotfile, _In_ bool ignore_xa, _In_opt_ PIRP Irp);
1080 
1082 bool get_xattr(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, _In_ root* subvol, _In_ uint64_t inode, _In_z_ char* name, _In_ uint32_t crc32,
1084 
1085 #ifndef DEBUG_FCB_REFCOUNTS
1086 void free_fcb(_Inout_ fcb* fcb);
1087 #endif
1088 void free_fileref(_Inout_ file_ref* fr);
1090 bool is_top_level(_In_ PIRP Irp);
1092  _Out_ root** rootptr, _In_ bool no_tree, _In_ uint64_t offset, _In_opt_ PIRP Irp);
1095  _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ bool Override, _Out_opt_ IO_STATUS_BLOCK* iosb);
1096 bool is_file_name_valid(_In_ PUNICODE_STRING us, _In_ bool posix, _In_ bool stream);
1099 
1100 #ifdef DEBUG_CHUNK_LOCKS
1101 #define acquire_chunk_lock(c, Vcb) { ExAcquireResourceExclusiveLite(&c->lock, true); InterlockedIncrement(&Vcb->chunk_locks_held); }
1102 #define release_chunk_lock(c, Vcb) { InterlockedDecrement(&Vcb->chunk_locks_held); ExReleaseResourceLite(&c->lock); }
1103 #else
1104 #define acquire_chunk_lock(c, Vcb) ExAcquireResourceExclusiveLite(&(c)->lock, true)
1105 #define release_chunk_lock(c, Vcb) ExReleaseResourceLite(&(c)->lock)
1106 #endif
1107 
1108 void mark_fcb_dirty(_In_ fcb* fcb);
1109 void mark_fileref_dirty(_In_ file_ref* fileref);
1113 void init_device(_In_ device_extension* Vcb, _Inout_ device* dev, _In_ bool get_nums);
1116  _Out_writes_bytes_(Length) PUCHAR Buffer, _In_ bool override);
1120 
1121 _Function_class_(DRIVER_ADD_DEVICE)
1123 
1124 void reap_fcb(fcb* fcb);
1129 NTSTATUS utf8_to_utf16(WCHAR* dest, ULONG dest_max, ULONG* dest_len, char* src, ULONG src_len);
1130 NTSTATUS utf16_to_utf8(char* dest, ULONG dest_max, ULONG* dest_len, WCHAR* src, ULONG src_len);
1132 
1135 
1136 void do_shutdown(PIRP Irp);
1137 
1138 #ifdef _MSC_VER
1139 #define funcname __FUNCTION__
1140 #else
1141 #define funcname __func__
1142 #endif
1143 
1144 extern bool have_sse2;
1145 
1146 extern uint32_t mount_compress;
1149 extern uint32_t mount_zlib_level;
1150 extern uint32_t mount_zstd_level;
1152 extern uint32_t mount_max_inline;
1154 extern uint32_t mount_no_barrier;
1155 extern uint32_t mount_no_trim;
1158 extern uint32_t mount_readonly;
1160 extern uint32_t no_pnp;
1161 
1162 #ifdef _DEBUG
1163 
1164 extern bool log_started;
1165 extern uint32_t debug_log_level;
1166 
1167 #ifdef DEBUG_LONG_MESSAGES
1168 
1169 #define MSG(fn, file, line, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, file, line, s, ##__VA_ARGS__) : 0
1170 
1171 #define TRACE(s, ...) MSG(funcname, __FILE__, __LINE__, s, 3, ##__VA_ARGS__)
1172 #define WARN(s, ...) MSG(funcname, __FILE__, __LINE__, s, 2, ##__VA_ARGS__)
1173 #define FIXME(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1174 #define ERR(s, ...) MSG(funcname, __FILE__, __LINE__, s, 1, ##__VA_ARGS__)
1175 
1176 void _debug_message(_In_ const char* func, _In_ const char* file, _In_ unsigned int line, _In_ char* s, ...);
1177 
1178 #else
1179 
1180 #define MSG(fn, s, level, ...) (!log_started || level <= debug_log_level) ? _debug_message(fn, s, ##__VA_ARGS__) : 0
1181 
1182 #define TRACE(s, ...) MSG(funcname, s, 3, ##__VA_ARGS__)
1183 #define WARN(s, ...) MSG(funcname, s, 2, ##__VA_ARGS__)
1184 #define FIXME(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1185 #define ERR(s, ...) MSG(funcname, s, 1, ##__VA_ARGS__)
1186 
1187 void _debug_message(_In_ const char* func, _In_ char* s, ...);
1188 
1189 #endif
1190 
1191 #else
1192 
1193 #define TRACE(s, ...)
1194 #define WARN(s, ...)
1195 #define FIXME(s, ...) DbgPrint("Btrfs FIXME : %s : " s, funcname, ##__VA_ARGS__)
1196 #define ERR(s, ...) DbgPrint("Btrfs ERR : %s : " s, funcname, ##__VA_ARGS__)
1197 
1198 #endif
1199 
1200 #ifdef DEBUG_FCB_REFCOUNTS
1201 void _free_fcb(_Inout_ fcb* fcb, _In_ const char* func);
1202 #define free_fcb(fcb) _free_fcb(fcb, funcname)
1203 #endif
1204 
1205 // in fastio.c
1207 
1208 // in crc32c.c
1210 
1211 typedef struct {
1217 } rollback_space;
1218 
1219 typedef struct {
1222 } rollback_extent;
1223 
1229 };
1230 
1231 typedef struct {
1233  void* ptr;
1235 } rollback_item;
1236 
1237 typedef struct {
1242 } ea_item;
1243 
1244 static const char lxuid[] = "$LXUID";
1245 static const char lxgid[] = "$LXGID";
1246 static const char lxmod[] = "$LXMOD";
1247 static const char lxdev[] = "$LXDEV";
1248 
1249 // in treefuncs.c
1251  _In_ const KEY* searchkey, _In_ bool ignore, _In_opt_ PIRP Irp);
1253 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);
1254 bool find_prev_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, const traverse_ptr* tp, traverse_ptr* prev_tp, PIRP Irp);
1260 void free_tree(tree* t);
1268 void clear_batch_list(device_extension* Vcb, LIST_ENTRY* batchlist);
1269 NTSTATUS skip_to_difference(device_extension* Vcb, traverse_ptr* tp, traverse_ptr* tp2, bool* ended1, bool* ended2);
1270 
1271 // in search.c
1273 
1274 _Function_class_(KSTART_ROUTINE)
1275 void __stdcall mountmgr_thread(_In_ void* context);
1276 
1277 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1279 
1283 
1284 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1286 
1288  _In_ volume_child* vc, _In_ bool skip_dev);
1289 
1290 // in cache.c
1291 void init_cache();
1293 
1294 // in write.c
1296 NTSTATUS write_file2(device_extension* Vcb, PIRP Irp, LARGE_INTEGER offset, void* buf, ULONG* length, bool paging_io, bool no_cache,
1297  bool wait, bool deferred_write, bool write_irp, LIST_ENTRY* rollback);
1302 NTSTATUS alloc_chunk(device_extension* Vcb, uint64_t flags, chunk** pc, bool full_size);
1307 
1311 
1316 
1326 void add_extent(_In_ fcb* fcb, _In_ LIST_ENTRY* prevextle, _In_ __drv_aliasesMem extent* newext);
1327 
1328 // in dirctrl.c
1329 
1332 NTSTATUS __stdcall drv_directory_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1333 
1336 
1337 // in security.c
1338 
1341 NTSTATUS __stdcall drv_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1342 
1346 
1347 void fcb_get_sd(fcb* fcb, struct _fcb* parent, bool look_for_xattr, PIRP Irp);
1348 void add_user_mapping(WCHAR* sidstring, ULONG sidstringlength, uint32_t uid);
1349 void add_group_mapping(WCHAR* sidstring, ULONG sidstringlength, uint32_t gid);
1352 NTSTATUS fcb_get_new_sd(fcb* fcb, file_ref* parfileref, ACCESS_STATE* as);
1353 void find_gid(struct _fcb* fcb, struct _fcb* parfcb, PSECURITY_SUBJECT_CONTEXT subjcont);
1354 
1355 // in fileinfo.c
1356 
1359 NTSTATUS __stdcall drv_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1360 
1363 NTSTATUS __stdcall drv_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1364 
1368 
1372 
1373 bool has_open_children(file_ref* fileref);
1375 NTSTATUS fileref_get_filename(file_ref* fileref, PUNICODE_STRING fn, USHORT* name_offset, ULONG* preqlen);
1378 
1379 // in reparse.c
1384 
1385 // in create.c
1386 
1390 
1392  _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,
1393  _In_ bool case_sensitive, _In_opt_ PIRP Irp);
1395  root* subvol, uint64_t inode, uint8_t type, PANSI_STRING utf8, bool always_add_hl, fcb* parent, fcb** pfcb, POOL_TYPE pooltype, PIRP Irp);
1397 NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, fcb* fcb, bool ignore_size, PIRP Irp);
1400  _In_ file_ref* sf, _In_ PUNICODE_STRING name, _In_ bool case_sensitive, _In_ bool lastpart, _In_ bool streampart,
1401  _In_ POOL_TYPE pooltype, _Out_ file_ref** psf2, _In_opt_ PIRP Irp);
1403 NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb* fcb, root** subvol, uint64_t* inode, dir_child** pdc, bool case_sensitive);
1404 uint32_t inherit_mode(fcb* parfcb, bool is_dir);
1407 
1408 // in fsctl.c
1412 void flush_subvol_fcbs(root* subvol);
1413 bool fcb_is_inline(fcb* fcb);
1415 
1416 // in flushthread.c
1417 
1418 _Function_class_(KSTART_ROUTINE)
1419 void __stdcall flush_thread(void* context);
1420 
1423 NTSTATUS flush_fcb(fcb* fcb, bool cache, LIST_ENTRY* batchlist, PIRP Irp);
1427 NTSTATUS do_tree_writes(device_extension* Vcb, LIST_ENTRY* tree_writes, bool no_free);
1435 
1436 // in read.c
1437 
1441 
1444  _In_ ULONG priority);
1447 NTSTATUS do_read(PIRP Irp, bool wait, ULONG* bytes_read);
1449 void raid6_recover2(uint8_t* sectors, uint16_t num_stripes, ULONG sector_size, uint16_t missing1, uint16_t missing2, uint8_t* out);
1450 
1451 // in pnp.c
1452 
1456 
1459 
1460 // in free-space.c
1472 
1473 // in extent-tree.c
1476  uint32_t refcount, bool superseded, PIRP Irp);
1484  int32_t count, bool no_csum, bool superseded, PIRP Irp);
1491 
1492 // in worker-thread.c
1496 
1497 // in registry.c
1498 void read_registry(PUNICODE_STRING regpath, bool refresh);
1502 void watch_registry(HANDLE regh);
1503 
1504 // in compress.c
1505 NTSTATUS zlib_decompress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen);
1506 NTSTATUS lzo_decompress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen, uint32_t inpageoff);
1507 NTSTATUS zstd_decompress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t outlen);
1508 NTSTATUS write_compressed_bit(fcb* fcb, uint64_t start_data, uint64_t end_data, void* data, bool* compressed, PIRP Irp, LIST_ENTRY* rollback);
1509 
1510 // in galois.c
1512 void galois_divpower(uint8_t* data, uint8_t div, uint32_t readlen);
1516 
1517 // in devctrl.c
1518 
1521 NTSTATUS __stdcall drv_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
1522 
1523 // in calcthread.c
1524 
1525 _Function_class_(KSTART_ROUTINE)
1526 void __stdcall calc_thread(void* context);
1527 
1529 void free_calc_job(calc_job* cj);
1530 
1531 // in balance.c
1539 
1540 _Function_class_(KSTART_ROUTINE)
1541 void __stdcall balance_thread(void* context);
1542 
1543 // in volume.c
1563 void add_volume_device(superblock* sb, PUNICODE_STRING devpath, uint64_t length, ULONG disk_num, ULONG part_num);
1565 
1566 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1568 
1570 
1571 // in scrub.c
1577 
1578 // in send.c
1581 
1582 // in fsrtl.c
1584 
1585 // in boot.c
1587 
1588 // based on function in sys/sysmacros.h
1589 #define makedev(major, minor) (((minor) & 0xFF) | (((major) & 0xFFF) << 8) | (((uint64_t)((minor) & ~0xFF)) << 12) | (((uint64_t)((major) & ~0xFFF)) << 32))
1590 
1591 #ifndef __REACTOS__
1592 // not in mingw yet
1593 #ifndef _MSC_VER
1594 typedef struct {
1600  union {
1603  };
1606 
1607 #define FSRTL_FCB_HEADER_V2 2
1608 
1609 #else
1610 #define FSRTL_ADVANCED_FCB_HEADER_NEW FSRTL_ADVANCED_FCB_HEADER
1611 #endif
1612 #else
1613 typedef struct {
1615  PFAST_MUTEX FastMutex;
1616  LIST_ENTRY FilterContexts;
1617  EX_PUSH_LOCK PushLock;
1619  union {
1620  OPLOCK Oplock;
1621  PVOID ReservedForRemote;
1622  };
1623  PVOID ReservedContext;
1625 
1626 #define FSRTL_FCB_HEADER_V2 2
1627 #endif
1628 
1629 static __inline POPLOCK fcb_oplock(fcb* fcb) {
1630  if (fcb->Header.Version >= FSRTL_FCB_HEADER_V2)
1631  return &((FSRTL_ADVANCED_FCB_HEADER_NEW*)&fcb->Header)->Oplock;
1632  else
1633  return &fcb->oplock;
1634 }
1635 
1638  return FastIoIsNotPossible;
1639 
1640  if (!FsRtlAreThereCurrentFileLocks(&fcb->lock) && !fcb->Vcb->readonly)
1641  return FastIoIsPossible;
1642 
1643  return FastIoIsQuestionable;
1644 }
1645 
1646 static __inline void print_open_trees(device_extension* Vcb) {
1647  LIST_ENTRY* le = Vcb->trees.Flink;
1648  while (le != &Vcb->trees) {
1650  tree_data* td = CONTAINING_RECORD(t->itemlist.Flink, tree_data, list_entry);
1651  ERR("tree %p: root %I64x, level %u, first key (%I64x,%x,%I64x)\n",
1652  t, t->root->id, t->header.level, td->key.obj_id, td->key.obj_type, td->key.offset);
1653 
1654  le = le->Flink;
1655  }
1656 }
1657 
1658 static __inline bool write_fcb_compressed(fcb* fcb) {
1659  // make sure we don't accidentally write the cache inodes or pagefile compressed
1661  return false;
1662 
1663  if (fcb->Vcb->options.compress_force)
1664  return true;
1665 
1667  return false;
1668 
1669  if (fcb->inode_item.flags & BTRFS_INODE_COMPRESS || fcb->Vcb->options.compress)
1670  return true;
1671 
1672  return false;
1673 }
1674 
1675 static __inline void do_xor(uint8_t* buf1, uint8_t* buf2, uint32_t len) {
1676  uint32_t j;
1677 #ifndef __REACTOS__
1678  __m128i x1, x2;
1679 #endif
1680 
1681 #ifndef __REACTOS__
1682  if (have_sse2 && ((uintptr_t)buf1 & 0xf) == 0 && ((uintptr_t)buf2 & 0xf) == 0) {
1683  while (len >= 16) {
1684  x1 = _mm_load_si128((__m128i*)buf1);
1685  x2 = _mm_load_si128((__m128i*)buf2);
1686  x1 = _mm_xor_si128(x1, x2);
1687  _mm_store_si128((__m128i*)buf1, x1);
1688 
1689  buf1 += 16;
1690  buf2 += 16;
1691  len -= 16;
1692  }
1693  }
1694 #endif
1695 
1696  for (j = 0; j < len; j++) {
1697  *buf1 ^= *buf2;
1698  buf1++;
1699  buf2++;
1700  }
1701 }
1702 
1703 #ifdef DEBUG_FCB_REFCOUNTS
1704 #ifdef DEBUG_LONG_MESSAGES
1705 #define increase_fileref_refcount(fileref) {\
1706  LONG rc = InterlockedIncrement(&fileref->refcount);\
1707  MSG(funcname, __FILE__, __LINE__, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1708 }
1709 #else
1710 #define increase_fileref_refcount(fileref) {\
1711  LONG rc = InterlockedIncrement(&fileref->refcount);\
1712  MSG(funcname, "fileref %p: refcount now %i\n", 1, fileref, rc);\
1713 }
1714 #endif
1715 #else
1716 #define increase_fileref_refcount(fileref) InterlockedIncrement(&fileref->refcount)
1717 #endif
1718 
1719 #ifdef _MSC_VER
1720 #define int3 __debugbreak()
1721 #else
1722 #define int3 asm("int3;")
1723 #endif
1724 
1725 #define hex_digit(c) ((c) <= 9) ? ((c) + '0') : ((c) - 10 + 'a')
1726 
1727 // FIXME - find a way to catch unfreed trees again
1728 
1729 // from sys/stat.h
1730 #define __S_IFMT 0170000 /* These bits determine file type. */
1731 #define __S_IFDIR 0040000 /* Directory. */
1732 #define __S_IFCHR 0020000 /* Character device. */
1733 #define __S_IFBLK 0060000 /* Block device. */
1734 #define __S_IFREG 0100000 /* Regular file. */
1735 #define __S_IFIFO 0010000 /* FIFO. */
1736 #define __S_IFLNK 0120000 /* Symbolic link. */
1737 #define __S_IFSOCK 0140000 /* Socket. */
1738 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
1739 
1740 #ifndef S_ISDIR
1741 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
1742 #endif
1743 
1744 #ifndef S_IRUSR
1745 #define S_IRUSR 0000400
1746 #endif
1747 
1748 #ifndef S_IWUSR
1749 #define S_IWUSR 0000200
1750 #endif
1751 
1752 #ifndef S_IXUSR
1753 #define S_IXUSR 0000100
1754 #endif
1755 
1756 #ifdef __REACTOS__
1757 #define S_IFDIR __S_IFDIR
1758 #define S_IFREG __S_IFREG
1759 #endif /* __REACTOS__ */
1760 
1761 #ifndef S_IRGRP
1762 #define S_IRGRP (S_IRUSR >> 3)
1763 #endif
1764 
1765 #ifndef S_IWGRP
1766 #define S_IWGRP (S_IWUSR >> 3)
1767 #endif
1768 
1769 #ifndef S_IXGRP
1770 #define S_IXGRP (S_IXUSR >> 3)
1771 #endif
1772 
1773 #ifndef S_IROTH
1774 #define S_IROTH (S_IRGRP >> 3)
1775 #endif
1776 
1777 #ifndef S_IWOTH
1778 #define S_IWOTH (S_IWGRP >> 3)
1779 #endif
1780 
1781 #ifndef S_IXOTH
1782 #define S_IXOTH (S_IXGRP >> 3)
1783 #endif
1784 
1785 #ifndef S_ISUID
1786 #define S_ISUID 0004000
1787 #endif
1788 
1789 #ifndef S_ISGID
1790 #define S_ISGID 0002000
1791 #endif
1792 
1793 #ifndef S_ISVTX
1794 #define S_ISVTX 0001000
1795 #endif
1796 
1797 // based on functions in sys/sysmacros.h
1798 #define major(rdev) ((((rdev) >> 8) & 0xFFF) | ((uint32_t)((rdev) >> 32) & ~0xFFF))
1799 #define minor(rdev) (((rdev) & 0xFF) | ((uint32_t)((rdev) >> 12) & ~0xFF))
1800 
1801 static __inline uint64_t fcb_alloc_size(fcb* fcb) {
1802  if (S_ISDIR(fcb->inode_item.st_mode))
1803  return 0;
1804  else if (fcb->atts & FILE_ATTRIBUTE_SPARSE_FILE)
1805  return fcb->inode_item.st_blocks;
1806  else
1807  return sector_align(fcb->inode_item.st_size, fcb->Vcb->superblock.sector_size);
1808 }
1809 
1811 
1813  ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount);
1814 
1816  PVOID Buffer, PETHREAD IoIssuerThread);
1817 
1819  PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread);
1820 
1821 #ifndef CC_ENABLE_DISK_IO_ACCOUNTING
1822 #define CC_ENABLE_DISK_IO_ACCOUNTING 0x00000010
1823 #endif
1824 
1825 #if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
1826 typedef struct _ECP_LIST ECP_LIST;
1827 typedef struct _ECP_LIST *PECP_LIST;
1828 #endif
1829 
1831 
1833 
1835 
1837 
1840 
1842 
1844 
1846 
1847 #ifndef __REACTOS__
1848 #ifndef _MSC_VER
1850 #endif
1851 
1852 // not in DDK headers - taken from winternl.h
1853 typedef struct _LDR_DATA_TABLE_ENTRY {
1862  union {
1865  };
1868 
1869 typedef struct _PEB_LDR_DATA {
1874 
1881 
1883 
1884 typedef struct _PEB {
1897 } PEB,*PPEB;
1898 #endif
1899 
1900 #ifdef _MSC_VER
1904  IN PROCESSINFOCLASS ProcessInformationClass,
1905  OUT PVOID ProcessInformation,
1906  IN ULONG ProcessInformationLength,
1908 );
1909 #endif
uint64_t get_extent_data_ref_hash2(uint64_t root, uint64_t objid, uint64_t offset)
Definition: extent-tree.c:34
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
VOID(__stdcall * tFsRtlUpdateDiskCounters)(ULONG64 BytesRead, ULONG64 BytesWritten)
Definition: btrfs_drv.h:1832
void add_volume_device(superblock *sb, PUNICODE_STRING devpath, uint64_t length, ULONG disk_num, ULONG part_num)
Definition: volume.c:1149
CACHE_MANAGER_CALLBACKS cache_callbacks
Definition: cache.c:20
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:1213
SHARED_DATA_REF sdr
Definition: btrfs_drv.h:607
struct _file_ref * parent
Definition: btrfs_drv.h:353
Definition: cache.c:48
_Must_inspect_result_ _In_ FSRTL_ALLOCATE_ECPLIST_FLAGS _Outptr_ PECP_LIST * EcpList
Definition: fltkernel.h:2511
LIST_ENTRY list_entry
Definition: btrfs_drv.h:491
GLenum func
Definition: glext.h:6028
mount_options options
Definition: btrfs_drv.h:737
void free_fileref(_Inout_ file_ref *fr)
Definition: btrfs.c:1768
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1203
ULONG * bmparr
Definition: btrfs_drv.h:547
uint64_t obj_id
Definition: btrfs.h:128
void galois_double(uint8_t *data, uint32_t len)
Definition: galois.c:109
struct _FILE_ID_128 * PFILE_ID_128
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
Definition: treefuncs.c:1049
struct _DUPLICATE_EXTENTS_DATA DUPLICATE_EXTENTS_DATA
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
BYTE Reserved4[104]
Definition: btrfs_drv.h:1891
void clear_rollback(LIST_ENTRY *rollback)
Definition: treefuncs.c:1028
uint16_t last_stripe
Definition: btrfs_drv.h:580
GLint level
Definition: gl.h:1546
struct _root * root
Definition: btrfs_drv.h:434
#define IN
Definition: typedefs.h:38
PDEVICE_OBJECT buspdo
Definition: btrfs_drv.h:824
NTSTATUS zstd_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen)
Definition: compress.c:1133
return
Definition: dirsup.c:529
bool has_address
Definition: btrfs_drv.h:429
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER * PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER
uint32_t mount_compress_type
Definition: btrfs.c:78
static const char lxuid[]
Definition: btrfs_drv.h:1244
NTSTATUS read_send_buffer(device_extension *Vcb, PFILE_OBJECT FileObject, void *data, ULONG datalen, ULONG_PTR *retlen, KPROCESSOR_MODE processor_mode)
Definition: send.c:3838
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t _In_ bool file_write
Definition: btrfs_drv.h:1314
UNICODE_STRING pnp_name
Definition: btrfs_drv.h:835
void reap_fcb(fcb *fcb)
Definition: btrfs.c:1662
LIST_ENTRY trees
Definition: btrfs_drv.h:784
_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
LIST_ENTRY trees_hash
Definition: btrfs_drv.h:785
void trim_whole_device(device *dev)
Definition: fsctl.c:2708
struct _file_ref * fileref
Definition: btrfs_drv.h:256
uint16_t size
Definition: btrfs_drv.h:556
#define true
Definition: stdbool.h:37
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ ULONG cj
Definition: winddi.h:3540
root * data_reloc_root
Definition: btrfs_drv.h:778
LIST_ENTRY space
Definition: btrfs_drv.h:532
uint8_t obj_type
Definition: btrfs.h:129
NTSTATUS remove_device(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3796
_In_ uint16_t len
Definition: btrfs_drv.h:1076
LIST_ENTRY dirty_filerefs
Definition: btrfs_drv.h:791
PFILE_OBJECT fileobj
Definition: btrfs_drv.h:519
bool skip_balance
Definition: btrfs_drv.h:656
scrub_info scrub
Definition: btrfs_drv.h:801
NTSTATUS do_read_job(PIRP Irp)
Definition: worker-thread.c:26
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
PAGED_LOOKASIDE_LIST batch_item_lookaside
Definition: btrfs_drv.h:808
void init_fast_io_dispatch(FAST_IO_DISPATCH **fiod)
Definition: fastio.c:486
LIST_ENTRY list_entry
Definition: btrfs_drv.h:585
NTSTATUS update_changed_extent_ref(device_extension *Vcb, chunk *c, uint64_t address, uint64_t size, uint64_t root, uint64_t objid, uint64_t offset, int32_t count, bool no_csum, bool superseded, PIRP Irp)
Definition: extent-tree.c:1950
NTSTATUS vol_query_volume_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:336
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1241
chunk * c
Definition: btrfs_drv.h:924
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
uint32_t calc_crc32c(_In_ uint32_t seed, _In_reads_bytes_(msglen) uint8_t *msg, _In_ ULONG msglen)
Definition: crc32c.c:116
uint64_t start
Definition: btrfs_drv.h:539
LIST_ENTRY list_entry
Definition: btrfs_drv.h:533
uint64_t system_flags
Definition: btrfs_drv.h:769
rwlock_t lock
Definition: tcpcore.h:1163
void free_write_data_stripes(write_data_context *wtc)
Definition: write.c:2291
#define _Create_lock_level_(a)
Definition: btrfs_drv.h:198
LIST_ENTRY list_entry
Definition: btrfs_drv.h:599
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:197
ULONG options
Definition: btrfs_drv.h:375
NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP *Pirp, uint32_t type)
Definition: fsctl.c:4965
NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, uint64_t inode, file_ref **pfr, PIRP Irp)
Definition: create.c:4019
PAGED_LOOKASIDE_LIST fcb_lookaside
Definition: btrfs_drv.h:810
#define IRP_MJ_QUERY_SECURITY
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:282
#define error(str)
Definition: mkdosfs.c:1605
uint32_t adshash
Definition: btrfs_drv.h:327
bool paused
Definition: btrfs_drv.h:720
NTSTATUS(__stdcall * tFsRtlGetNextExtraCreateParameter)(PECP_LIST EcpList, PVOID CurrentEcpContext, LPGUID NextEcpType, PVOID *NextEcpContext, ULONG *NextEcpContextSize)
Definition: btrfs_drv.h:1838
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
struct _root_cache root_cache
NPAGED_LOOKASIDE_LIST fcb_np_lookaside
Definition: btrfs_drv.h:814
PAGED_LOOKASIDE_LIST traverse_ptr_lookaside
Definition: btrfs_drv.h:807
static const char lxdev[]
Definition: btrfs_drv.h:1247
static __inline void do_xor(uint8_t *buf1, uint8_t *buf2, uint32_t len)
Definition: btrfs_drv.h:1675
NTSTATUS fileref_get_filename(file_ref *fileref, PUNICODE_STRING fn, USHORT *name_offset, ULONG *preqlen)
Definition: fileinfo.c:4169
uint64_t offset
Definition: btrfs_drv.h:701
void space_list_subtract(chunk *c, bool deleting, uint64_t address, uint64_t length, LIST_ENTRY *rollback)
Definition: free-space.c:2046
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:898
Definition: http.c:7098
NTSTATUS start_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3266
LIST_ENTRY list_entry
Definition: btrfs_drv.h:466
uint32_t count
Definition: btrfs.h:411
UNICODE_STRING name_uc
Definition: btrfs_drv.h:254
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
NTSTATUS write_data_complete(device_extension *Vcb, uint64_t address, void *data, uint32_t length, PIRP Irp, chunk *c, bool file_write, uint64_t irp_offset, ULONG priority)
Definition: write.c:2166
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
bool dirty
Definition: btrfs_drv.h:316
NTSTATUS vol_query_security(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:892
_In_ PIRP Irp
Definition: csq.h:116
enum _FAST_IO_POSSIBLE FAST_IO_POSSIBLE
superblock * sb
Definition: btrfs.c:4137
root * checksum_root
Definition: btrfs_drv.h:775
#define pt(x, y)
Definition: drawing.c:79
void add_user_mapping(WCHAR *sidstring, ULONG sidstringlength, uint32_t uid)
Definition: security.c:56
static const BYTE us[]
Definition: encode.c:689
bool inserted
Definition: btrfs_drv.h:409
void raid6_recover2(uint8_t *sectors, uint16_t num_stripes, ULONG sector_size, uint16_t missing1, uint16_t missing2, uint8_t *out)
Definition: read.c:842
tree_nonpaged * nonpaged
Definition: btrfs_drv.h:426
UNICODE_STRING us
Definition: btrfs_drv.h:930
NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
Definition: btrfs.c:3753
NTSTATUS uid_to_sid(uint32_t uid, PSID *sid)
Definition: security.c:229
ULONG size
Definition: btrfs_drv.h:255
NTSTATUS load_tree(device_extension *Vcb, uint64_t addr, uint8_t *buf, root *r, tree **pt)
Definition: treefuncs.c:20
_In_ ULONG * pcj
Definition: winddi.h:3642
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
NTSTATUS decrease_extent_refcount(device_extension *Vcb, uint64_t address, uint64_t size, uint8_t type, void *data, KEY *firstitem, uint8_t level, uint64_t parent, bool superseded, PIRP Irp)
Definition: extent-tree.c:902
DRIVER_ADD_DEVICE AddDevice
Definition: parport.h:72
LIST_ENTRY list_entry
Definition: btrfs_drv.h:610
struct _FILE_ID_128 FILE_ID_128
root * root
Definition: btrfs_drv.h:506
uint64_t offset
Definition: btrfs_drv.h:557
IN PIRP Irp
Definition: btrfs_drv.h:1310
void fcb_get_sd(fcb *fcb, struct _fcb *parent, bool look_for_xattr, PIRP Irp)
Definition: security.c:511
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _tree tree
int ignore(int trapCode, ppc_trap_frame_t *trap)
Definition: mmuobject.c:296
bool reparse_xattr_changed
Definition: btrfs_drv.h:320
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7667
#define IRP_MJ_SET_SECURITY
struct _device_extension device_extension
unsigned char * PUCHAR
Definition: retypes.h:3
fcb * create_fcb(device_extension *Vcb, POOL_TYPE pool_type)
Definition: create.c:51
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:518
uint32_t mount_allow_degraded
Definition: btrfs.c:87
struct _root root
#define _In_reads_bytes_opt_(size)
Definition: no_sal2.h:230
superblock superblock
Definition: btrfs_drv.h:746
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
NTSTATUS registry_mark_volume_mounted(BTRFS_UUID *uuid)
Definition: registry.c:235
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PDEVICE_OBJECT device
Definition: btrfs_drv.h:850
NTSTATUS open_fcb(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension *Vcb, root *subvol, uint64_t inode, uint8_t type, PANSI_STRING utf8, bool always_add_hl, fcb *parent, fcb **pfcb, POOL_TYPE pooltype, PIRP Irp)
Definition: create.c:668
NTSTATUS calc_csum(_In_ device_extension *Vcb, _In_reads_bytes_(sectors *Vcb->superblock.sector_size) uint8_t *data, _In_ uint32_t sectors, _Out_writes_bytes_(sectors *sizeof(uint32_t)) uint32_t *csum)
Definition: write.c:2782
#define FSRTL_FLAG2_IS_PAGING_FILE
Definition: fsrtltypes.h:57
bool can_flush
Definition: btrfs_drv.h:526
void reap_filerefs(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1823
LONG NTSTATUS
Definition: precomp.h:26
PAGED_LOOKASIDE_LIST tree_data_lookaside
Definition: btrfs_drv.h:806
batch_operation
Definition: btrfs_drv.h:470
bool sd_deleted
Definition: btrfs_drv.h:317
bool no_barrier
Definition: btrfs_drv.h:657
#define ERR(s,...)
Definition: btrfs_drv.h:1196
GLintptr offset
Definition: glext.h:5920
tree_holder treeholder
Definition: btrfs_drv.h:412
ERESOURCE fileref_lock
Definition: btrfs_drv.h:760
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1872
enum prop_compression_type prop_compression
Definition: btrfs_drv.h:303
uint16_t size
Definition: btrfs_drv.h:415
bool lock_paused_balance
Definition: btrfs_drv.h:750
ANSI_STRING ea_xattr
Definition: btrfs_drv.h:298
static int inbuf
Definition: adnsresfilter.c:73
KEVENT event
Definition: btrfs_drv.h:717
bool dirty
Definition: btrfs_drv.h:457
uint64_t data_flags
Definition: btrfs_drv.h:767
ERESOURCE range_locks_lock
Definition: btrfs_drv.h:568
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:437
NTSTATUS update_chunk_caches(device_extension *Vcb, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1846
NTSTATUS flush_partial_stripe(device_extension *Vcb, chunk *c, partial_stripe *ps)
Definition: flushthread.c:5799
#define TYPE_TREE_BLOCK_REF
Definition: btrfs.h:33
void init_file_cache(_In_ PFILE_OBJECT FileObject, _In_ CC_FILE_SIZES *ccfs)
Definition: btrfs.c:3946
void free_fcb(_Inout_ fcb *fcb)
Definition: btrfs.c:1653
GLdouble n
Definition: glext.h:7729
BYTE Reserved2[1]
Definition: btrfs_drv.h:1887
ERESOURCE chunk_lock
Definition: btrfs_drv.h:795
bool removing
Definition: btrfs_drv.h:681
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:292
ERESOURCE dirty_filerefs_lock
Definition: btrfs_drv.h:792
GLdouble GLdouble t
Definition: gl.h:2047
ERESOURCE load_tree_lock
Definition: btrfs_drv.h:448
bool dev_readonly
Definition: btrfs_drv.h:683
NTSTATUS vol_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:324
bool xattrs_changed
Definition: btrfs_drv.h:323
#define _Acquires_exclusive_lock_(a)
Definition: btrfs_drv.h:202
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:467
void free_vol(volume_device_extension *vde)
Definition: volume.c:50
NTSTATUS vol_flush_buffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:330
Definition: write.c:111
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
file_ref_nonpaged * nonpaged
Definition: btrfs_drv.h:349
ANSI_STRING utf8
Definition: btrfs_drv.h:250
FT_UInt sid
Definition: cffcmap.c:139
ROOT_ITEM root_item
Definition: btrfs_drv.h:456
LIST_ENTRY list_entry
Definition: btrfs_drv.h:231
ANSI_STRING reparse_xattr
Definition: btrfs_drv.h:297
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:852
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
uint64_t used
Definition: btrfs_drv.h:558
NTSTATUS increase_extent_refcount(device_extension *Vcb, uint64_t address, uint64_t size, uint8_t type, void *data, KEY *firstitem, uint8_t level, PIRP Irp)
Definition: extent-tree.c:453
HANDLE thread
Definition: btrfs_drv.h:675
uint8_t compress_type
Definition: btrfs_drv.h:649
LIST_ENTRY errors
Definition: btrfs_drv.h:730
void get_raid56_lock_range(chunk *c, uint64_t address, uint64_t length, uint64_t *lockaddr, uint64_t *locklen)
Definition: write.c:2150
uint64_t address
Definition: btrfs_drv.h:546
uint32_t hash
Definition: btrfs_drv.h:251
GLuint buffer
Definition: glext.h:5915
BYTE BeingDebugged
Definition: btrfs_drv.h:1886
struct _PEB_LDR_DATA * PPEB_LDR_DATA
PNOTIFY_SYNC NotifySync
Definition: btrfs_drv.h:763
uint16_t datalen
Definition: btrfs_drv.h:225
uint32_t mount_readonly
Definition: btrfs.c:88
uint32_t mount_no_trim
Definition: btrfs.c:85
struct _volume_device_extension * vde
Definition: btrfs_drv.h:740
void add_changed_extent_ref(chunk *c, uint64_t address, uint64_t size, uint64_t root, uint64_t objid, uint64_t offset, uint32_t count, bool no_csum)
Definition: extent-tree.c:2075
KEVENT event
Definition: btrfs_drv.h:625
uint32_t crc32
Definition: btrfs.c:4138
ERESOURCE load_lock
Definition: btrfs_drv.h:761
bool have_sse2
Definition: btrfs.c:69
bool readonly
Definition: btrfs_drv.h:523
NTSTATUS stop_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: scrub.c:3446
ERESOURCE send_load_lock
Definition: btrfs_drv.h:802
NTSTATUS get_device_pnp_name(_In_ PDEVICE_OBJECT DeviceObject, _Out_ PUNICODE_STRING pnp_name, _Out_ const GUID **guid)
Definition: btrfs.c:4109
bool clear_cache
Definition: btrfs_drv.h:659
GLuint GLuint end
Definition: gl.h:1545
uint64_t length
Definition: btrfs_drv.h:540
uint64_t old_size
Definition: btrfs_drv.h:592
uint64_t chunk_estimate_phys_size(device_extension *Vcb, chunk *c, uint64_t u)
Definition: btrfs.c:3733
void free_calc_job(calc_job *cj)
Definition: calcthread.c:53
bool readonly
Definition: btrfs_drv.h:573
void watch_registry(HANDLE regh)
Definition: registry.c:1027
NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb *fcb, root **subvol, uint64_t *inode, dir_child **pdc, bool case_sensitive)
Definition: create.c:151
LONG open_count
Definition: btrfs_drv.h:352
RTL_BITMAP bmp
Definition: btrfs_drv.h:549
LONGLONG lastinode
Definition: btrfs_drv.h:453
ACCESS_MASK access
Definition: btrfs_drv.h:383
LIST_ENTRY fcbs
Definition: btrfs_drv.h:464
unsigned short int uint16_t
Definition: acefiex.h:54
bool is_extent_unique(device_extension *Vcb, uint64_t address, uint64_t size, PIRP Irp)
Definition: extent-tree.c:1696
NTSTATUS read_file(fcb *fcb, uint8_t *data, uint64_t start, uint64_t length, ULONG *pbr, PIRP Irp)
Definition: read.c:2715
#define uint16_t
Definition: nsiface.idl:60
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
NTSTATUS truncate_file(fcb *fcb, uint64_t end, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:3236
ULONG part_num
Definition: btrfs_drv.h:841
LIST_ENTRY list_entry
Definition: btrfs_drv.h:436
FAST_MUTEX HeaderMutex
Definition: btrfs_drv.h:214
NTSTATUS vol_write(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:225
ERESOURCE paging_resource
Definition: btrfs_drv.h:217
NTSTATUS do_write_job(device_extension *Vcb, PIRP Irp)
Definition: worker-thread.c:68
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
bool atts_changed
Definition: btrfs_drv.h:318
LONG refcount
Definition: btrfs_drv.h:626
const char * filename
Definition: ioapi.h:135
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
NTSTATUS write_file(device_extension *Vcb, PIRP Irp, bool wait, bool deferred_write)
Definition: write.c:4631
NTSTATUS utf8_to_utf16(WCHAR *dest, ULONG dest_max, ULONG *dest_len, char *src, ULONG src_len)
Definition: btrfs.c:718
LIST_ENTRY old_refs
Definition: btrfs_drv.h:598
PSID sid
Definition: btrfs_drv.h:885
bool updated_extents
Definition: btrfs_drv.h:440
uint32_t debug_log_level
Definition: btrfs.c:75
NTSTATUS query_balance(device_extension *Vcb, void *data, ULONG length)
Definition: balance.c:3708
uint64_t parent
Definition: btrfs_drv.h:460
device * device
Definition: btrfs_drv.h:904
OPLOCK oplock
Definition: btrfs_drv.h:308
bool manage_volume_privilege
Definition: btrfs_drv.h:380
localAdvHdr FileContextSupportPointer
Definition: fsrtlfuncs.h:1704
uint64_t offset
Definition: btrfs.h:130
LIST_ENTRY list_entry
Definition: btrfs_drv.h:931
_Post_satisfies_ static stripe __inline void get_raid0_offset(_In_ uint64_t off, _In_ uint64_t stripe_length, _In_ uint16_t num_stripes, _Out_ uint64_t *stripeoff, _Out_ uint16_t *stripe)
Definition: btrfs_drv.h:972
uint8_t * data
Definition: btrfs_drv.h:416
LARGE_INTEGER resume_time
Definition: btrfs_drv.h:723
device ** devices
Definition: btrfs_drv.h:560
bool ignore
Definition: btrfs_drv.h:227
NTSTATUS utf16_to_utf8(char *dest, ULONG dest_max, ULONG *dest_len, WCHAR *src, ULONG src_len)
Definition: btrfs.c:807
LIST_ENTRY devices
Definition: btrfs_drv.h:741
bool has_wildcard
Definition: btrfs_drv.h:378
#define _Requires_exclusive_lock_held_(a)
Definition: btrfs_drv.h:191
uint64_t fcbs_version
Definition: btrfs_drv.h:462
CHAR InputBuffer[80]
Definition: conmgr.c:33
UNICODE_STRING bus_name
Definition: btrfs_drv.h:826
PAGED_LOOKASIDE_LIST name_bit_lookaside
Definition: btrfs_drv.h:811
#define _In_opt_
Definition: no_sal2.h:213
struct _DUPLICATE_EXTENTS_DATA * PDUPLICATE_EXTENTS_DATA
balance_info balance
Definition: btrfs_drv.h:800
NTSTATUS stop_balance(device_extension *Vcb, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3781
NTSTATUS error
Definition: btrfs_drv.h:728
SECTION_OBJECT_POINTERS segment_object
Definition: btrfs_drv.h:215
UNICODE_STRING filename
Definition: btrfs_drv.h:385
NTSTATUS mountmgr_add_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
Definition: volume.c:904
uint64_t chunks_left
Definition: btrfs_drv.h:677
void galois_divpower(uint8_t *data, uint8_t div, uint32_t readlen)
Definition: galois.c:55
VOID(NTAPI * PPS_POST_PROCESS_INIT_ROUTINE)(VOID)
Definition: btrfs_drv.h:1882
bool posix_delete
Definition: btrfs_drv.h:346
struct _write_data_context * context
Definition: btrfs_drv.h:901
KTIMER flush_thread_timer
Definition: btrfs_drv.h:797
BTRFS_UUID uuid
Definition: btrfs_drv.h:830
static WCHAR superseded[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1817
LIST_ENTRY list_entry_all
Definition: btrfs_drv.h:333
bool user_set_write_time
Definition: btrfs_drv.h:390
UNICODE_STRING query_string
Definition: btrfs_drv.h:377
uint64_t oldindex
Definition: btrfs_drv.h:344
uint32_t ULONG_PTR
Definition: typedefs.h:63
KEVENT finished
Definition: btrfs_drv.h:687
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:1421
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:276
_In_ fcb _In_ chunk _In_ uint64_t start_data
Definition: btrfs_drv.h:1314
#define FSRTL_FCB_HEADER_V2
Definition: btrfs_drv.h:1607
void * data
Definition: btrfs_drv.h:488
uint64_t length
Definition: btrfs_drv.h:1215
Definition: fs.h:78
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
struct _RTL_USER_PROCESS_PARAMETERS * PRTL_USER_PROCESS_PARAMETERS
uint64_t address
Definition: btrfs_drv.h:511
UNICODE_STRING name
Definition: btrfs_drv.h:849
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
PVOID DllBase
Definition: btrfs_drv.h:1857
ULONG get_file_attributes(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ uint64_t inode, _In_ uint8_t type, _In_ bool dotfile, _In_ bool ignore_xa, _In_opt_ PIRP Irp)
Definition: btrfs.c:2576
uint64_t num_children
Definition: btrfs_drv.h:869
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:865
uint32_t sid_to_uid(PSID sid)
Definition: security.c:310
UNICODE_STRING bus_name
Definition: btrfs_drv.h:854
uint32_t mount_clear_cache
Definition: btrfs.c:86
bool inserted
Definition: btrfs_drv.h:228
root * extent_root
Definition: btrfs_drv.h:774
LIST_ENTRY list_entry
Definition: btrfs_drv.h:407
void do_shutdown(PIRP Irp)
Definition: btrfs.c:5212
uint32_t hash_uc
Definition: btrfs_drv.h:253
ERESOURCE dirty_subvols_lock
Definition: btrfs_drv.h:794
bool ea_changed
Definition: btrfs_drv.h:321
KEY firstitem
Definition: btrfs_drv.h:709
struct _PEB * PPEB
static __inline uint64_t make_file_id(root *r, uint64_t inode)
Definition: btrfs_drv.h:987
fcb * old_cache
Definition: btrfs_drv.h:562
NTSTATUS add_dir_child(fcb *fcb, uint64_t inode, bool subvol, PANSI_STRING utf8, PUNICODE_STRING name, uint8_t type, dir_child **pdc)
Definition: create.c:1830
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:254
void chunk_lock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
Definition: btrfs.c:5473
struct _device_extension * Vcb
Definition: btrfs_drv.h:431
NTSTATUS update_chunk_caches_tree(device_extension *Vcb, PIRP Irp)
Definition: free-space.c:1916
SECURITY_DESCRIPTOR * sd
Definition: btrfs_drv.h:289
const GUID * guid
PSID sid
Definition: btrfs_drv.h:879
root_nonpaged * nonpaged
Definition: btrfs_drv.h:455
_Ret_maybenull_ root * find_default_subvol(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
Definition: btrfs.c:3858
_In_ ULONG _In_opt_ PVOID _In_ PDRIVER_OBJECT _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE _Inout_opt_ __drv_aliasesMem PVOID _Outptr_result_nullonfailure_ _At_ * NotificationEntry(return==0, __drv_allocatesMem(Mem))) PVOID *NotificationEntry
file_ref * create_fileref(device_extension *Vcb)
Definition: create.c:120
EXTENT_DATA_REF edr
Definition: btrfs_drv.h:606
uint64_t oldused
Definition: btrfs_drv.h:559
void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath)
Definition: search.c:263
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
uint64_t get_extent_flags(device_extension *Vcb, uint64_t address, PIRP Irp)
Definition: extent-tree.c:1834
tree * tree
Definition: btrfs_drv.h:501
uint8_t * scratch
Definition: btrfs_drv.h:916
PVOID Reserved3[2]
Definition: btrfs_drv.h:1888
LIST_ENTRY drop_roots
Definition: btrfs_drv.h:771
chunk * chunk
Definition: btrfs_drv.h:1216
LIST_ENTRY send_ops
Definition: btrfs_drv.h:804
uint8_t gpow2(uint8_t e)
Definition: galois.c:69
ULONG change_count
Definition: btrfs_drv.h:527
void space_list_add(chunk *c, uint64_t address, uint64_t length, LIST_ENTRY *rollback)
Definition: free-space.c:1958
uint32_t mount_zlib_level
Definition: btrfs.c:79
uint64_t generation
Definition: btrfs_drv.h:832
LIST_ENTRY items
Definition: btrfs_drv.h:496
NTSTATUS add_space_entry(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t offset, uint64_t size)
Definition: free-space.c:189
uint64_t id
Definition: btrfs_drv.h:452
NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, fcb *fcb, bool ignore_size, PIRP Irp)
Definition: create.c:472
static __inline bool is_subvol_readonly(root *r, PIRP Irp)
Definition: btrfs_drv.h:1008
ERESOURCE changed_extents_lock
Definition: btrfs_drv.h:571
struct _tree * tree
Definition: btrfs_drv.h:402
LIST_ENTRY list_entry
Definition: btrfs_drv.h:815
#define BTRFS_INODE_COMPRESS
Definition: propsheet.h:87
long LONG
Definition: pedump.c:60
uint64_t address
Definition: btrfs_drv.h:1214
Definition: devices.h:37
ANSI_STRING value
Definition: btrfs_drv.h:1239
LIST_ENTRY list_entry
Definition: btrfs_drv.h:332
_In_ ULONG BufferLength
Definition: usbdlib.h:225
void chunk_unlock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
Definition: btrfs.c:5520
uint64_t offset
Definition: btrfs_drv.h:224
ULONG num_errors
Definition: btrfs_drv.h:729
#define e
Definition: ke_i.h:82
NTSTATUS dismount_volume(device_extension *Vcb, bool shutdown, PIRP Irp)
Definition: fsctl.c:2573
#define _Releases_lock_(a)
Definition: btrfs_drv.h:192
BOOLEAN(__stdcall * tCcCopyReadEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread)
Definition: btrfs_drv.h:1818
bool extents_changed
Definition: btrfs_drv.h:319
bool created
Definition: btrfs_drv.h:348
unsigned int uintptr_t
Definition: crtdefs.h:300
#define IRP_MJ_SET_EA
static PVOID ptr
Definition: dispmode.c:27
#define __drv_aliasesMem
Definition: btrfs_drv.h:189
bool seeding
Definition: btrfs_drv.h:837
uint32_t mount_flush_interval
Definition: btrfs.c:81
bool changed
Definition: btrfs_drv.h:577
uint64_t address
Definition: btrfs_drv.h:691
tree_data * paritem
Definition: btrfs_drv.h:433
NTSTATUS(__stdcall * tFsRtlGetEcpListFromIrp)(PIRP Irp, PECP_LIST *EcpList)
Definition: btrfs_drv.h:1836
#define PsGetCurrentProcess
Definition: psfuncs.h:17
bool allocated
Definition: btrfs_drv.h:925
void flush_subvol_fcbs(root *subvol)
Definition: fsctl.c:246
uint32_t count
Definition: btrfs.h:398
bool root_dir
Definition: btrfs_drv.h:257
LIST_ENTRY list_entry_balance
Definition: btrfs_drv.h:586
PFILE_OBJECT root_file
Definition: btrfs_drv.h:805
LIST_ENTRY list_entry
Definition: btrfs_drv.h:550
struct _RTL_USER_PROCESS_PARAMETERS RTL_USER_PROCESS_PARAMETERS
struct pdo_device_extension pdo_device_extension
void init_device(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ bool get_nums)
Definition: btrfs.c:3273
uint64_t count
Definition: btrfs_drv.h:593
unsigned char BOOLEAN
bool specific_file
Definition: btrfs_drv.h:379
bool trim
Definition: btrfs_drv.h:525
#define _Out_writes_bytes_opt_(a)
Definition: btrfs_drv.h:193
LIST_ENTRY ** hash_ptrs_uc
Definition: btrfs_drv.h:314
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER FSCTL_SET_INTEGRITY_INFORMATION_BUFFER
bool allow_degraded
Definition: btrfs_drv.h:660
void mark_fcb_dirty(_In_ fcb *fcb)
Definition: btrfs.c:1614
void mark_fileref_dirty(_In_ file_ref *fileref)
Definition: btrfs.c:1636
root * r
Definition: btrfs_drv.h:495
char ext[3]
Definition: mkdosfs.c:358
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:833
#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
Definition: parser.c:48
uint32_t mount_no_root_dir
Definition: btrfs.c:89
NTSTATUS vol_file_system_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:362
HANDLE thread
Definition: btrfs_drv.h:363
struct _tree * parent
Definition: btrfs_drv.h:432
LIST_ENTRY job_list
Definition: btrfs_drv.h:639
bool reloc
Definition: btrfs_drv.h:574
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
NTSTATUS find_item_to_level(device_extension *Vcb, root *r, traverse_ptr *tp, const KEY *searchkey, bool ignore, uint8_t level, PIRP Irp)
Definition: treefuncs.c:568
Definition: bufpool.h:45
void add_checksum_entry(device_extension *Vcb, uint64_t address, ULONG length, uint32_t *csum, PIRP Irp)
Definition: flushthread.c:2555
#define C_ASSERT(e)
Definition: intsafe.h:79
LARGE_INTEGER finish_time
Definition: btrfs_drv.h:722
NTSTATUS do_write_file(fcb *fcb, uint64_t start_data, uint64_t end_data, void *data, PIRP Irp, bool file_write, uint32_t irp_offset, LIST_ENTRY *rollback)
Definition: write.c:3939
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
uint8_t type
Definition: btrfs_drv.h:287
struct pdo_device_extension * pdode
Definition: btrfs_drv.h:853
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:793
uint32_t hash
Definition: btrfs_drv.h:428
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
bool parity
Definition: btrfs_drv.h:695
ULONG ea_index
Definition: btrfs_drv.h:386
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
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
bool prop_compression_changed
Definition: btrfs_drv.h:322
LIST_ENTRY list_entry
Definition: btrfs_drv.h:542
LONG refcount
Definition: btrfs_drv.h:351
#define TYPE_EXTENT_DATA_REF
Definition: btrfs.h:34
bool unique
Definition: btrfs_drv.h:226
void reap_fileref(device_extension *Vcb, file_ref *fr)
Definition: btrfs.c:1788
FILE_LOCK lock
Definition: btrfs_drv.h:290
GLuint GLfloat * val
Definition: glext.h:7180
bool marked_as_orphan
Definition: btrfs_drv.h:305
_Success_(return) bool get_file_attributes_from_xattr(_In_reads_bytes_(len) char *val
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
typedef bool(CARDLIBPROC *pCanDragProc)(CardRegion &stackobj
void find_gid(struct _fcb *fcb, struct _fcb *parfcb, PSECURITY_SUBJECT_CONTEXT subjcont)
Definition: security.c:843
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2855
uint8_t gmul(uint8_t a, uint8_t b)
Definition: galois.c:73
r l[0]
Definition: byte_order.h:167
#define BTRFS_ROOT_ROOT
Definition: btrfs.h:50
static __inline bool write_fcb_compressed(fcb *fcb)
Definition: btrfs_drv.h:1658
ULONG ealen
Definition: btrfs_drv.h:299
void free_trees_root(device_extension *Vcb, root *r)
Definition: treefuncs.c:756
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:279
#define IRP_MJ_QUERY_EA
uint8_t * data
Definition: btrfs_drv.h:923
FAST_MUTEX
Definition: extypes.h:17
bool deleted
Definition: btrfs_drv.h:347
ERESOURCE dirty_fcbs_lock
Definition: btrfs_drv.h:790
NTSTATUS send_status
Definition: btrfs_drv.h:394
LARGE_INTEGER start_time
Definition: btrfs_drv.h:721
void update_extent_flags(device_extension *Vcb, uint64_t address, uint64_t flags, PIRP Irp)
Definition: extent-tree.c:1875
int64_t LONGLONG
Definition: typedefs.h:66
uint64_t last_alloc
Definition: btrfs_drv.h:579
#define _Requires_lock_not_held_(a)
Definition: btrfs_drv.h:201
#define _Out_opt_
Definition: no_sal2.h:339
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
bool add_thread_job(device_extension *Vcb, PIRP Irp)
LARGE_INTEGER SourceFileOffset
Definition: shellext.h:200
BOOLEAN(__stdcall * tCcCopyWriteEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PETHREAD IoIssuerThread)
Definition: btrfs_drv.h:1815
LONG send_ops
Definition: btrfs_drv.h:461
#define TYPE_SHARED_DATA_REF
Definition: btrfs.h:37
void reap_fcbs(device_extension *Vcb)
Definition: btrfs.c:1753
bool is_unique
Definition: btrfs_drv.h:442
uint64_t metadata_flags
Definition: btrfs_drv.h:768
uint64_t children_loaded
Definition: btrfs_drv.h:870
uint64_t st_size
Definition: btrfs.h:272
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LIST_ENTRY DirNotifyList
Definition: btrfs_drv.h:764
LIST_ENTRY list_entry
Definition: btrfs_drv.h:1234
bool checked_for_orphans
Definition: btrfs_drv.h:463
NTSTATUS write_compressed_bit(fcb *fcb, uint64_t start_data, uint64_t end_data, void *data, bool *compressed, PIRP Irp, LIST_ENTRY *rollback)
Definition: compress.c:1093
LIST_ENTRY dir_children_hash_uc
Definition: btrfs_drv.h:312
LIST_ENTRY list_entry
Definition: btrfs_drv.h:696
GLsizeiptr size
Definition: glext.h:5919
LIST_ENTRY dir_children_index
Definition: btrfs_drv.h:310
struct _fcb fcb
Definition: btrfs_drv.h:1314
void clear_batch_list(device_extension *Vcb, LIST_ENTRY *batchlist)
Definition: treefuncs.c:1203
void free_tree(tree *t)
Definition: treefuncs.c:260
#define _Acquires_shared_lock_(a)
Definition: btrfs_drv.h:203
UCHAR flags
Definition: btrfs_drv.h:1240
bool sd_dirty
Definition: btrfs_drv.h:317
NTSTATUS write_data_phys(_In_ PDEVICE_OBJECT device, _In_ PFILE_OBJECT fileobj, _In_ uint64_t address, _In_reads_bytes_(length) void *data, _In_ uint32_t length)
Definition: flushthread.c:63
NTSTATUS vol_query_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:306
bool fcb_is_inline(fcb *fcb)
Definition: fsctl.c:3237
#define __kernel_entry
Definition: specstrings.h:50
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
r parent
Definition: btrfs.c:2869
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
NTSTATUS status
Definition: btrfs_drv.h:685
uint64_t size
Definition: btrfs_drv.h:591
LIST_ENTRY xattrs
Definition: btrfs_drv.h:304
NTSTATUS vol_shutdown(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:886
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint32_t length
Definition: btrfs_drv.h:922
_STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y)
Definition: _cstdlib.h:137
_Function_class_(DRIVER_ADD_DEVICE) NTSTATUS __stdcall AddDevice(PDRIVER_OBJECT DriverObject
static __inline void print_open_trees(device_extension *Vcb)
Definition: btrfs_drv.h:1646
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
Definition: sockctrl.c:506
bool has_new_address
Definition: btrfs_drv.h:439
INT POOL_TYPE
Definition: typedefs.h:76
uint64_t inode
Definition: btrfs_drv.h:285
KEVENT finished
Definition: btrfs_drv.h:718
NTSTATUS do_tree_writes(device_extension *Vcb, LIST_ENTRY *tree_writes, bool no_free)
Definition: flushthread.c:1607
LIST_ENTRY itemlist
Definition: btrfs_drv.h:435
uint64_t ULONGLONG
Definition: typedefs.h:65
KEVENT cleared_event
Definition: btrfs_drv.h:366
static __inline uint16_t get_extent_data_len(uint8_t type)
Definition: btrfs_drv.h:1018
KEVENT range_locks_event
Definition: btrfs_drv.h:569
LIST_ENTRY range_locks
Definition: btrfs_drv.h:567
bool user_set_change_time
Definition: btrfs_drv.h:391
#define _Ret_maybenull_
Definition: no_sal2.h:590
bool had_drive_letter
Definition: btrfs_drv.h:838
BYTE Reserved1[8]
Definition: btrfs_drv.h:1870
struct _file_ref file_ref
#define Vcb
Definition: cdprocs.h:1425
rollback_type
Definition: btrfs_drv.h:1224
static __inline void * map_user_buffer(PIRP Irp, ULONG priority)
Definition: btrfs_drv.h:952
#define S_ISDIR(mode)
Definition: btrfs_drv.h:1741
ULONG CheckSum
Definition: btrfs_drv.h:1863
NTSTATUS load_csum(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, uint32_t *csum, uint64_t start, uint64_t length, PIRP Irp)
Definition: create.c:418
const GLubyte * c
Definition: glext.h:8905
uint64_t root
Definition: btrfs_drv.h:707
UCHAR Identifier[16]
Definition: btrfs_drv.h:158
uint8_t * parity1
Definition: btrfs_drv.h:916
NTSTATUS check_csum(device_extension *Vcb, uint8_t *data, uint32_t sectors, uint32_t *csum)
Definition: read.c:85
LIST_ENTRY sys_chunks
Definition: btrfs_drv.h:782
_Ret_maybenull_ device * find_device_from_uuid(_In_ device_extension *Vcb, _In_ BTRFS_UUID *uuid)
Definition: btrfs.c:3156
LIST_ENTRY list_entry
Definition: btrfs_drv.h:874
PFILE_OBJECT locked_fileobj
Definition: btrfs_drv.h:754
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
PVOID Reserved6
Definition: btrfs_drv.h:1864
KEVENT event
Definition: btrfs_drv.h:686
NTSTATUS vol_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:36
void log_device_error(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ int error)
Definition: btrfs.c:5543
__m128i
Definition: emmintrin.h:24
bool removable
Definition: btrfs_drv.h:521
unsigned long DWORD
Definition: ntddk_ex.h:95
NPAGED_LOOKASIDE_LIST fileref_np_lookaside
Definition: btrfs_drv.h:813
#define TYPE_EXTENT_REF_V0
Definition: btrfs.h:35
GLuint address
Definition: glext.h:9393
LIST_ENTRY list_entry
Definition: btrfs_drv.h:617
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
LIST_ENTRY hardlinks
Definition: btrfs_drv.h:300
ERESOURCE lock
Definition: btrfs_drv.h:640
struct _file_ref * fileref
Definition: btrfs_drv.h:301
uint64_t subvol
Definition: btrfs_drv.h:700
uint32_t mount_skip_balance
Definition: btrfs.c:83
LIST_ENTRY list_entry_index
Definition: btrfs_drv.h:258
LIST_ENTRY extents
Definition: btrfs_drv.h:296
bool find_metadata_address_in_chunk(device_extension *Vcb, chunk *c, uint64_t *address)
Definition: flushthread.c:731
bool case_sensitive
Definition: btrfs_drv.h:306
#define __stdcall
Definition: typedefs.h:25
bool chunk_usage_found
Definition: btrfs_drv.h:781
#define _Inout_
Definition: no_sal2.h:244
uint64_t find_extent_shared_tree_refcount(device_extension *Vcb, uint64_t address, uint64_t parent, PIRP Irp)
Definition: extent-tree.c:2118
BOOLEAN(__stdcall * tPsIsDiskCountersEnabled)()
Definition: btrfs_drv.h:1810
NTSTATUS write_compressed(fcb *fcb, uint64_t start_data, uint64_t end_data, void *data, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:4103
uint32_t mount_no_barrier
Definition: btrfs.c:84
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ERESOURCE fileref_lock
Definition: btrfs_drv.h:338
bool allow_extended_dasd_io
Definition: btrfs_drv.h:381
struct _LDR_DATA_TABLE_ENTRY * PLDR_DATA_TABLE_ENTRY
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER FSCTL_GET_INTEGRITY_INFORMATION_BUFFER
ERESOURCE child_lock
Definition: btrfs_drv.h:871
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
struct _tree_data tree_data
void * notification_entry
Definition: btrfs_drv.h:839
PDEVICE_OBJECT mounted_device
Definition: btrfs_drv.h:851
LARGE_INTEGER duration
Definition: btrfs_drv.h:724
* PFILE_OBJECT
Definition: iotypes.h:1955
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BYTE Reserved4[8]
Definition: btrfs_drv.h:1860
ULONG disk_num
Definition: btrfs_drv.h:840
struct _ccb * ccb
Definition: btrfs_drv.h:364
USHORT NodeType
Definition: btrfs_drv.h:372
GLbitfield flags
Definition: glext.h:7161
uint64_t total_chunks
Definition: btrfs_drv.h:676
NTSTATUS insert_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ uint64_t obj_id, _In_ uint8_t obj_type, _In_ uint64_t offset, _In_reads_bytes_opt_(size) _When_(return >=0, __drv_aliasesMem) void *data, _In_ uint16_t size, _Out_opt_ traverse_ptr *ptp, _In_opt_ PIRP Irp)
Definition: treefuncs.c:857
BOOLEAN(__stdcall * tFsRtlAreThereCurrentOrInProgressFileLocks)(PFILE_LOCK FileLock)
Definition: btrfs_drv.h:1845
void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath)
Definition: search.c:497
LIST_ENTRY list_entry
Definition: btrfs_drv.h:926
bool stopping
Definition: btrfs_drv.h:719
NTSTATUS create_root(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ uint64_t id, _Out_ root **rootptr, _In_ bool no_tree, _In_ uint64_t offset, _In_opt_ PIRP Irp)
Definition: btrfs.c:1189
#define TYPE_SHARED_BLOCK_REF
Definition: btrfs.h:36
uint32_t mount_max_inline
Definition: btrfs.c:82
uint32_t hash
Definition: btrfs_drv.h:286
LIST_ENTRY list_entry
Definition: btrfs_drv.h:497
LIST_ENTRY trim_list
Definition: btrfs_drv.h:535
uint32_t mount_compress_force
Definition: btrfs.c:77
void __stdcall check_system_root(PDRIVER_OBJECT DriverObject, PVOID Context, ULONG Count)
Definition: boot.c:278
ANSI_STRING name
Definition: btrfs_drv.h:1238
NTSTATUS update_dev_item(device_extension *Vcb, device *device, PIRP Irp)
Definition: flushthread.c:4057
PEPROCESS reserved
Definition: btrfs_drv.h:459
unsigned __int64 ULONG64
Definition: imports.h:198
void add_group_mapping(WCHAR *sidstring, ULONG sidstringlength, uint32_t gid)
Definition: security.c:145
dir_child * dc
Definition: btrfs_drv.h:354
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t decoded_size
Definition: btrfs_drv.h:1314
tree_data * item
Definition: btrfs_drv.h:502
PVOID Reserved2[2]
Definition: btrfs_drv.h:1856
unsigned char UCHAR
Definition: xmlstorage.h:181
LIST_ENTRY listentry
Definition: btrfs_drv.h:884
LIST_ENTRY children
Definition: btrfs_drv.h:350
NTSTATUS excise_extents(device_extension *Vcb, fcb *fcb, uint64_t start_data, uint64_t end_data, PIRP Irp, LIST_ENTRY *rollback)
Definition: write.c:2368
PFILE_OBJECT fileobj
Definition: btrfs_drv.h:834
struct _fcb_nonpaged fcb_nonpaged
uint32_t count
Definition: btrfs.h:420
UNICODE_STRING ImagePathName
Definition: btrfs_drv.h:1878
NTSTATUS decrease_extent_refcount_tree(device_extension *Vcb, uint64_t address, uint64_t size, uint64_t root, uint8_t level, PIRP Irp)
Definition: extent-tree.c:1559
bool space_changed
Definition: btrfs_drv.h:578
LIST_ENTRY dirty_subvols
Definition: btrfs_drv.h:793
GLenum const GLvoid * addr
Definition: glext.h:9621
tree_header header
Definition: btrfs_drv.h:427
ULONG SessionId
Definition: btrfs_drv.h:1896
PETHREAD thread
Definition: btrfs_drv.h:541
prop_compression_type
Definition: btrfs_drv.h:263
_In_ PECP_LIST _In_opt_ PVOID CurrentEcpContext
Definition: fltkernel.h:2621
LONG refcount
Definition: btrfs_drv.h:281
Definition: parse.h:22
BYTE Reserved1[2]
Definition: btrfs_drv.h:1885
bool recovered
Definition: btrfs_drv.h:693
bool uniqueness_determined
Definition: btrfs_drv.h:443
ULONG num_trim_entries
Definition: btrfs_drv.h:534
bool case_sensitive
Definition: btrfs_drv.h:387
#define NTSTATUS
Definition: precomp.h:20
bool has_open_children(file_ref *fileref)
Definition: fileinfo.c:442
NTSTATUS(__stdcall * tFsRtlValidateReparsePointBuffer)(ULONG BufferLength, PREPARSE_DATA_BUFFER ReparseBuffer)
Definition: btrfs_drv.h:1841
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1314
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1890
PAGED_LOOKASIDE_LIST fileref_lookaside
Definition: btrfs_drv.h:809
NTSTATUS flush_fcb(fcb *fcb, bool cache, LIST_ENTRY *batchlist, PIRP Irp)
Definition: flushthread.c:4776
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t _In_ bool _In_ uint64_t irp_offset
Definition: btrfs_drv.h:1314
#define VOID
Definition: acefi.h:82
LIST_ENTRY changed_extents
Definition: btrfs_drv.h:566
tree_holder treeholder
Definition: btrfs_drv.h:454
uint64_t chunks_left
Definition: btrfs_drv.h:726
LIST_ENTRY all_fcbs
Definition: btrfs_drv.h:788
LIST_ENTRY list_entry_hash_uc
Definition: btrfs_drv.h:260
uint64_t index
Definition: btrfs_drv.h:248
uint8_t * buf
Definition: btrfs_drv.h:902
NTSTATUS lzo_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen, uint32_t inpageoff)
Definition: compress.c:278
LIST_ENTRY list_entry_dirty
Definition: btrfs_drv.h:359
Definition: btrfs_drv.h:1853
GLenum GLsizei len
Definition: glext.h:6722
uint8_t * buf
Definition: btrfs_drv.h:444
unsigned char BYTE
Definition: mem.h:68
NTSTATUS get_tree_new_address(device_extension *Vcb, tree *t, PIRP Irp, LIST_ENTRY *rollback)
Definition: flushthread.c:865
GLdouble s
Definition: gl.h:2039
uint32_t zstd_level
Definition: btrfs_drv.h:652
Definition: _list.h:228
NTSTATUS vol_cleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:348
bool created
Definition: btrfs_drv.h:324
uint64_t data_scrubbed
Definition: btrfs_drv.h:727
_In_ PECP_LIST _In_opt_ PVOID _Out_opt_ LPGUID _Outptr_opt_ PVOID _Out_opt_ ULONG * NextEcpContextSize
Definition: fltkernel.h:2621
uint32_t flush_interval
Definition: btrfs_drv.h:653
fcb * fcb
Definition: btrfs_drv.h:342
Definition: typedefs.h:117
UNICODE_STRING CommandLine
Definition: btrfs_drv.h:1879
NTSTATUS increase_extent_refcount_data(device_extension *Vcb, uint64_t address, uint64_t size, uint64_t root, uint64_t inode, uint64_t offset, uint32_t refcount, PIRP Irp)
Definition: extent-tree.c:891
GLenum src
Definition: glext.h:6340
LIST_ENTRY dirty_fcbs
Definition: btrfs_drv.h:789
PVOID Reserved5[52]
Definition: btrfs_drv.h:1892
bool seeding
Definition: btrfs_drv.h:522
uint32_t zlib_level
Definition: btrfs_drv.h:651
#define _Releases_exclusive_lock_(a)
Definition: btrfs_drv.h:196
uint32_t max_inline
Definition: btrfs_drv.h:654
static __inline FAST_IO_POSSIBLE fast_io_possible(fcb *fcb)
Definition: btrfs_drv.h:1636
uint64_t address
Definition: btrfs_drv.h:921
NTSTATUS set_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: reparse.c:367
INODE_ITEM inode_item
Definition: btrfs_drv.h:288
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSTATUS registry_load_volume_options(device_extension *Vcb)
Definition: registry.c:36
USHORT valuelen
Definition: btrfs_drv.h:273
NTSTATUS get_reparse_point(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, void *buffer, DWORD buflen, ULONG_PTR *retlen)
Definition: reparse.c:22
BYTE uint8_t
Definition: msvideo1.c:66
NTSTATUS start_balance(device_extension *Vcb, void *data, ULONG length, KPROCESSOR_MODE processor_mode)
Definition: balance.c:3510
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
uint64_t st_blocks
Definition: btrfs.h:273
uint64_t flags
Definition: btrfs.h:280
LIST_ENTRY partial_stripes
Definition: btrfs_drv.h:581
uint16_t edsize
Definition: write.c:2820
KEVENT flush_thread_finished
Definition: btrfs_drv.h:798
__u8 sector_size[2]
Definition: mkdosfs.c:361
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:1649
LIST_ENTRY space_size
Definition: btrfs_drv.h:564
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:855
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:2187
INT32 int32_t
Definition: types.h:71
uint32_t get_num_of_processors()
Definition: btrfs.c:3957
uint32_t mount_compress
Definition: btrfs.c:76
void add_extent(_In_ fcb *fcb, _In_ LIST_ENTRY *prevextle, _In_ __drv_aliasesMem extent *newext)
Definition: write.c:2351
LIST_ENTRY list_entry
Definition: btrfs_drv.h:908
uint16_t filename_length
Definition: btrfs_drv.h:702
NTSTATUS vol_set_information(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:312
ERESOURCE dir_children_lock
Definition: btrfs_drv.h:218
ULONG TimeDateStamp
Definition: btrfs_drv.h:1866
bool user_set_creation_time
Definition: btrfs_drv.h:388
LIST_ENTRY chunks
Definition: btrfs_drv.h:783
NTSTATUS allocate_cache(device_extension *Vcb, bool *changed, PIRP Irp, LIST_ENTRY *rollback)
Definition: free-space.c:1378
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 load_cache_chunk(device_extension *Vcb, chunk *c, PIRP Irp)
Definition: free-space.c:979
struct _write_data_context write_data_context
LIST_ENTRY list_entry
Definition: btrfs_drv.h:368
#define _In_
Definition: no_sal2.h:204
file_ref * root_fileref
Definition: btrfs_drv.h:757
struct _ECP_LIST * PECP_LIST
Definition: fsrtltypes.h:139
ULONG balance_num
Definition: btrfs_drv.h:684
bool reloc
Definition: btrfs_drv.h:524
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:310
HANDLE thread
Definition: btrfs_drv.h:715
NTSTATUS send_subvol(device_extension *Vcb, void *data, ULONG datalen, PFILE_OBJECT FileObject, PIRP Irp)
Definition: send.c:3592
#define _Lock_level_order_(a, b)
Definition: btrfs_drv.h:199
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:1918
bool ignore
Definition: btrfs_drv.h:408
uint32_t size
Definition: btrfs_drv.h:430
extent * ext
Definition: btrfs_drv.h:1221
Definition: btrfs.h:127
ULONG get_reparse_tag_fcb(fcb *fcb)
Definition: dirctrl.c:82
uint32_t sectors
Definition: btrfs_drv.h:623
uint64_t size
Definition: btrfs_drv.h:512
PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine
Definition: btrfs_drv.h:1893
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:825
bool stats_changed
Definition: btrfs_drv.h:531
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
uint64_t total_chunks
Definition: btrfs_drv.h:725
chunk * get_chunk_from_address(device_extension *Vcb, uint64_t address)
Definition: write.c:89
NTSTATUS(__stdcall * tIoUnregisterPlugPlayNotificationEx)(PVOID NotificationEntry)
Definition: btrfs_drv.h:1834
void init_cache()
Definition: cache.c:85
NTSTATUS skip_to_difference(device_extension *Vcb, traverse_ptr *tp, traverse_ptr *tp2, bool *ended1, bool *ended2)
Definition: treefuncs.c:368
* PFAST_MUTEX
Definition: extypes.h:17
bool created
Definition: btrfs_drv.h:572
NTSTATUS zlib_decompress(uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, uint32_t outlen)
Definition: compress.c:336
uint32_t gid
Definition: btrfs_drv.h:886
static __inline uint64_t unix_time_to_win(BTRFS_TIME *t)
Definition: btrfs_drv.h:960
uint32_t * csum
Definition: btrfs_drv.h:229
UINT64 uint64_t
Definition: types.h:77
NTSTATUS vol_device_control(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:820
uint8_t level
Definition: btrfs_drv.h:708
const WCHAR * action
Definition: action.c:7783
NTSTATUS load_stored_free_space_cache(device_extension *Vcb, chunk *c, bool load_only, PIRP Irp)
Definition: free-space.c:465
LIST_ENTRY list_entry_hash
Definition: btrfs_drv.h:259
ULONG atts
Definition: btrfs_drv.h:293
NTSTATUS query_scrub(device_extension *Vcb, KPROCESSOR_MODE processor_mode, void *data, ULONG length)
Definition: scrub.c:3307
ERESOURCE resource
Definition: btrfs_drv.h:216
struct _fcb_nonpaged * nonpaged
Definition: btrfs_drv.h:280
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
LIST_ENTRY roots
Definition: btrfs_drv.h:770
drv_calc_threads calcthreads
Definition: btrfs_drv.h:799
void * context
Definition: btrfs_drv.h:365
BOOLEAN(__stdcall * tFsRtlCheckLockForOplockRequest)(PFILE_LOCK FileLock, PLARGE_INTEGER AllocationSize)
Definition: btrfs_drv.h:1843
unsigned short USHORT
Definition: pedump.c:61
ERESOURCE stats_lock
Definition: btrfs_drv.h:716
bool deleted
Definition: btrfs_drv.h:291
void space_list_subtract2(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t address, uint64_t length, chunk *c, LIST_ENTRY *rollback)
Definition: free-space.c:1967
#define _In_z_
Definition: no_sal2.h:239
GLuint start
Definition: gl.h:1545
uint32_t inherit_mode(fcb *parfcb, bool is_dir)
Definition: create.c:1905
uint8_t type
Definition: btrfs_drv.h:249
static const char lxgid[]
Definition: btrfs_drv.h:1245
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:739
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1855
ULONG disposition
Definition: btrfs_drv.h:374
uint32_t find_extent_shared_data_refcount(device_extension *Vcb, uint64_t address, uint64_t parent, PIRP Irp)
Definition: extent-tree.c:2219
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1889
bool compress_force
Definition: btrfs_drv.h:648
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void * data
Definition: btrfs_drv.h:1314
_In_ uint64_t _In_ uint64_t _In_ uint64_t generation
Definition: btrfs.c:2854
NTSTATUS dev_ioctl(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG ControlCode, _In_reads_bytes_opt_(InputBufferSize) PVOID InputBuffer, _In_ ULONG InputBufferSize, _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ bool Override, _Out_opt_ IO_STATUS_BLOCK *iosb)
Definition: btrfs.c:2813
bool log_to_phys_loaded
Definition: btrfs_drv.h:780
void remove_dir_child_from_hash_lists(fcb *fcb, dir_child *dc)
Definition: fileinfo.c:744
static __inline uint64_t fcb_alloc_size(fcb *fcb)
Definition: btrfs_drv.h:1801
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool prealloc
Definition: btrfs_drv.h:1314
static const char lxmod[]
Definition: btrfs_drv.h:1246