53#define INCOMPAT_SUPPORTED (BTRFS_INCOMPAT_FLAGS_MIXED_BACKREF | BTRFS_INCOMPAT_FLAGS_DEFAULT_SUBVOL | BTRFS_INCOMPAT_FLAGS_MIXED_GROUPS | \
54 BTRFS_INCOMPAT_FLAGS_COMPRESS_LZO | BTRFS_INCOMPAT_FLAGS_BIG_METADATA | BTRFS_INCOMPAT_FLAGS_RAID56 | \
55 BTRFS_INCOMPAT_FLAGS_EXTENDED_IREF | BTRFS_INCOMPAT_FLAGS_SKINNY_METADATA | BTRFS_INCOMPAT_FLAGS_NO_HOLES | \
56 BTRFS_INCOMPAT_FLAGS_COMPRESS_ZSTD | BTRFS_INCOMPAT_FLAGS_METADATA_UUID | BTRFS_INCOMPAT_FLAGS_RAID1C34)
57#define COMPAT_RO_SUPPORTED (BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE | BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE_VALID | \
58 BTRFS_COMPAT_RO_FLAGS_VERITY)
61static const WCHAR dosdevice_name[] = {
'\\',
'D',
'o',
's',
'D',
'e',
'v',
'i',
'c',
'e',
's',
'\\',
'B',
't',
'r',
'f',
's',0};
63DEFINE_GUID(BtrfsBusInterface, 0x4d414874, 0x6865, 0x6761, 0x6d, 0x65, 0x83, 0x69, 0x17, 0x9a, 0x7d, 0x1d);
121static void init_serial(
bool first_time);
150#define DEBUG_MESSAGE_LEN 1024
152#ifdef DEBUG_LONG_MESSAGES
155void _debug_message(
_In_ const char*
func,
_In_ char*
s, ...) {
169 DbgPrint(
"Couldn't allocate buffer in debug_message\n");
173#ifdef DEBUG_LONG_MESSAGES
215 Irp->AssociatedIrp.SystemBuffer = buf2;
220 if (!
Irp->MdlAddress) {
227 Irp->UserBuffer = buf2;
256 }
else if (log_handle !=
NULL) {
290#if defined(_ARM_) || defined(_ARM64_)
307#if defined(_AMD64_) || defined(_ARM64_)
323 for (
j = 0;
j <
len;
j++) {
392 searchkey.
obj_id = 0xffffffffffffffff;
394 searchkey.
offset = 0xffffffffffffffff;
398 ERR(
"error - find_item returned %08lx\n",
Status);
404 TRACE(
"last inode for tree %I64x is %I64x\n",
r->id,
r->lastinode);
415 TRACE(
"last inode for tree %I64x is %I64x\n",
r->id,
r->lastinode);
422 WARN(
"no INODE_ITEMs in tree %I64x\n",
r->id);
434 WARN(
"DIR_ITEM is truncated\n");
446 ERR(
"out of memory\n");
457 xasize =
sizeof(
DIR_ITEM) - 1 + xa->
m + xa->
n;
478 TRACE(
"(%p, %I64x, %I64x, %s, %08x, %p, %p)\n",
Vcb, subvol->id,
inode,
name,
crc32,
data,
datalen);
486 ERR(
"error - find_item returned %08lx\n",
Status);
518 TRACE(
"Closing file system\n");
537 Irp->IoStatus.Information = 0;
563 TRACE(
"flush buffers\n");
576 ERR(
"fcb was NULL\n");
581 if (
fcb ==
Vcb->volume_fcb) {
588 Irp->IoStatus.Information = 0;
626 nfactor =
Vcb->superblock.num_devices - 1;
629 nfactor =
Vcb->superblock.num_devices - 2;
642 sectors_used = (
Vcb->superblock.bytes_used >>
Vcb->sector_shift) * nfactor /
dfactor;
644 *totalsize = (
Vcb->superblock.total_bytes >>
Vcb->sector_shift) * nfactor /
dfactor;
645 *freespace = sectors_used > *totalsize ? 0 : (*totalsize - sectors_used);
657 for (
unsigned int i = 0;
i < us1->
Length;
i++) {
662 if (c1 >=
'a' && c1 <=
'z')
665 if (c2 >=
'a' && c2 <=
'z')
679#define INIT_UNICODE_STRING(var, val) UNICODE_STRING us##var; us##var.Buffer = (WCHAR*)val; us##var.Length = us##var.MaximumLength = sizeof(val) - sizeof(WCHAR);
718 ERR(
"ZwQueryInformationProcess returned %08lx\n",
Status);
722 if (!
pbi.PebBaseAddress)
725 peb =
pbi.PebBaseAddress;
733 bool blacklist =
false;
735 if (
entry->FullDllName.Length >= usmpr.Length) {
738 name.Buffer = &
entry->FullDllName.Buffer[(
entry->FullDllName.Length - usmpr.Length) /
sizeof(
WCHAR)];
739 name.Length =
name.MaximumLength = usmpr.Length;
744 if (!blacklist &&
entry->FullDllName.Length >= uscmd.Length) {
747 name.Buffer = &
entry->FullDllName.Buffer[(
entry->FullDllName.Length - uscmd.Length) /
sizeof(
WCHAR)];
748 name.Length =
name.MaximumLength = uscmd.Length;
753 if (!blacklist &&
entry->FullDllName.Length >= usfsutil.Length) {
756 name.Buffer = &
entry->FullDllName.Buffer[(
entry->FullDllName.Length - usfsutil.Length) /
sizeof(
WCHAR)];
757 name.Length =
name.MaximumLength = usfsutil.Length;
762 if (!blacklist &&
entry->FullDllName.Length >= usstorsvc.Length) {
765 name.Buffer = &
entry->FullDllName.Buffer[(
entry->FullDllName.Length - usstorsvc.Length) /
sizeof(
WCHAR)];
766 name.Length =
name.MaximumLength = usstorsvc.Length;
771 if (!blacklist &&
entry->FullDllName.Length >= usifstest.Length) {
774 name.Buffer = &
entry->FullDllName.Buffer[(
entry->FullDllName.Length - usifstest.Length) /
sizeof(
WCHAR)];
775 name.Length =
name.MaximumLength = usifstest.Length;
786 ERR(
"out of memory\n");
792 for (
i = 0;
i < num_frames;
i++) {
817 for (
ULONG i = 0;
i < src_len;
i++) {
822 else if ((
in[
i] & 0xe0) == 0xc0) {
823 if (
i == src_len - 1 || (
in[
i+1] & 0xc0) != 0x80) {
827 cp = ((
in[
i] & 0x1f) << 6) | (
in[
i+1] & 0x3f);
830 }
else if ((
in[
i] & 0xf0) == 0xe0) {
831 if (
i >= src_len - 2 || (
in[
i+1] & 0xc0) != 0x80 || (
in[
i+2] & 0xc0) != 0x80) {
835 cp = ((
in[
i] & 0xf) << 12) | ((
in[
i+1] & 0x3f) << 6) | (
in[
i+2] & 0x3f);
838 }
else if ((
in[
i] & 0xf8) == 0xf0) {
839 if (
i >= src_len - 3 || (
in[
i+1] & 0xc0) != 0x80 || (
in[
i+2] & 0xc0) != 0x80 || (
in[
i+3] & 0xc0) != 0x80) {
843 cp = ((
in[
i] & 0x7) << 18) | ((
in[
i+1] & 0x3f) << 12) | ((
in[
i+2] & 0x3f) << 6) | (
in[
i+3] & 0x3f);
871 *
out = 0xd800 | ((
cp & 0xffc00) >> 10);
874 *
out = 0xdc00 | (
cp & 0x3ff);
901 for (
ULONG i = 0;
i < in_len;
i++) {
905 if ((
cp & 0xfc00) == 0xd800) {
906 if (
i == in_len - 1 || (*
in & 0xfc00) != 0xdc00) {
910 cp = (
cp & 0x3ff) << 10;
917 }
else if ((
cp & 0xfc00) == 0xdc00) {
936 }
else if (
cp < 0x800) {
940 *
out = 0xc0 | ((
cp & 0x7c0) >> 6);
943 *
out = 0x80 | (
cp & 0x3f);
947 }
else if (
cp < 0x10000) {
951 *
out = 0xe0 | ((
cp & 0xf000) >> 12);
954 *
out = 0x80 | ((
cp & 0xfc0) >> 6);
957 *
out = 0x80 | (
cp & 0x3f);
965 *
out = 0xf0 | ((
cp & 0x1c0000) >> 18);
968 *
out = 0x80 | ((
cp & 0x3f000) >> 12);
971 *
out = 0x80 | ((
cp & 0xfc0) >> 6);
974 *
out = 0x80 | (
cp & 0x3f);
985 else if (
cp < 0x10000)
1008 TRACE(
"query volume information\n");
1027 bool overflow =
false;
1029 static const WCHAR ntfs[] =
L"NTFS";
1031 static const WCHAR btrfs[] =
L"Btrfs";
1032 const WCHAR* fs_name;
1033 ULONG fs_name_len, orig_fs_name_len;
1038 orig_fs_name_len = fs_name_len =
sizeof(ntfs) -
sizeof(
WCHAR);
1041 orig_fs_name_len = fs_name_len =
sizeof(btrfs) -
sizeof(
WCHAR);
1045 orig_fs_name_len = fs_name_len =
sizeof(btrfs) -
sizeof(
WCHAR);
1048 TRACE(
"FileFsAttributeInformation\n");
1068 data->MaximumComponentNameLength = 255;
1069 data->FileSystemNameLength = orig_fs_name_len;
1081 TRACE(
"FileFsDeviceInformation\n");
1104 TRACE(
"FileFsFullSizeInformation\n");
1121 TRACE(
"FileFsObjectIdInformation\n");
1136 TRACE(
"FileFsSizeInformation\n");
1152 bool overflow =
false;
1153 ULONG label_len, orig_label_len;
1155 TRACE(
"FileFsVolumeInformation\n");
1162 ERR(
"utf8_to_utf16 returned %08lx\n",
Status);
1167 orig_label_len = label_len;
1178 TRACE(
"label_len = %lu\n", label_len);
1182 ffvi.
VolumeSerialNumber =
Vcb->superblock.uuid.uuid[12] << 24 |
Vcb->superblock.uuid.uuid[13] << 16 |
Vcb->superblock.uuid.uuid[14] << 8 |
Vcb->superblock.uuid.uuid[15];
1187 if (label_len > 0) {
1192 ERR(
"utf8_to_utf16 returned %08lx\n",
Status);
1197 TRACE(
"label = %.*S\n", (
int)(label_len /
sizeof(
WCHAR)),
data->VolumeLabel);
1209 case FileFsSectorSizeInformation:
1211 FILE_FS_SECTOR_SIZE_INFORMATION*
data =
Irp->AssociatedIrp.SystemBuffer;
1213 data->LogicalBytesPerSector =
Vcb->superblock.sector_size;
1214 data->PhysicalBytesPerSectorForAtomicity =
Vcb->superblock.sector_size;
1215 data->PhysicalBytesPerSectorForPerformance =
Vcb->superblock.sector_size;
1216 data->FileSystemEffectivePhysicalBytesPerSectorForAtomicity =
Vcb->superblock.sector_size;
1217 data->ByteOffsetForSectorAlignment = 0;
1218 data->ByteOffsetForPartitionAlignment = 0;
1220 data->Flags = SSINFO_FLAGS_ALIGNED_DEVICE | SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE;
1222 if (
Vcb->trim && !
Vcb->options.no_trim)
1223 data->Flags |= SSINFO_FLAGS_TRIM_ENABLED;
1225 BytesCopied =
sizeof(FILE_FS_SECTOR_SIZE_INFORMATION);
1240 Irp->IoStatus.Information = 0;
1252 TRACE(
"query volume information returning %08lx\n",
Status);
1280 ERR(
"out of memory\n");
1286 ERR(
"out of memory\n");
1293 ERR(
"out of memory\n");
1301 r->treeholder.address = 0;
1302 r->treeholder.generation =
Vcb->superblock.generation;
1303 r->treeholder.tree =
NULL;
1306 r->received =
false;
1311 r->root_item.num_references = 1;
1312 r->fcbs_version = 0;
1313 r->checked_for_orphans =
true;
1325 ERR(
"insert_tree_item returned %08lx\n",
Status);
1339 ERR(
"out of memory\n");
1351 t->is_unique =
true;
1352 t->uniqueness_determined =
true;
1355 r->treeholder.tree =
t;
1359 t->header.address = 0;
1362 t->header.generation =
Vcb->superblock.generation;
1363 t->header.tree_id =
id;
1364 t->header.num_items = 0;
1365 t->header.level = 0;
1367 t->has_address =
false;
1377 t->has_new_address =
false;
1378 t->updated_extents =
false;
1381 t->list_entry_hash.Flink =
NULL;
1384 Vcb->need_write =
true;
1397 TRACE(
"label = %.*S\n", (
int)(ffli->VolumeLabelLength /
sizeof(
WCHAR)), ffli->VolumeLabel);
1399 vollen = ffli->VolumeLabelLength;
1401 for (
i = 0;
i < ffli->VolumeLabelLength /
sizeof(
WCHAR);
i++) {
1402 if (ffli->VolumeLabel[
i] == 0) {
1403 vollen =
i *
sizeof(
WCHAR);
1405 }
else if (ffli->VolumeLabel[
i] ==
'/' || ffli->VolumeLabel[
i] ==
'\\') {
1436 Vcb->need_write =
true;
1457 TRACE(
"set volume information\n");
1471 if (
Vcb->readonly) {
1476 if (
Vcb->removing ||
Vcb->locked) {
1483 FIXME(
"STUB: FileFsControlInformation\n");
1487 TRACE(
"FileFsLabelInformation\n");
1493 FIXME(
"STUB: FileFsObjectIdInformation\n");
1503 Irp->IoStatus.Information = 0;
1524 fn.Length =
fn.MaximumLength = 0;
1527 ERR(
"fileref_get_filename returned %08lx\n",
Status);
1531 if (reqlen > 0xffff) {
1532 WARN(
"reqlen was too long for FsRtlNotifyFilterReportChange\n");
1538 ERR(
"out of memory\n");
1547 ERR(
"fileref_get_filename returned %08lx\n",
Status);
1563 if (fileref->fcb->inode_item.st_nlink == 1) {
1580 ERR(
"open_fileref_by_inode returned %08lx\n",
Status);
1585 fn.Length =
fn.MaximumLength = 0;
1588 ERR(
"fileref_get_filename returned %08lx\n",
Status);
1593 if (parfr !=
fcb->
Vcb->root_fileref)
1594 pathlen +=
sizeof(
WCHAR);
1597 WARN(
"pathlen + hl->name.Length was too long for FsRtlNotifyFilterReportChange\n");
1605 ERR(
"out of memory\n");
1612 ERR(
"fileref_get_filename returned %08lx\n",
Status);
1618 if (parfr !=
fcb->
Vcb->root_fileref) {
1619 fn.Buffer[(pathlen /
sizeof(
WCHAR)) - 1] =
'\\';
1673 ERR(
"out of memory\n");
1679 ERR(
"out of memory\n");
1697#ifdef DEBUG_FCB_REFCOUNTS
1702#ifdef DEBUG_FCB_REFCOUNTS
1704 WARN(
"fcb %p: refcount now %i\n",
fcb, rc);
1714 fcb->
Vcb->need_write =
true;
1718 if (!fileref->dirty) {
1719 fileref->dirty =
true;
1723 InsertTailList(&fileref->fcb->Vcb->dirty_filerefs, &fileref->list_entry_dirty);
1727 fileref->fcb->Vcb->need_write =
true;
1730#ifdef DEBUG_FCB_REFCOUNTS
1738#ifdef DEBUG_FCB_REFCOUNTS
1838 ExFreeToPagedLookasideList(&
fcb->
Vcb->fcb_lookaside,
fcb);
1844 le =
Vcb->all_fcbs.Flink;
1845 while (le != &
Vcb->all_fcbs) {
1857#if defined(_DEBUG) || defined(DEBUG_FCB_REFCOUNTS)
1860#ifdef DEBUG_FCB_REFCOUNTS
1861 ERR(
"fileref %p: refcount now %i\n", fr, rc);
1866 ERR(
"fileref %p: refcount now %li\n", fr, rc);
1903 ExFreeToPagedLookasideList(&
Vcb->fileref_lookaside, fr);
1937 TRACE(
"FCB was NULL, returning success\n");
1945 TRACE(
"close called for fcb %p)\n",
fcb);
1959 if (
fcb->
Vcb->running_sends > 0) {
1960 bool send_cancelled =
false;
1966 send_cancelled =
true;
1972 if (send_cancelled) {
1985 if (open_files == 0 &&
fcb->
Vcb->removing) {
2008 if (!
Vcb->removing) {
2010 Vcb->removing =
true;
2014 if (
Vcb->vde &&
Vcb->vde->mounted_device ==
Vcb->devobj)
2015 Vcb->vde->mounted_device =
NULL;
2018 Vcb->Vpb->Flags &= ~VPB_MOUNTED;
2020 Vcb->Vpb->DeviceObject =
NULL;
2024 if (
Vcb->list_entry.Flink)
2027 if (
Vcb->balance.thread) {
2028 Vcb->balance.paused =
false;
2029 Vcb->balance.stopping =
true;
2034 if (
Vcb->scrub.thread) {
2035 Vcb->scrub.paused =
false;
2036 Vcb->scrub.stopping =
true;
2041 if (
Vcb->running_sends != 0) {
2042 bool send_cancelled =
false;
2046 le =
Vcb->send_ops.Flink;
2047 while (le != &
Vcb->send_ops) {
2050 if (!
send->cancelling) {
2051 send->cancelling =
true;
2052 send_cancelled =
true;
2062 if (send_cancelled) {
2063 while (
Vcb->running_sends != 0) {
2072 WARN(
"registry_mark_volume_unmounted returned %08lx\n",
Status);
2074 for (
i = 0;
i <
Vcb->calcthreads.num_threads;
i++) {
2075 Vcb->calcthreads.threads[
i].quit =
true;
2080 for (
i = 0;
i <
Vcb->calcthreads.num_threads;
i++) {
2098 le =
Vcb->chunks.Flink;
2099 while (le != &
Vcb->chunks) {
2208 if (
Vcb->devobj->AttachedDevice)
2223 ERR(
"excise_extents returned %08lx\n",
Status);
2228 fileref->fcb->Header.AllocationSize.QuadPart = 0;
2229 fileref->fcb->Header.FileSize.QuadPart = 0;
2230 fileref->fcb->Header.ValidDataLength.QuadPart = 0;
2236 ccfs.
FileSize = fileref->fcb->Header.FileSize;
2248 ERR(
"CcSetFileSizes threw exception %08lx\n",
Status);
2253 fileref->fcb->deleted =
true;
2255 le = fileref->children.
Flink;
2256 while (le != &fileref->children) {
2281 if (fileref->deleted) {
2286 if (fileref->fcb->subvol->send_ops > 0) {
2291 fileref->deleted =
true;
2296 TRACE(
"nlink = %u\n", fileref->fcb->inode_item.st_nlink);
2298 if (!fileref->fcb->ads) {
2299 if (fileref->parent->fcb->subvol == fileref->fcb->subvol) {
2304 fileref->fcb->inode_item_changed =
true;
2306 if (fileref->fcb->inode_item.st_nlink > 1 || make_orphan) {
2307 fileref->fcb->inode_item.st_nlink--;
2308 fileref->fcb->inode_item.transid = fileref->fcb->Vcb->superblock.generation;
2309 fileref->fcb->inode_item.sequence++;
2310 fileref->fcb->inode_item.st_ctime =
now;
2314 ERR(
"delete_fileref_fcb returned %08lx\n",
Status);
2321 le = fileref->fcb->hardlinks.
Flink;
2322 while (le != &fileref->fcb->hardlinks) {
2325 if (hl->
parent == fileref->parent->fcb->inode && hl->
index == fileref->dc->index) {
2341 }
else if (fileref->fcb->subvol->parent == fileref->parent->fcb->subvol->id) {
2342 if (fileref->fcb->subvol->root_item.num_references > 1) {
2343 fileref->fcb->subvol->root_item.num_references--;
2353 InsertTailList(&fileref->fcb->Vcb->drop_roots, &fileref->fcb->subvol->list_entry);
2355 le = fileref->children.
Flink;
2356 while (le != &fileref->children) {
2369 fileref->fcb->deleted =
true;
2376 TRACE(
"delete file %.*S\n", (
int)(fileref->dc->name.Length /
sizeof(
WCHAR)), fileref->dc->name.Buffer);
2381 if (!fileref->fcb->ads)
2386 if (!fileref->oldutf8.Buffer)
2387 fileref->oldutf8 = fileref->dc->utf8;
2391 utf8len = fileref->dc->utf8.Length;
2393 fileref->oldindex = fileref->dc->index;
2406 fileref->parent->fcb->inode_item.transid = fileref->fcb->Vcb->superblock.generation;
2407 fileref->parent->fcb->inode_item.sequence++;
2408 fileref->parent->fcb->inode_item.st_ctime =
now;
2410 if (!fileref->fcb->ads) {
2411 TRACE(
"fileref->parent->fcb->inode_item.st_size (inode %I64x) was %I64x\n", fileref->parent->fcb->inode, fileref->parent->fcb->inode_item.st_size);
2412 fileref->parent->fcb->inode_item.st_size -= utf8len * 2;
2413 TRACE(
"fileref->parent->fcb->inode_item.st_size (inode %I64x) now %I64x\n", fileref->parent->fcb->inode, fileref->parent->fcb->inode_item.st_size);
2414 fileref->parent->fcb->inode_item.st_mtime =
now;
2417 fileref->parent->fcb->inode_item_changed =
true;
2420 if (!fileref->fcb->ads && fileref->parent->dc)
2425 fileref->fcb->subvol->root_item.ctransid = fileref->fcb->Vcb->superblock.generation;
2426 fileref->fcb->subvol->root_item.ctime =
now;
2431 TRACE(
"CcUninitializeCacheMap failed\n");
2455 Irp->IoStatus.Information = 0;
2459 TRACE(
"closing file system\n");
2474 ERR(
"fcb was NULL\n");
2493 TRACE(
"fileref %p, refcount = %li, open_count = %li\n", fileref, fileref ? fileref->
refcount : 0, fileref ? fileref->
open_count : 0);
2513 TRACE(
"unlocking volume\n");
2526#ifdef DEBUG_FCB_REFCOUNTS
2527 ERR(
"fileref %p: open_count now %i\n", fileref, oc);
2531 if (!
fcb->
Vcb->removing) {
2540 ERR(
"delete_fileref_fcb returned %08lx\n",
Status);
2555 if (!fileref->
fcb->
ads || fileref->
dc) {
2571 ERR(
"delete_fileref returned %08lx\n",
Status);
2601 TRACE(
"flushed cache on close (FileObject = %p, fcb = %p, AllocationSize = %I64x, FileSize = %I64x, ValidDataLength = %I64x)\n",
2625 Irp->IoStatus.Information = 0;
2639 if (
len > 2 &&
val[0] ==
'0' &&
val[1] ==
'x') {
2643 for (
i = 2;
i <
len;
i++) {
2646 if (
val[
i] >=
'0' &&
val[
i] <=
'9')
2647 dosnum |=
val[
i] -
'0';
2648 else if (
val[
i] >=
'a' &&
val[
i] <=
'f')
2649 dosnum |=
val[
i] + 10 -
'a';
2650 else if (
val[
i] >=
'A' &&
val[
i] <=
'F')
2651 dosnum |=
val[
i] + 10 -
'a';
2654 TRACE(
"DOSATTRIB: %08lx\n", dosnum);
2673 if (get_file_attributes_from_xattr(eaval, ealen, &dosnum)) {
2682 dosnum &= ~FILE_ATTRIBUTE_DIRECTORY;
2688 dosnum &= ~FILE_ATTRIBUTE_READONLY;
2720 att &= ~FILE_ATTRIBUTE_READONLY;
2751 ERR(
"IoAllocateIrp failed\n");
2765 if (!
Irp->AssociatedIrp.SystemBuffer) {
2766 ERR(
"out of memory\n");
2776 if (!
Irp->MdlAddress) {
2777 ERR(
"IoAllocateMdl failed\n");
2791 ERR(
"MmProbeAndLockPages threw exception %08lx\n",
Status);
2857 WARN(
"superblock hash was invalid\n");
2870 WARN(
"superblock hash was invalid\n");
2892 ERR(
"out of memory\n");
2897 WARN(
"device was too short to have any superblock\n");
2903 valid_superblocks = 0;
2911 ERR(
"Failed to read superblock %lu: %08lx\n",
i,
Status);
2918 TRACE(
"not a BTRFS volume\n");
2923 TRACE(
"got superblock %lu!\n",
i);
2926 WARN(
"superblock sector size was 0\n");
2928 WARN(
"superblock sector size was not power of 2\n");
2935 valid_superblocks++;
2944 if (valid_superblocks == 0) {
2945 ERR(
"could not find any valid superblocks\n");
2949 TRACE(
"label is %s\n",
Vcb->superblock.label);
2999 ERR(
"out of memory\n");
3005 r->received =
false;
3012 r->fcbs_version = 0;
3013 r->checked_for_orphans =
false;
3020 ERR(
"out of memory\n");
3041 r->lastinode = 0x100;
3052 Vcb->extent_root =
r;
3056 Vcb->chunk_root =
r;
3064 Vcb->checksum_root =
r;
3072 Vcb->space_root =
r;
3076 Vcb->data_reloc_root =
r;
3095 ERR(
"error - find_item returned %08lx\n",
Status);
3112 ERR(
"add_root returned %08lx\n",
Status);
3129 if (!
Vcb->readonly && !
Vcb->data_reloc_root) {
3137 WARN(
"data reloc root doesn't exist, creating it\n");
3142 ERR(
"create_root returned %08lx\n",
Status);
3148 reloc_root->root_item.inode.st_blocks =
Vcb->superblock.node_size;
3150 reloc_root->root_item.inode.st_mode = 040755;
3151 reloc_root->root_item.inode.flags = 0x80000000;
3152 reloc_root->root_item.inode.flags_ro = 0xffffffff;
3154 reloc_root->root_item.bytes_used =
Vcb->superblock.node_size;
3158 ERR(
"out of memory\n");
3176 ERR(
"insert_tree_item returned %08lx\n",
Status);
3184 ERR(
"out of memory\n");
3195 ERR(
"insert_tree_item returned %08lx\n",
Status);
3201 Vcb->need_write =
true;
3230 ERR(
"error - find_item returned %08lx\n",
Status);
3244 ERR(
"add_space_entry returned %08lx\n",
Status);
3264 if (lastaddr < dev->devitem.num_bytes) {
3267 ERR(
"add_space_entry returned %08lx\n",
Status);
3282 le =
Vcb->devices.Flink;
3284 while (le != &
Vcb->devices) {
3304 le =
Vcb->devices.Flink;
3305 while (le != &
Vcb->devices) {
3308 TRACE(
"device %I64x, uuid %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
dev->devitem.
dev_id,
3309 dev->devitem.device_uuid.uuid[0],
dev->devitem.device_uuid.uuid[1],
dev->devitem.device_uuid.uuid[2],
dev->devitem.device_uuid.uuid[3],
dev->devitem.device_uuid.uuid[4],
dev->devitem.device_uuid.uuid[5],
dev->devitem.device_uuid.uuid[6],
dev->devitem.device_uuid.uuid[7],
3310 dev->devitem.device_uuid.uuid[8],
dev->devitem.device_uuid.uuid[9],
dev->devitem.device_uuid.uuid[10],
dev->devitem.device_uuid.uuid[11],
dev->devitem.device_uuid.uuid[12],
dev->devitem.device_uuid.uuid[13],
dev->devitem.device_uuid.uuid[14],
dev->devitem.device_uuid.uuid[15]);
3329 if (
Vcb->devices_loaded <
Vcb->superblock.num_devices) {
3341 ERR(
"out of memory\n");
3348 dev->devitem.device_uuid = *
uuid;
3350 dev->devitem.num_bytes = vc->
size;
3352 dev->readonly =
dev->seeding;
3354 dev->removable =
false;
3357 dev->num_trim_entries = 0;
3361 Vcb->devices_loaded++;
3375 WARN(
"could not find device with uuid %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
3389 ERR(
"dev_ioctl returned %08lx\n",
Status);
3404 ERR(
"dev_ioctl returned %08lx\n",
Status);
3409 ERR(
"iosb.Information was too short\n");
3433 WARN(
"IOCTL_STORAGE_GET_DEVICE_NUMBER returned %08lx\n",
Status);
3434 dev->disk_num = 0xffffffff;
3435 dev->part_num = 0xffffffff;
3443 dev->readonly =
dev->seeding;
3445 dev->num_trim_entries = 0;
3446 dev->stats_changed =
false;
3449 if (!
dev->readonly) {
3453 dev->readonly =
true;
3459 ERR(
"out of memory\n");
3473 apte, aptelen,
true,
NULL);
3476 TRACE(
"IOCTL_ATA_PASS_THROUGH returned %08lx for IDENTIFY DEVICE\n",
Status);
3481 dev->can_flush =
true;
3482 TRACE(
"FLUSH CACHE supported\n");
3484 TRACE(
"FLUSH CACHE not supported\n");
3489#ifdef DEBUG_TRIM_EMULATION
3504 TRACE(
"TRIM supported\n");
3506 TRACE(
"TRIM not supported\n");
3524 Vcb->data_flags = 0;
3525 Vcb->metadata_flags = 0;
3526 Vcb->system_flags = 0;
3530 ERR(
"error - find_item returned %08lx\n",
Status);
3545 le =
Vcb->devices.Flink;
3552 if (le !=
Vcb->devices.Flink)
3562 if (!done &&
Vcb->vde) {
3568 if (
Vcb->devices_loaded <
Vcb->superblock.num_devices) {
3580 ERR(
"out of memory\n");
3592 if (
dev->devitem.num_bytes > vc->
size) {
3593 WARN(
"device %I64x: DEV_ITEM says %I64x bytes, but Windows only reports %I64x\n",
tp.
item->
key.
offset,
3594 dev->devitem.num_bytes, vc->
size);
3596 dev->devitem.num_bytes = vc->
size;
3602 Vcb->devices_loaded++;
3612 if (!
Vcb->options.allow_degraded) {
3613 ERR(
"volume not found: device %I64x, uuid %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
tp.
item->
key.
offset,
3622 ERR(
"out of memory\n");
3633 Vcb->devices_loaded++;
3649 ERR(
"out of memory\n");
3655 c->used =
c->oldused = 0;
3656 c->cache =
c->old_cache =
NULL;
3658 c->readonly =
false;
3660 c->cache_loaded =
false;
3662 c->space_changed =
false;
3667 if (!
c->chunk_item) {
3668 ERR(
"out of memory\n");
3676 Vcb->data_flags =
c->chunk_item->type;
3679 Vcb->metadata_flags =
c->chunk_item->type;
3682 Vcb->system_flags =
c->chunk_item->type;
3685 if (
c->chunk_item->sub_stripes == 0 ||
c->chunk_item->sub_stripes >
c->chunk_item->num_stripes) {
3686 ERR(
"chunk %I64x: invalid stripes (num_stripes %u, sub_stripes %u)\n",
c->offset,
c->chunk_item->num_stripes,
c->chunk_item->sub_stripes);
3693 if (
c->chunk_item->num_stripes > 0) {
3700 ERR(
"out of memory\n");
3706 for (
i = 0;
i <
c->chunk_item->num_stripes;
i++) {
3708 TRACE(
"device %u = %p\n",
i,
c->devices[
i]);
3710 if (!
c->devices[
i]) {
3711 ERR(
"missing device\n");
3717 if (
c->devices[
i]->readonly)
3721 ERR(
"chunk %I64x: number of stripes is 0\n",
c->offset);
3742 c->last_alloc_set =
false;
3748 c->list_entry_balance.Flink =
NULL;
3758 Vcb->log_to_phys_loaded =
true;
3760 if (
Vcb->data_flags == 0)
3763 if (
Vcb->metadata_flags == 0)
3766 if (
Vcb->system_flags == 0)
3771 Vcb->data_flags =
Vcb->metadata_flags;
3801 TRACE(
"cut out superblock in chunk %I64x\n",
c->offset);
3812 TRACE(
"j = %u, startoffstripe = %u\n",
j, startoffstripe);
3824 TRACE(
"cut out superblock in chunk %I64x\n",
c->offset);
3833 TRACE(
"cutting out %I64x, size %I64x\n",
c->offset + off_start, off_end - off_start);
3843 TRACE(
"cut out superblock in chunk %I64x\n",
c->offset);
3852 TRACE(
"cutting out %I64x, size %I64x\n",
c->offset + off_start, off_end - off_start);
3860 TRACE(
"cut out superblock in chunk %I64x\n",
c->offset);
3886 Vcb->superblock.bytes_used = 0;
3888 while (le != &
Vcb->chunks) {
3892 searchkey.
offset =
c->chunk_item->size;
3896 ERR(
"error - find_item returned %08lx\n",
Status);
3904 c->used =
c->oldused = bgi->
used;
3906 TRACE(
"chunk %I64x has %I64x bytes used\n",
c->offset,
c->used);
3908 Vcb->superblock.bytes_used += bgi->
used;
3910 ERR(
"(%I64x;%I64x,%x,%I64x) is %u bytes, expected %Iu\n",
3918 Vcb->chunk_usage_found =
true;
3928 if (
n >
sizeof(
KEY)) {
3934 TRACE(
"bootstrap: %I64x,%x,%I64x\n",
key.obj_id,
key.obj_type,
key.offset);
3953 ERR(
"out of memory\n");
3962 ERR(
"out of memory\n");
3972 ERR(
"unexpected item %I64x,%x,%I64x in bootstrap\n",
key.obj_id,
key.obj_type,
key.offset);
3984 static const char fn[] =
"default";
3987 if (
Vcb->options.subvol_id != 0) {
3988 le =
Vcb->roots.Flink;
3989 while (le != &
Vcb->roots) {
3992 if (
r->id ==
Vcb->options.subvol_id)
4005 searchkey.
obj_id =
Vcb->superblock.root_dir_objectid;
4011 ERR(
"error - find_item returned %08lx\n",
Status);
4016 ERR(
"could not find (%I64x,%x,%I64x) in root tree\n", searchkey.
obj_id, searchkey.
obj_type, searchkey.
offset);
4033 ERR(
"root DIR_ITEM had same CRC32, but was not \"default\"\n");
4042 le =
Vcb->roots.Flink;
4043 while (le != &
Vcb->roots) {
4052 ERR(
"could not find root %I64x, using default instead\n", di->
key.
obj_id);
4056 le =
Vcb->roots.Flink;
4057 while (le != &
Vcb->roots) {
4102 if (!
Vcb->calcthreads.threads) {
4103 ERR(
"out of memory\n");
4115 for (
i = 0;
i <
Vcb->calcthreads.num_threads;
i++) {
4119 Vcb->calcthreads.threads[
i].number =
i;
4126 ERR(
"PsCreateSystemThread returned %08lx\n",
Status);
4128 for (
j = 0;
j <
i;
j++) {
4129 Vcb->calcthreads.threads[
i].quit =
true;
4148 ERR(
"IOCTL_MOUNTDEV_QUERY_DEVICE_NAME returned %08lx\n",
Status);
4156 ERR(
"out of memory\n");
4162 ERR(
"IOCTL_MOUNTDEV_QUERY_DEVICE_NAME returned %08lx\n",
Status);
4184 ERR(
"IoGetDeviceInterfaces returned %08lx\n",
Status);
4202 if (!pnp_name->Buffer) {
4203 ERR(
"out of memory\n");
4209 pnp_name->Length = pnp_name->MaximumLength =
name.Length;
4221 pnp_name->Length = pnp_name->MaximumLength = 0;
4222 pnp_name->Buffer = 0;
4238 *
guid = &GUID_DEVINTERFACE_VOLUME;
4244 *
guid = &GUID_DEVINTERFACE_HIDDEN_VOLUME;
4250 *
guid = &GUID_DEVINTERFACE_DISK;
4269 ERR(
"out of memory\n");
4275 ERR(
"sync_read_phys returned %08lx\n",
Status);
4325 ERR(
"out of memory\n");
4331 ERR(
"Failed to read superblock: %08lx\n",
Status);
4337 TRACE(
"not a BTRFS volume\n");
4352 device->Flags &= ~DO_VERIFY_VOLUME;
4367 Vcb->sector_shift = 0;
4370 Vcb->sector_shift++;
4387 bool init_lookaside =
false;
4412 bool not_pnp =
false;
4414 Status = check_mount_device(DeviceToMount, ¬_pnp);
4416 WARN(
"check_mount_device returned %08lx\n",
Status);
4425 pdo = DeviceToMount;
4446 if (pdode2->
pdo == pdo) {
4478 ERR(
"error - number of devices is zero\n");
4493 ERR(
"error - number of devices is zero\n");
4505 readobjsize = vc->
size;
4507 vde->
device->Characteristics &= ~FILE_DEVICE_SECURE_OPEN;
4512 readobj = DeviceToMount;
4516 &gli,
sizeof(gli),
true,
NULL);
4519 ERR(
"error reading length information: %08lx\n",
Status);
4528 ERR(
"IoCreateDevice returned %08lx\n",
Status);
4541 NewDeviceObject->SectorSize =
min(DeviceToMount->SectorSize, 512);
4549 Vcb->need_write =
false;
4570 else if (
Irp->Tail.Overlay.Thread)
4579 if (!vde &&
Vcb->superblock.num_devices > 1) {
4580 ERR(
"cannot mount multi-device FS with non-PNP device\n");
4591 ERR(
"registry_load_volume_options returned %08lx\n",
Status);
4614 if (
Vcb->options.ignore) {
4615 TRACE(
"ignoring volume\n");
4621 WARN(
"cannot mount because of unsupported incompat flags (%I64x)\n",
Vcb->superblock.incompat_flags & ~
INCOMPAT_SUPPORTED);
4627 Vcb->superblock.metadata_uuid =
Vcb->superblock.uuid;
4629 Vcb->readonly =
false;
4632 Vcb->readonly =
true;
4635 if (
Vcb->options.readonly)
4636 Vcb->readonly =
true;
4640 Vcb->superblock.generation++;
4643 if (
Vcb->superblock.log_tree_addr != 0) {
4644 FIXME(
"FIXME - replay transaction log (clearing for now)\n");
4645 Vcb->superblock.log_tree_addr = 0;
4648 switch (
Vcb->superblock.csum_type) {
4666 ERR(
"unrecognized csum type %x\n",
Vcb->superblock.csum_type);
4673 ERR(
"out of memory\n");
4678 dev->devobj = readobj;
4679 dev->fileobj = fileobj;
4682 if (
dev->devitem.num_bytes > readobjsize) {
4683 WARN(
"device %I64x: DEV_ITEM says %I64x bytes, but Windows only reports %I64x\n",
dev->devitem.
dev_id,
4684 dev->devitem.num_bytes, readobjsize);
4686 dev->devitem.num_bytes = readobjsize;
4694 Vcb->devices_loaded = 1;
4697 Vcb->disallow_dismount =
true;
4699 TRACE(
"DeviceToMount = %p\n", DeviceToMount);
4703 NewDeviceObject->
Flags &= ~DO_DEVICE_INITIALIZING;
4708 Vcb->log_to_phys_loaded =
false;
4712 if (!
Vcb->chunk_root) {
4713 ERR(
"Could not load chunk root.\n");
4721 ERR(
"load_sys_chunks returned %08lx\n",
Status);
4749 init_lookaside =
true;
4755 ERR(
"load_chunk_root returned %08lx\n",
Status);
4759 if (
Vcb->superblock.num_devices > 1) {
4761 ERR(
"could not mount as %I64u device(s) missing\n",
Vcb->superblock.num_devices -
Vcb->devices_loaded);
4769 if (
dev->readonly && !
Vcb->readonly) {
4770 Vcb->readonly =
true;
4772 le =
Vcb->devices.Flink;
4773 while (le != &
Vcb->devices) {
4780 Vcb->readonly =
false;
4788 WARN(
"setting volume to readonly\n");
4791 if (
dev->readonly) {
4792 WARN(
"setting volume to readonly as device is readonly\n");
4793 Vcb->readonly =
true;
4799 if (!
Vcb->root_root) {
4800 ERR(
"Could not load root of roots.\n");
4807 ERR(
"look_for_roots returned %08lx\n",
Status);
4811 if (!
Vcb->readonly) {
4814 ERR(
"find_chunk_usage returned %08lx\n",
Status);
4822 if (!
Vcb->readonly && (
4823 Vcb->options.clear_cache ||
4826 if (
Vcb->options.clear_cache)
4827 WARN(
"ClearCache option was set, clearing cache...\n");
4829 WARN(
"clearing free-space tree created by buggy Linux driver\n");
4831 WARN(
"generation was %I64x, free-space cache generation was %I64x; clearing cache...\n",
Vcb->superblock.generation - 1,
Vcb->superblock.cache_generation);
4835 ERR(
"clear_free_space_cache returned %08lx\n",
Status);
4843 ERR(
"commit_batch_list returned %08lx\n",
Status);
4848 if (!
Vcb->volume_fcb) {
4849 ERR(
"out of memory\n");
4854 Vcb->volume_fcb->Vcb =
Vcb;
4858 if (!
Vcb->dummy_fcb) {
4859 ERR(
"out of memory\n");
4864 Vcb->dummy_fcb->Vcb =
Vcb;
4866 Vcb->dummy_fcb->inode = 2;
4867 Vcb->dummy_fcb->subvol =
Vcb->root_root;
4869 Vcb->dummy_fcb->inode_item.st_nlink = 1;
4873 if (!
Vcb->dummy_fcb->hash_ptrs) {
4874 ERR(
"out of memory\n");
4882 if (!
Vcb->dummy_fcb->hash_ptrs_uc) {
4883 ERR(
"out of memory\n");
4892 ERR(
"out of memory\n");
4902#ifdef DEBUG_FCB_REFCOUNTS
4903 WARN(
"volume FCB = %p\n",
Vcb->volume_fcb);
4904 WARN(
"root FCB = %p\n", root_fcb);
4910 ERR(
"could not find top subvol\n");
4917 ERR(
"load_dir_children returned %08lx\n",
Status);
4923 searchkey.
offset = 0xffffffffffffffff;
4927 ERR(
"error - find_item returned %08lx\n",
Status);
4932 ERR(
"couldn't find INODE_ITEM for root directory\n");
4945 root_fcb->
atts &= ~FILE_ATTRIBUTE_HIDDEN;
4948 if (!
Vcb->root_fileref) {
4949 ERR(
"out of memory\n");
4954 Vcb->root_fileref->fcb = root_fcb;
4964 ERR(
"out of memory\n");
4970 Vcb->root_file->FsContext = root_fcb;
4971 Vcb->root_file->SectionObjectPointer = &root_fcb->
nonpaged->segment_object;
4978 Vcb->root_file->FsContext2 = root_ccb;
4987 le =
Vcb->devices.Flink;
4988 while (le != &
Vcb->devices) {
4993 ERR(
"find_disk_holes returned %08lx\n",
Status);
5005 NewDeviceObject->Vpb->VolumeLabelLength = 4;
5006 NewDeviceObject->Vpb->VolumeLabel[0] =
'?';
5007 NewDeviceObject->Vpb->VolumeLabel[1] = 0;
5008 NewDeviceObject->Vpb->ReferenceCount++;
5018 ERR(
"PsCreateSystemThread returned %08lx\n",
Status);
5024 ERR(
"create_calc_threads returned %08lx\n",
Status);
5030 WARN(
"registry_mark_volume_mounted returned %08lx\n",
Status);
5034 WARN(
"look_for_balance_item returned %08lx\n",
Status);
5041 Vcb->devobj = NewDeviceObject;
5053 if (init_lookaside) {
5066 else if (
Vcb->root_fileref)
5071 if (root_fcb && root_fcb->
refcount == 0)
5074 if (
Vcb->volume_fcb)
5087 if (
Vcb->devices.Flink) {
5096 if (NewDeviceObject)
5119 if (
dev->removable) {
5125 ERR(
"IOCTL_STORAGE_CHECK_VERIFY returned %08lx (user-induced)\n",
Status);
5130 bool changed =
false;
5139 TRACE(
"removing device\n");
5154 ERR(
"IOCTL_STORAGE_CHECK_VERIFY returned %08lx\n",
Status);
5157 ERR(
"iosb.Information was too short\n");
5161 dev->change_count =
cc;
5168 ERR(
"out of memory\n");
5174 ERR(
"Failed to read superblock: %08lx\n",
Status);
5180 ERR(
"not a BTRFS volume\n");
5191 ERR(
"different UUIDs\n");
5198 dev->devobj->Flags &= ~DO_VERIFY_VOLUME;
5208 bool locked =
false,
remove =
false;
5218 if (
Vcb->removing) {
5227 le =
Vcb->devices.Flink;
5228 while (le != &
Vcb->devices) {
5235 if (
dev->devobj &&
Vcb->options.allow_degraded)
5244 if (
Vcb->removing &&
Vcb->open_files == 0)
5256 Vcb->Vpb->RealDevice->Flags &= ~DO_VERIFY_VOLUME;
5274 TRACE(
"file system control\n");
5290 Irp->IoStatus.Information = 0;
5294 TRACE(
"IRP_MN_MOUNT_VOLUME\n");
5300 TRACE(
"IRP_MN_KERNEL_CALL\n");
5306 TRACE(
"IRP_MN_USER_FS_REQUEST\n");
5312 TRACE(
"IRP_MN_VERIFY_VOLUME\n");
5318 Vcb->removing =
true;
5367 TRACE(
"lock control\n");
5370 ERR(
"fcb was NULL\n");
5407 TRACE(
"shutting down Vcb %p\n",
Vcb);
5428 ERR(
"IoGetDeviceObjectPointer returned %08lx\n",
Status);
5439 ERR(
"out of memory\n");
5451 vde->
device->Vpb = newvpb;
5519 TRACE(
"shutdown\n");
5534 Irp->IoStatus.Information = 0;
5555 ERR(
"out of memory\n");
5561 ERR(
"sync_read_phys returned %08lx\n",
Status);
5567 ERR(
"magic not found\n");
5578 ERR(
"generation was %I64x, expected %I64x\n",
sb->
generation, expected_generation);
5597 le =
Vcb->devices.Flink;
5601 while (le != &
Vcb->devices) {
5610 WARN(
"forcing remount\n");
5614 ERR(
"out of memory\n");
5625 Vcb->removing =
true;
5628 voldev->Vpb = newvpb;
5635 if (
Vcb->open_files == 0)
5666 Irp->IoStatus.Information = 0;
5682 TRACE(
"doing protective flush on power state change\n");
5690 ERR(
"do_write returned %08lx\n",
Status);
5705 ERR(
"out of memory\n");
5759 Irp->IoStatus.Information = 0;
5800 if (
us->Length <
sizeof(
WCHAR))
5803 if (
us->Length > 255 *
sizeof(
WCHAR))
5806 for (
i = 0;
i <
us->Length /
sizeof(
WCHAR);
i++) {
5807 if (
us->Buffer[
i] ==
'/' ||
us->Buffer[
i] == 0 ||
5808 (!posix && (
us->Buffer[
i] ==
'/' ||
us->Buffer[
i] ==
':')) ||
5809 (!posix && !
stream && (
us->Buffer[
i] ==
'<' ||
us->Buffer[
i] ==
'>' ||
us->Buffer[
i] ==
'"' ||
5810 us->Buffer[
i] ==
'|' ||
us->Buffer[
i] ==
'?' ||
us->Buffer[
i] ==
'*' || (
us->Buffer[
i] >= 1 &&
us->Buffer[
i] <= 31))))
5815 if ((
us->Buffer[
i] & 0xfc00) == 0xdc00 && (
i == 0 || ((
us->Buffer[
i-1] & 0xfc00) != 0xd800)))
5818 if ((
us->Buffer[
i] & 0xfc00) == 0xd800 && (
i == (
us->Length /
sizeof(
WCHAR)) - 1 || ((
us->Buffer[
i+1] & 0xfc00) != 0xdc00)))
5822 if (
us->Buffer[0] ==
'.' && (
us->Length ==
sizeof(
WCHAR) || (
us->Length == 2 *
sizeof(
WCHAR) &&
us->Buffer[1] ==
'.')))
5827 if (
us->Length >= 85 *
sizeof(
WCHAR)) {
5837 else if (
stream && utf8len > 250)
5849 rl = ExAllocateFromNPagedLookasideList(&
Vcb->range_lock_lookaside);
5851 ERR(
"out of memory\n");
5864 le =
c->range_locks.
Flink;
5865 while (le != &
c->range_locks) {
5896 le =
c->range_locks.
Flink;
5897 while (le != &
c->range_locks) {
5902 ExFreeToNPagedLookasideList(&
Vcb->range_lock_lookaside, rl);
5916 dev->stats_changed =
true;
5917 Vcb->stats_changed =
true;
5949 serial_thread_handle =
NULL;
5952static void init_serial(
bool first_time) {
5957 ERR(
"IoGetDeviceObjectPointer returned %08lx\n",
Status);
5966 ERR(
"PsCreateSystemThread returned %08lx\n",
Status);
5974#if !defined(__REACTOS__) && (defined(_X86_) || defined(_AMD64_))
5975static void check_cpu() {
5976 bool have_sse2 =
false, have_sse42 =
false, have_avx2 =
false;
5980 have_sse42 = cpu_info[2] & (1 << 20);
5981 have_sse2 = cpu_info[3] & (1 << 26);
5984 have_avx2 = cpu_info[1] & (1 << 5);
5995 __asm__(
"xgetbv" :
"=a" (xcr0) :
"c" (0) :
"edx");
5998 if ((xcr0 & 6) != 6)
6005 TRACE(
"SSE4.2 is supported\n");
6008 TRACE(
"SSE4.2 not supported\n");
6011 TRACE(
"SSE2 is supported\n");
6016 TRACE(
"SSE2 is not supported\n");
6019 TRACE(
"AVX2 is supported\n");
6022 TRACE(
"AVX2 is not supported\n");
6027static void init_logging() {
6046 ERR(
"ZwCreateFile returned %08lx\n",
Status);
6054 static const char delim[] =
"\n---\n";
6061 ERR(
"ZwQueryInformationFile returned %08lx\n",
Status);
6070 ERR(
"ZwSetInformationFile returned %08lx\n",
Status);
6077 ERR(
"ZwWriteFile returned %08lx\n",
Status);
6085 ERR(
"out of memory\n");
6093 sprintf(dateline,
"Starting logging at %04i-%02i-%02i %02i:%02i:%02i\n",
tf.Year,
tf.Month,
tf.Day,
tf.Hour,
tf.Minute,
tf.Second);
6100 ERR(
"ZwWriteFile returned %08lx\n",
Status);
6123 TRACE(
"timer expired\n");
6146 static const WCHAR arc_name_prefix[] =
L"\\ArcName\\btrfs(";
6148 WCHAR arc_name[(
sizeof(arc_name_prefix) /
sizeof(
WCHAR)) - 1 + 37];
6185 ERR(
"out of memory\n");
6193 anp = &arc_name[(
sizeof(arc_name_prefix) /
sizeof(
WCHAR)) - 1];
6196 for (
i = 0;
i < 16;
i++) {
6205 if (
i == 3 ||
i == 5 ||
i == 7 ||
i == 9) {
6218 ERR(
"IoCreateDevice returned %08lx\n",
Status);
6222 arc_name_us.
Buffer = arc_name;
6227 WARN(
"IoCreateSymbolicLink returned %08lx\n",
Status);
6234 vde->
name = volname;
6245 WARN(
"IoRegisterDeviceInterface returned %08lx\n",
Status);
6259 voldev->
Flags &= ~DO_DEVICE_INITIALIZING;
6263 WARN(
"IoSetDeviceInterfaceState returned %08lx\n",
Status);
6293 ERR(
"RtlGetVersion returned %08lx\n",
Status);
6318 ERR(
"out of memory\n");
6333 TRACE(
"DriverEntry\n");
6335#if !defined(__REACTOS__) && (defined(_X86_) || defined(_AMD64_))
6346 if (fPsIsDiskCountersEnabled) {
6347 diskacc = fPsIsDiskCountersEnabled();
6448 ERR(
"IoCreateDevice returned %08lx\n",
Status);
6463 ERR(
"IoCreateSymbolicLink returned %08lx\n",
Status);
6478 ERR(
"ZwCreateKey returned %08lx\n",
Status);
6487 ERR(
"IoCreateDevice returned %08lx\n",
Status);
6500 ERR(
"IoReportDetectedDevice returned %08lx\n",
Status);
6506 WARN(
"IoRegisterDeviceInterface returned %08lx\n",
Status);
6514 WARN(
"IoSetDeviceInterfaceState returned %08lx\n",
Status);
6522 WARN(
"PsCreateSystemThread returned %08lx\n",
Status);
6529 ERR(
"IoRegisterPlugPlayNotification returned %08lx\n",
Status);
6534 ERR(
"IoRegisterPlugPlayNotification returned %08lx\n",
Status);
6539 ERR(
"IoRegisterPlugPlayNotification returned %08lx\n",
Status);
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
ACPI_SIZE strlen(const char *String)
unsigned short int uint16_t
#define InterlockedIncrement
#define InterlockedDecrement
#define IDE_COMMAND_IDENTIFY
#define FILE_NON_DIRECTORY_FILE
#define FILE_DELETE_ON_CLOSE
void blake2b(void *out, size_t outlen, const void *in, size_t inlen)
#define BTRFS_LAST_FREE_OBJECTID
NTSTATUS __stdcall compat_FsRtlValidateReparsePointBuffer(IN ULONG BufferLength, IN PREPARSE_DATA_BUFFER ReparseBuffer)
NTSTATUS(__stdcall * tFsRtlValidateReparsePointBuffer)(ULONG BufferLength, PREPARSE_DATA_BUFFER ReparseBuffer)
#define increase_fileref_refcount(fileref)
NTSTATUS registry_load_volume_options(device_extension *Vcb)
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
_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)
static __inline FAST_IO_POSSIBLE fast_io_possible(fcb *fcb)
CACHE_MANAGER_CALLBACKS cache_callbacks
#define BTRFS_VOLUME_PREFIX
#define READ_AHEAD_GRANULARITY
#define keycmp(key1, key2)
NTSTATUS(__stdcall * tIoUnregisterPlugPlayNotificationEx)(PVOID NotificationEntry)
NTSTATUS NTSTATUS NTSTATUS NTSTATUS NTSTATUS excise_extents(device_extension *Vcb, fcb *fcb, uint64_t start_data, uint64_t end_data, PIRP Irp, LIST_ENTRY *rollback) __attribute__((nonnull(1
#define _Dispatch_type_(a)
NTSTATUS add_space_entry(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t offset, uint64_t size)
BOOLEAN(__stdcall * tPsIsDiskCountersEnabled)()
void void void NTSTATUS void NTSTATUS NTSTATUS remove_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath)
void void void NTSTATUS commit_batch_list(_Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp) __attribute__((nonnull(1
static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME *out)
void(__stdcall * xor_func)(uint8_t *buf1, uint8_t *buf2, uint32_t len)
NTSTATUS registry_mark_volume_unmounted(BTRFS_UUID *uuid)
#define FILE_SUPPORTS_POSIX_UNLINK_RENAME
void fcb_get_sd(fcb *fcb, struct _fcb *parent, bool look_for_xattr, PIRP Irp)
void space_list_subtract2(LIST_ENTRY *list, LIST_ENTRY *list_size, uint64_t address, uint64_t length, chunk *c, LIST_ENTRY *rollback)
#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL
VOID(__stdcall * tCcSetAdditionalCacheAttributesEx)(PFILE_OBJECT FileObject, ULONG Flags)
BOOLEAN(__stdcall * tFsRtlCheckLockForOplockRequest)(PFILE_LOCK FileLock, PLARGE_INTEGER AllocationSize)
#define EA_DOSATTRIB_HASH
VOID(__stdcall * tFsRtlUpdateDiskCounters)(ULONG64 BytesRead, ULONG64 BytesWritten)
NTSTATUS vol_close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
void init_fast_io_dispatch(FAST_IO_DISPATCH **fiod)
static __inline POPLOCK fcb_oplock(fcb *fcb)
void free_vol(volume_device_extension *vde)
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback) __attribute__((nonnull(1
VOID(__stdcall * tPsUpdateDiskCounters)(PEPROCESS Process, ULONG64 BytesRead, ULONG64 BytesWritten, ULONG ReadOperationCount, ULONG WriteOperationCount, ULONG FlushOperationCount)
_In_ uint16_t _Out_ ULONG * atts
NTSTATUS(__stdcall * tFsRtlGetEcpListFromIrp)(PIRP Irp, PECP_LIST *EcpList)
void watch_registry(HANDLE regh)
void void void NTSTATUS void clear_batch_list(device_extension *Vcb, LIST_ENTRY *batchlist) __attribute__((nonnull(1
#define FILE_SUPPORTS_BLOCK_REFCOUNTING
NTSTATUS dismount_volume(device_extension *Vcb, bool shutdown, PIRP Irp)
NTSTATUS clear_free_space_cache(device_extension *Vcb, LIST_ENTRY *batchlist, PIRP Irp)
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)
NTSTATUS NTSTATUS bool bool find_prev_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, const traverse_ptr *tp, traverse_ptr *prev_tp, PIRP Irp) __attribute__((nonnull(1
BOOLEAN(__stdcall * tFsRtlAreThereCurrentOrInProgressFileLocks)(PFILE_LOCK FileLock)
NTSTATUS(__stdcall * tFsRtlGetNextExtraCreateParameter)(PECP_LIST EcpList, PVOID CurrentEcpContext, LPGUID NextEcpType, PVOID *NextEcpContext, ULONG *NextEcpContextSize)
void calc_sha256(uint8_t *hash, const void *input, size_t len)
NTSTATUS NTSTATUS bool bool void free_trees(device_extension *Vcb) __attribute__((nonnull(1)))
#define CC_ENABLE_DISK_IO_ACCOUNTING
BOOLEAN(__stdcall * tCcCopyWriteEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PETHREAD IoIssuerThread)
NTSTATUS insert_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_ uint64_t obj_id, _In_ uint8_t obj_type, _In_ uint64_t offset, _In_reads_bytes_opt_(size) _When_(return >=0, __drv_aliasesMem) void *data, _In_ uint16_t size, _Out_opt_ traverse_ptr *ptp, _In_opt_ PIRP Irp) __attribute__((nonnull(1
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)
void read_registry(PUNICODE_STRING regpath, bool refresh)
NTSTATUS NTSTATUS void clear_rollback(LIST_ENTRY *rollback) __attribute__((nonnull(1)))
NTSTATUS registry_mark_volume_mounted(BTRFS_UUID *uuid)
NTSTATUS fileref_get_filename(file_ref *fileref, PUNICODE_STRING fn, USHORT *name_offset, ULONG *preqlen)
void do_unlock_volume(device_extension *Vcb)
NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP *Pirp, uint32_t type)
fcb * create_fcb(device_extension *Vcb, POOL_TYPE pool_type)
BOOLEAN(__stdcall * tCcCopyReadEx)(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PETHREAD IoIssuerThread)
NTSTATUS NTSTATUS bool find_next_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, const traverse_ptr *tp, traverse_ptr *next_tp, bool ignore, PIRP Irp) __attribute__((nonnull(1
PDEVICE_OBJECT PhysicalDeviceObject
file_ref * create_fileref(device_extension *Vcb)
NTSTATUS NTSTATUS delete_tree_item(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _Inout_ traverse_ptr *tp) __attribute__((nonnull(1
void space_list_subtract(chunk *c, uint64_t address, uint64_t length, LIST_ENTRY *rollback)
void remove_dir_child_from_hash_lists(fcb *fcb, dir_child *dc)
#define BTRFS_NODE_TYPE_CCB
NTSTATUS load_dir_children(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, fcb *fcb, bool ignore_size, PIRP Irp)
static btrfs_root * add_root(LIST_ENTRY *roots, uint64_t id)
VOID NTAPI CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject, IN ULONG Granularity)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
_In_ PFCB _In_ LONGLONG StartingOffset
#define FILE_DEVICE_SECURE_OPEN
#define IOCTL_DISK_IS_WRITABLE
#define _Requires_lock_held_(lock)
#define _Requires_exclusive_lock_held_(lock)
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
#define FILE_ATTRIBUTE_NORMAL
#define crc32(crc, buf, len)
static const WCHAR *const ext[]
static LONG find_item(PropertyBag *This, LPCOLESTR name)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
DRIVER_INITIALIZE DriverEntry
NTSTATUS look_for_balance_item(_Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb)
void mark_fcb_dirty(_In_ fcb *fcb)
static ULONG get_device_change_count(_In_ PDEVICE_OBJECT devobj)
void do_shutdown(PIRP Irp)
static bool is_device_removable(_In_ PDEVICE_OBJECT devobj)
#define INIT_UNICODE_STRING(var, val)
void reap_filerefs(device_extension *Vcb, file_ref *fr)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
void log_device_error(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ int error)
static bool lie_about_fs_type()
NTSTATUS get_device_pnp_name(_In_ PDEVICE_OBJECT DeviceObject, _Out_ PUNICODE_STRING pnp_name, _Out_ const GUID **guid)
NTSTATUS delete_fileref(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_ bool make_orphan, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
void free_fileref(_Inout_ file_ref *fr)
tCcCopyReadEx fCcCopyReadEx
static bool device_still_valid(device *dev, uint64_t expected_generation)
void chunk_lock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
HANDLE mountmgr_thread_handle
uint32_t mount_max_inline
tCcCopyWriteEx fCcCopyWriteEx
void reap_fileref(device_extension *Vcb, file_ref *fr)
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)
NTSTATUS utf16_to_utf8(char *dest, ULONG dest_max, ULONG *dest_len, WCHAR *src, ULONG src_len)
static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static bool is_btrfs_volume(_In_ PDEVICE_OBJECT DeviceObject)
static void calculate_total_space(_In_ device_extension *Vcb, _Out_ uint64_t *totalsize, _Out_ uint64_t *freespace)
UNICODE_STRING log_device
void chunk_unlock_range(_In_ device_extension *Vcb, _In_ chunk *c, _In_ uint64_t start, _In_ uint64_t length)
UNICODE_STRING registry_path
tFsRtlAreThereCurrentOrInProgressFileLocks fFsRtlAreThereCurrentOrInProgressFileLocks
void free_fcb(_Inout_ fcb *fcb)
static void add_device_to_list(_In_ device_extension *Vcb, _In_ device *dev)
static bool compare_strings(const UNICODE_STRING *us1, const UNICODE_STRING *us2)
uint32_t mount_allow_degraded
uint32_t mount_skip_balance
NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
static const WCHAR device_name[]
static NTSTATUS look_for_roots(_Requires_exclusive_lock_held_(_Curr_->tree_lock) _In_ device_extension *Vcb, _In_opt_ PIRP Irp)
void mark_fileref_dirty(_In_ file_ref *fileref)
uint32_t mount_zlib_level
static NTSTATUS verify_device(_In_ device_extension *Vcb, _Inout_ device *dev)
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)
KEVENT mountmgr_thread_event
uint32_t mount_zstd_level
static NTSTATUS get_device_pnp_name_guid(_In_ PDEVICE_OBJECT DeviceObject, _Out_ PUNICODE_STRING pnp_name, _In_ const GUID *guid)
static const WCHAR dosdevice_name[]
tCcSetAdditionalCacheAttributesEx fCcSetAdditionalCacheAttributesEx
bool is_top_level(_In_ PIRP Irp)
uint32_t mount_compress_type
tPsUpdateDiskCounters fPsUpdateDiskCounters
static NTSTATUS find_disk_holes(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ device *dev, _In_opt_ PIRP Irp)
bool check_superblock_checksum(superblock *sb)
static NTSTATUS create_calc_threads(_In_ PDEVICE_OBJECT DeviceObject)
void queue_notification_fcb(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
static NTSTATUS delete_fileref_fcb(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
tFsRtlGetEcpListFromIrp fFsRtlGetEcpListFromIrp
uint32_t mount_no_root_dir
uint32_t mount_flush_interval
tFsRtlCheckLockForOplockRequest fFsRtlCheckLockForOplockRequest
tFsRtlUpdateDiskCounters fFsRtlUpdateDiskCounters
_Ret_maybenull_ root * find_default_subvol(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
PDEVICE_OBJECT master_devobj
tFsRtlGetNextExtraCreateParameter fFsRtlGetNextExtraCreateParameter
void init_device(_In_ device_extension *Vcb, _Inout_ device *dev, _In_ bool get_nums)
_In_ uint64_t _In_ uint64_t addr
static NTSTATUS set_label(_In_ device_extension *Vcb, _In_ FILE_FS_LABEL_INFORMATION *ffli)
#define INCOMPAT_SUPPORTED
ERESOURCE global_loading_lock
void * notification_entry3
NTSTATUS sync_read_phys(_In_ PDEVICE_OBJECT DeviceObject, _In_ PFILE_OBJECT FileObject, _In_ uint64_t StartingOffset, _In_ ULONG Length, _Out_writes_bytes_(Length) PUCHAR Buffer, _In_ bool override)
HANDLE degraded_wait_handle
static bool still_has_superblock(_In_ PDEVICE_OBJECT device, _In_ PFILE_OBJECT fileobj)
static NTSTATUS verify_volume(_In_ PDEVICE_OBJECT devobj)
tIoUnregisterPlugPlayNotificationEx fIoUnregisterPlugPlayNotificationEx
void protect_superblocks(_Inout_ chunk *c)
NTSTATUS check_file_name_valid(_In_ PUNICODE_STRING us, _In_ bool posix, _In_ bool stream)
void init_file_cache(_In_ PFILE_OBJECT FileObject, _In_ CC_FILE_SIZES *ccfs)
_In_ uint64_t _In_ uint64_t _In_ uint64_t generation
uint32_t mount_no_barrier
void uninit(_In_ device_extension *Vcb)
static NTSTATUS load_chunk_root(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_opt_ PIRP Irp)
tFsRtlValidateReparsePointBuffer fFsRtlValidateReparsePointBuffer
static void __stdcall do_xor_basic(uint8_t *buf1, uint8_t *buf2, uint32_t len)
static NTSTATUS read_superblock(_In_ device_extension *Vcb, _In_ PDEVICE_OBJECT device, _In_ PFILE_OBJECT fileobj, _In_ uint64_t length)
static void send_notification_fcb(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
void send_notification_fileref(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
#define COMPAT_RO_SUPPORTED
uint32_t mount_compress_force
void reap_fcbs(device_extension *Vcb)
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)
void * notification_entry2
NTSTATUS utf8_to_utf16(WCHAR *dest, ULONG dest_max, ULONG *dest_len, char *src, ULONG src_len)
BOOLEAN WdmlibRtlIsNtDdiVersionAvailable(ULONG Version)
uint32_t mount_clear_cache
uint32_t get_num_of_processors()
static void calculate_sector_shift(device_extension *Vcb)
static NTSTATUS load_sys_chunks(_In_ device_extension *Vcb)
static bool get_last_inode(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension *Vcb, _In_ root *r, _In_opt_ PIRP Irp)
_Ret_maybenull_ device * find_device_from_uuid(_In_ device_extension *Vcb, _In_ BTRFS_UUID *uuid)
void * notification_entry
#define BTRFS_ROOT_DATA_RELOC
#define BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE
static const uint64_t superblock_addrs[]
#define BTRFS_ROOT_FREE_SPACE
#define BTRFS_SUBVOL_READONLY
#define BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE_VALID
#define BTRFS_INCOMPAT_FLAGS_DEFAULT_SUBVOL
#define BTRFS_INCOMPAT_FLAGS_MIXED_GROUPS
#define BLOCK_FLAG_RAID1C4
#define BTRFS_INCOMPAT_FLAGS_METADATA_UUID
#define HEADER_FLAG_MIXED_BACKREF
#define TYPE_BLOCK_GROUP_ITEM
#define BTRFS_SUPERBLOCK_FLAGS_SEEDING
#define BTRFS_INCOMPAT_FLAGS_MIXED_BACKREF
#define TYPE_ROOT_BACKREF
#define BTRFS_ROOT_DEVTREE
#define BLOCK_FLAG_RAID1C3
#define BTRFS_ROOT_FSTREE
#define BTRFS_ROOT_EXTENT
#define BTRFS_ROOT_CHECKSUM
_In_ PIO_STACK_LOCATION IrpSp
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define PsGetCurrentThread()
NTSTATUS ExInitializeResourceLite(PULONG res)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define RtlCompareMemory(s1, s2, l)
#define KeInitializeEvent(pEvt, foo, foo2)
#define ExConvertExclusiveToSharedLite(res)
#define KeSetEvent(pEvt, foo, foo2)
#define KeQuerySystemTime(t)
#define ExAcquireResourceExclusiveLite(res, wait)
#define DO_SYSTEM_BOOT_PARTITION
#define ExDeleteResourceLite(res)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define ExAcquireResourceSharedLite(res, wait)
#define KeInitializeSpinLock(sl)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
VOID NTAPI FsRtlUninitializeFileLock(IN PFILE_LOCK FileLock)
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
@ FilePositionInformation
#define FILE_NAMED_STREAMS
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES
#define FILE_SUPPORTS_SPARSE_FILES
#define FILE_SUPPORTS_REPARSE_POINTS
#define FILE_READ_ONLY_VOLUME
struct _FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION
#define FILE_SUPPORTS_HARD_LINKS
@ FileFsControlInformation
@ FileFsDeviceInformation
@ FileFsAttributeInformation
@ FileFsVolumeInformation
#define FILE_SUPPORTS_OBJECT_IDS
#define FILE_WRITE_THROUGH
#define FILE_SYNCHRONOUS_IO_ALERT
struct _FILE_FS_SIZE_INFORMATION FILE_FS_SIZE_INFORMATION
#define FILE_PERSISTENT_ACLS
#define FILE_CASE_SENSITIVE_SEARCH
struct _FILE_FS_FULL_SIZE_INFORMATION FILE_FS_FULL_SIZE_INFORMATION
#define FILE_CASE_PRESERVED_NAMES
#define FILE_SUPPORTS_OPEN_BY_FILE_ID
#define FILE_UNICODE_ON_DISK
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum const GLvoid * addr
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 i
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 GLenum GLenum dfactor
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
@ ProcessBasicInformation
@ ProcessWow64Information
#define EXCEPTION_EXECUTE_HANDLER
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
__INTRIN_INLINE void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue)
__INTRIN_INLINE unsigned long __readcr4(void)
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
int const JOCTET unsigned int datalen
static DRIVER_UNLOAD DriverUnload
VOID NTAPI ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
VOID NTAPI ExDeletePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside)
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
#define IOCTL_DISK_GET_LENGTH_INFO
#define MOUNTMGR_DEVICE_NAME
#define IOCTL_STORAGE_GET_HOTPLUG_INFO
#define sprintf(buf, format,...)
static PIO_STATUS_BLOCK iosb
#define InitializeObjectAttributes(p, n, a, r, s)
static ACCESS_MASK const OBJECT_ATTRIBUTES ULONG const UNICODE_STRING ULONG PULONG dispos
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI ZwQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define _In_reads_bytes_(s)
#define _Out_writes_bytes_opt_(s)
#define _Function_class_(n)
#define _Out_writes_bytes_(s)
#define _In_reads_bytes_opt_(s)
#define FILE_ATTRIBUTE_READONLY
#define FILE_READ_ATTRIBUTES
#define FILE_ATTRIBUTE_HIDDEN
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
#define REG_OPTION_NON_VOLATILE
struct _FILE_FS_DEVICE_INFORMATION FILE_FS_DEVICE_INFORMATION
#define FILE_READ_ONLY_DEVICE
#define KEY_ENUMERATE_SUB_KEYS
#define FILE_ATTRIBUTE_ARCHIVE
#define FILE_ATTRIBUTE_DIRECTORY
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define FILE_REMOVABLE_MEDIA
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IOCTL_STORAGE_QUERY_PROPERTY
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
#define IOCTL_STORAGE_CHECK_VERIFY
@ StorageDeviceTrimProperty
#define FSRTL_VOLUME_UNLOCK
#define FILE_ATTRIBUTE_REPARSE_POINT
#define FSRTL_VOLUME_MOUNT
#define FileFsFullSizeInformation
#define FileFsObjectIdInformation
#define IoSkipCurrentIrpStackLocation(Irp)
#define IO_ERR_INTERNAL_ERROR
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
VOID NTAPI FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext)
VOID NTAPI FsRtlNotifyInitializeSync(IN PNOTIFY_SYNC *NotifySync)
VOID NTAPI FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PSTRING FullTargetName, IN USHORT TargetNameOffset, IN PSTRING StreamName OPTIONAL, IN PSTRING NormalizedParentName OPTIONAL, IN ULONG FilterMatch, IN ULONG Action, IN PVOID TargetContext, IN PVOID FilterContext)
NTSTATUS NTAPI FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, IN ULONG EventCode)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
BOOLEAN NTAPI IoRaiseInformationalHardError(IN NTSTATUS ErrorStatus, IN PUNICODE_STRING String, IN PKTHREAD Thread)
VOID NTAPI IoRemoveShareAccess(IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess)
PFILE_OBJECT NTAPI IoCreateStreamFileObject(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
PIRP NTAPI IoGetTopLevelIrp(VOID)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
VOID NTAPI IoFreeIrp(IN PIRP Irp)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
NTSTATUS NTAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
KAFFINITY NTAPI KeQueryActiveProcessors(VOID)
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
#define STATUS_INTERNAL_ERROR
#define STATUS_SOME_NOT_MAPPED
NTSTRSAFEAPI RtlStringCbVPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat, _In_ va_list argList)
VOID NTAPI FsRtlUninitializeOplock(IN POPLOCK Oplock)
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
DRIVER_ADD_DEVICE AddDevice
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
NTSTATUS NTAPI IoRegisterPlugPlayNotification(_In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, _In_ ULONG EventCategoryFlags, _In_opt_ PVOID EventCategoryData, _In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, _Inout_opt_ PVOID Context, _Out_ PVOID *NotificationEntry)
NTSTATUS NTAPI IoUnregisterPlugPlayNotification(_In_ PVOID NotificationEntry)
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define FILE_DEVICE_DISK_FILE_SYSTEM
#define FILE_DEVICE_UNKNOWN
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
#define IRP_MJ_DIRECTORY_CONTROL
#define IRP_MJ_DEVICE_CONTROL
#define IRP_MJ_QUERY_VOLUME_INFORMATION
#define IRP_MJ_LOCK_CONTROL
#define IRP_MJ_SET_INFORMATION
#define IRP_MJ_QUERY_INFORMATION
#define offsetof(TYPE, MEMBER)
#define IOCTL_ATA_PASS_THROUGH
struct _ATA_PASS_THROUGH_EX ATA_PASS_THROUGH_EX
#define SUBVOL_ROOT_INODE
#define FileStandardInformation
#define STATUS_DEVICE_NOT_READY
#define STATUS_MORE_PROCESSING_REQUIRED
#define BTRFS_TYPE_DIRECTORY
#define BLOCK_FLAG_DUPLICATE
#define BLOCK_FLAG_SYSTEM
#define BTRFS_TYPE_SYMLINK
#define BLOCK_FLAG_RAID10
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
#define BLOCK_FLAG_METADATA
ULONG_PTR DataBufferOffset
LARGE_INTEGER ValidDataLength
LARGE_INTEGER AllocationSize
PDRIVER_UNLOAD DriverUnload
struct _IDENTIFY_DEVICE_DATA::@1905 CommandSetSupport
struct _IO_STACK_LOCATION::@3983::@3987 Read
struct _IO_STACK_LOCATION::@3983::@3998 FileSystemControl
struct _IO_STACK_LOCATION::@3983::@3996 QueryVolume
struct _IO_STACK_LOCATION::@3983::@4003 MountVolume
struct _IO_STACK_LOCATION::@3983::@3997 SetVolume
struct _IO_STACK_LOCATION::@3983::@4019 Power
struct _IO_STACK_LOCATION::@3983::@3988 Write
union _IO_STACK_LOCATION::@1584 Parameters
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
ULONG dwOSVersionInfoSize
LIST_ENTRY InMemoryOrderModuleList
STORAGE_QUERY_TYPE QueryType
UCHAR AdditionalParameters[1]
STORAGE_PROPERTY_ID PropertyId
struct _DEVICE_OBJECT * DeviceObject
struct _DEVICE_OBJECT * RealDevice
UNICODE_STRING query_string
LIST_ENTRY list_entry_all
LIST_ENTRY dir_children_index
struct _file_ref * fileref
LIST_ENTRY ** hash_ptrs_uc
struct _device_extension * Vcb
ANSI_STRING reparse_xattr
LIST_ENTRY list_entry_dirty
struct _fcb_nonpaged * nonpaged
SHARE_ACCESS share_access
FSRTL_ADVANCED_FCB_HEADER Header
struct _file_ref * parent
struct pdo_device_extension * pdode
PDEVICE_OBJECT attached_device
PDEVICE_OBJECT mounted_device
PDEVICE_OBJECT attached_device
struct _file_ref * fileref
volume_device_extension * vde
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define ATA_FLAGS_DATA_IN
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_MEDIA_WRITE_PROTECTED
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNRECOGNIZED_VOLUME
#define STATUS_WRONG_VOLUME
#define STATUS_INVALID_VOLUME_LABEL
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
static GLenum _GLUfuncptr fn
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_Inout_ PERBANDINFO * pbi
void int int ULONGLONG int va_list * ap
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
#define ExIsResourceAcquiredExclusive
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IoIsErrorUserInduced(Status)
#define SL_OVERRIDE_VERIFY_VOLUME
#define IRP_DEALLOCATE_BUFFER
#define IRP_INPUT_OPERATION
#define FILE_ACTION_MODIFIED
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SET_VOLUME_INFORMATION
#define IRP_MN_VERIFY_VOLUME
#define FILE_ACTION_REMOVED
struct _FILE_FS_OBJECTID_INFORMATION FILE_FS_OBJECTID_INFORMATION
#define IRP_MJ_QUERY_SECURITY
#define FILE_NOTIFY_CHANGE_FILE_NAME
#define FO_CLEANUP_COMPLETE
#define IRP_MN_USER_FS_REQUEST
#define IRP_MJ_SYSTEM_CONTROL
@ EventCategoryDeviceInterfaceChange
#define IRP_MJ_FLUSH_BUFFERS
#define VPB_DIRECT_WRITES_ALLOWED
#define IO_DISK_INCREMENT
#define IRP_MN_KERNEL_CALL
#define FO_CACHE_SUPPORTED
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define IRP_MN_MOUNT_VOLUME
#define IRP_MJ_SET_SECURITY
_In_ SYSTEM_POWER_STATE SystemPowerState
#define FILE_NOTIFY_CHANGE_DIR_NAME
#define IRP_MN_QUERY_POWER
#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
#define ObDereferenceObject
#define ObReferenceObject
#define PsGetCurrentProcess
struct _OSVERSIONINFOW RTL_OSVERSIONINFOW
XXH_PUBLIC_API unsigned long long XXH64(const void *input, size_t len, unsigned long long seed)