26 #ifndef FSCTL_CSV_CONTROL 27 #define FSCTL_CSV_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, FILE_ANY_ACCESS) 30 #ifndef FSCTL_QUERY_VOLUME_CONTAINER_STATE 31 #define FSCTL_QUERY_VOLUME_CONTAINER_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 228, METHOD_BUFFERED, FILE_ANY_ACCESS) 36 #define SEF_AVOID_PRIVILEGE_CHECK 0x08 // on MSDN but not in any header files(?) 38 #ifndef _MSC_VER // not in mingw yet 39 #define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000 42 #define SEF_SACL_AUTO_INHERIT 0x02 82 for (
i = 0;
i < 16;
i+=2) {
101 ERR(
"out of memory\n");
108 Status =
read_data(
Vcb,
addr,
Vcb->superblock.node_size,
NULL,
true,
buf,
NULL,
NULL,
Irp, 0,
false,
NormalPagePriority);
110 ERR(
"read_data returned %08lx\n",
Status);
118 t.header.level = th->
level;
119 t.header.tree_id =
t.root->id;
123 ERR(
"get_tree_new_address returned %08lx\n",
Status);
127 if (!
t.has_new_address) {
128 ERR(
"tree new address not set\n");
136 c->used +=
Vcb->superblock.node_size;
138 ERR(
"could not find chunk for address %I64x\n",
t.new_address);
148 if (th->
level == 0) {
163 ERR(
"increase_extent_refcount_data returned %08lx\n",
Status);
181 ERR(
"increase_extent_refcount returned %08lx\n",
Status);
195 ERR(
"write_data returned %08lx\n",
Status);
200 bool need_wait =
false;
236 *newaddr =
t.new_address;
252 while (le != &subvol->
fcbs) {
280 ERR(
"error - ccb was NULL\n");
285 WARN(
"insufficient privileges\n");
308 ERR(
"do_write returned %08lx\n",
Status);
320 ERR(
"create_root returned %08lx\n",
Status);
324 r->lastinode =
subvol->lastinode;
326 if (!
Vcb->uuid_root) {
329 TRACE(
"uuid root doesn't exist, creating it\n");
334 ERR(
"create_root returned %08lx\n",
Status);
338 Vcb->uuid_root = uuid_root;
343 ERR(
"out of memory\n");
364 ERR(
"insert_tree_item returned %08lx\n",
Status);
371 searchkey.
offset = 0xffffffffffffffff;
375 ERR(
"error - find_item returned %08lx\n",
Status);
381 ERR(
"snapshot_tree_copy returned %08lx\n",
Status);
388 r->root_item.inode.generation = 1;
389 r->root_item.inode.st_size = 3;
390 r->root_item.inode.st_blocks =
subvol->root_item.inode.st_blocks;
391 r->root_item.inode.st_nlink = 1;
393 r->root_item.inode.flags = 0xffffffff80000000;
394 r->root_item.generation =
Vcb->superblock.generation;
395 r->root_item.objid =
subvol->root_item.objid;
396 r->root_item.block_number =
address;
397 r->root_item.bytes_used =
subvol->root_item.bytes_used;
398 r->root_item.last_snapshot_generation =
Vcb->superblock.generation;
399 r->root_item.root_level =
subvol->root_item.root_level;
400 r->root_item.generation2 =
Vcb->superblock.generation;
401 r->root_item.parent_uuid =
subvol->root_item.uuid;
402 r->root_item.ctransid =
subvol->root_item.ctransid;
403 r->root_item.otransid =
Vcb->superblock.generation;
404 r->root_item.ctime =
subvol->root_item.ctime;
405 r->root_item.otime =
now;
415 ERR(
"error - could not find ROOT_ITEM for subvol %I64x\n",
r->id);
424 subvol->root_item.last_snapshot_generation =
Vcb->superblock.generation;
432 ERR(
"out of memory\n");
439 ERR(
"open_fcb returned %08lx\n",
Status);
448 WARN(
"add_dir_child returned %08lx\n",
Status);
485 fcb->
subvol->root_item.ctransid =
Vcb->superblock.generation;
491 while (le != &
subvol->fcbs) {
495 while (le2 != &fcb2->
extents) {
512 ERR(
"do_write returned %08lx\n",
Status);
529 bool readonly, posix;
538 if (IoIs32bitProcess(
Irp)) {
547 subvolh = Handle32ToHandle(bcs32->
subvol);
553 posix = bcs32->
posix;
588 ERR(
"fileref was NULL\n");
593 WARN(
"insufficient privileges\n");
610 ERR(
"utf16_to_utf8 failed with error %08lx\n",
Status);
615 ERR(
"utf16_to_utf8 returned a length of 0\n");
620 ERR(
"len was too long\n");
628 ERR(
"out of memory\n");
634 ERR(
"utf16_to_utf8 failed with error %08lx\n",
Status);
645 WARN(
"file already exists\n");
652 ERR(
"open_fileref returned %08lx\n",
Status);
658 ERR(
"ObReferenceObjectByHandle returned %08lx\n",
Status);
662 if (subvol_obj->DeviceObject !=
FileObject->DeviceObject) {
667 subvol_fcb = subvol_obj->FsContext;
673 if (subvol_fcb->
inode != subvol_fcb->
subvol->root_item.objid) {
674 WARN(
"handle inode was %I64x, expected %I64x\n", subvol_fcb->
inode, subvol_fcb->
subvol->root_item.objid);
679 ccb = subvol_obj->FsContext2;
687 WARN(
"insufficient privileges\n");
692 if (
fcb ==
Vcb->dummy_fcb) {
701 while (le != &subvol_fcb->
subvol->fcbs) {
707 while (le2 != &openfcb->
extents) {
727 ERR(
"open_fileref returned %08lx\n",
Status);
773 ERR(
"error - fcb was NULL\n");
779 ERR(
"error - ccb was NULL\n");
786 ERR(
"parent FCB was not a directory\n");
791 ERR(
"fileref was NULL\n");
796 ERR(
"parent has been deleted\n");
801 WARN(
"insufficient privileges\n");
811 if (
fcb ==
Vcb->dummy_fcb)
832 ERR(
"utf16_to_utf8 failed with error %08lx\n",
Status);
837 ERR(
"utf16_to_utf8 returned a length of 0\n");
842 ERR(
"len was too long\n");
850 ERR(
"out of memory\n");
856 ERR(
"utf16_to_utf8 failed with error %08lx\n",
Status);
870 WARN(
"file already exists\n");
877 ERR(
"open_fileref returned %08lx\n",
Status);
885 ERR(
"create_root returned %08lx\n",
Status);
889 TRACE(
"created root %I64x\n",
id);
891 if (!
Vcb->uuid_root) {
894 TRACE(
"uuid root doesn't exist, creating it\n");
899 ERR(
"create_root returned %08lx\n",
Status);
903 Vcb->uuid_root = uuid_root;
908 ERR(
"out of memory\n");
929 ERR(
"insert_tree_item returned %08lx\n",
Status);
934 r->root_item.inode.generation = 1;
935 r->root_item.inode.st_size = 3;
936 r->root_item.inode.st_blocks =
Vcb->superblock.node_size;
937 r->root_item.inode.st_nlink = 1;
939 r->root_item.inode.flags = 0xffffffff80000000;
945 r->root_item.bytes_used =
Vcb->superblock.node_size;
946 r->root_item.ctransid =
Vcb->superblock.generation;
947 r->root_item.otransid =
Vcb->superblock.generation;
948 r->root_item.ctime =
now;
949 r->root_item.otime =
now;
955 ERR(
"out of memory\n");
983 ERR(
"SeAssignSecurity returned %08lx\n",
Status);
988 ERR(
"SeAssignSecurity returned NULL security descriptor\n");
995 ERR(
"RtlGetOwnerSecurityDescriptor returned %08lx\n",
Status);
1007 acquire_fcb_lock_exclusive(
Vcb);
1011 release_fcb_lock(
Vcb);
1014 rootfcb->
Header.AllocationSize.QuadPart = 0;
1015 rootfcb->
Header.FileSize.QuadPart = 0;
1016 rootfcb->
Header.ValidDataLength.QuadPart = 0;
1026 r->lastinode = rootfcb->
inode;
1033 ERR(
"out of memory\n");
1044 ERR(
"insert_tree_item returned %08lx\n",
Status);
1053 ERR(
"out of memory\n");
1069 WARN(
"add_dir_child returned %08lx\n",
Status);
1076 ERR(
"out of memory\n");
1086 ERR(
"out of memory\n");
1108 fcb->
subvol->root_item.ctransid =
Vcb->superblock.generation;
1135 }
else if (rootfcb) {
1183 WARN(
"insufficient privileges\n");
1222 bool extents_inline =
false;
1229 if (!old_style &&
ext->offset > last_end)
1234 last_end =
ext->offset +
ext->extent_data.decoded_size;
1235 extents_inline =
true;
1241 switch (
ext->extent_data.compression) {
1344 WARN(
"insufficient privileges\n");
1349 WARN(
"insufficient privileges\n");
1360 WARN(
"trying to change inode on readonly subvolume\n");
1369 WARN(
"trying to change nocow flag on non-empty file\n");
1445 le =
Vcb->devices.Flink;
1446 while (le != &
Vcb->devices) {
1469 dev->missing =
false;
1472 dev->missing =
true;
1475 dev->next_entry = 0;
1477 dev->readonly = (
Vcb->readonly || dev2->
readonly) ?
true :
false;
1515 if (!
Vcb->chunk_usage_found) {
1518 if (!
Vcb->chunk_usage_found)
1526 ERR(
"find_chunk_usage returned %08lx\n",
Status);
1535 le =
Vcb->chunks.Flink;
1536 while (le != &
Vcb->chunks) {
1537 bool addnew =
false;
1549 if (bue->
type ==
c->chunk_item->type) {
1582 bue->
type =
c->chunk_item->type;
1588 factor =
c->chunk_item->num_stripes;
1590 factor =
c->chunk_item->num_stripes /
c->chunk_item->sub_stripes;
1592 factor =
c->chunk_item->num_stripes - 1;
1594 factor =
c->chunk_item->num_stripes - 2;
1599 while (le2 != &
Vcb->chunks) {
1660 bool verify =
false;
1665 le =
Vcb->devices.Flink;
1666 while (le != &
Vcb->devices) {
1669 if (
dev->devobj &&
dev->removable) {
1681 dev->change_count =
cc;
1702 WARN(
"STUB: FSCTL_FILESYSTEM_GET_STATISTICS\n");
1722 FILE_SET_SPARSE_BUFFER* fssb =
data;
1729 if (
data &&
length <
sizeof(FILE_SET_SPARSE_BUFFER))
1733 ERR(
"FileObject was NULL\n");
1740 ERR(
"FCB was NULL\n");
1745 ERR(
"CCB was NULL\n");
1750 WARN(
"insufficient privileges\n");
1755 ERR(
"no fileref\n");
1768 WARN(
"FileObject did not point to a file\n");
1774 set = fssb->SetSparse;
1834 ERR(
"out of memory\n");
1844 ERR(
"read_file returned %08lx\n",
Status);
1858 ERR(
"excise_extents returned %08lx\n",
Status);
1874 ERR(
"add_extent_to_fcb returned %08lx\n",
Status);
1888 ERR(
"write_compressed returned %08lx\n",
Status);
1897 ERR(
"do_write_file returned %08lx\n",
Status);
1906 FILE_ZERO_DATA_INFORMATION* fzdi =
data;
1918 if (!
data ||
length <
sizeof(FILE_ZERO_DATA_INFORMATION))
1922 ERR(
"FileObject was NULL\n");
1926 if (fzdi->BeyondFinalZero.QuadPart <= fzdi->FileOffset.QuadPart) {
1927 WARN(
"BeyondFinalZero was less than or equal to FileOffset (%I64x <= %I64x)\n", fzdi->BeyondFinalZero.QuadPart, fzdi->FileOffset.QuadPart);
1934 ERR(
"FCB was NULL\n");
1941 ERR(
"ccb was NULL\n");
1946 WARN(
"insufficient privileges\n");
1953 ERR(
"fileref was NULL\n");
1965 WARN(
"FileObject did not point to a file\n");
1971 ERR(
"FileObject is stream\n");
1986 if (!
ext2->ignore) {
2002 ERR(
"zero_data returned %08lx\n",
Status);
2011 end = (fzdi->BeyondFinalZero.QuadPart /
Vcb->superblock.sector_size) *
Vcb->superblock.sector_size;
2016 ERR(
"zero_data returned %08lx\n",
Status);
2023 ERR(
"zero_data returned %08lx\n",
Status);
2028 if (
end < (
uint64_t)fzdi->BeyondFinalZero.QuadPart) {
2031 ERR(
"zero_data returned %08lx\n",
Status);
2039 ERR(
"excise_extents returned %08lx\n",
Status);
2066 fcb->
subvol->root_item.ctransid =
Vcb->superblock.generation;
2087 FILE_ALLOCATED_RANGE_BUFFER* ranges = outbuf;
2091 TRACE(
"FSCTL_QUERY_ALLOCATED_RANGES\n");
2094 ERR(
"FileObject was NULL\n");
2098 if (!
inbuf || inbuflen <
sizeof(FILE_ALLOCATED_RANGE_BUFFER) || !outbuf)
2104 ERR(
"FCB was NULL\n");
2115 else if (outbuflen <
sizeof(FILE_ALLOCATED_RANGE_BUFFER))
2118 ranges[
i].FileOffset.QuadPart = 0;
2140 if (
ext->offset > last_end) {
2141 if (last_end > last_start) {
2142 if ((
i + 1) *
sizeof(FILE_ALLOCATED_RANGE_BUFFER) <= outbuflen) {
2143 ranges[
i].FileOffset.QuadPart = last_start;
2152 last_start =
ext->offset;
2155 last_end =
ext->offset +
len;
2161 if (last_end > last_start) {
2162 if ((
i + 1) *
sizeof(FILE_ALLOCATED_RANGE_BUFFER) <= outbuflen) {
2163 ranges[
i].FileOffset.QuadPart = last_start;
2175 *retlen =
i *
sizeof(FILE_ALLOCATED_RANGE_BUFFER);
2188 ERR(
"FileObject was NULL\n");
2192 if (!
buf || buflen <
sizeof(FILE_OBJECTID_BUFFER))
2198 ERR(
"FCB was NULL\n");
2211 *retlen =
sizeof(FILE_OBJECTID_BUFFER);
2219 le =
Vcb->all_fcbs.Flink;
2220 while (le != &
Vcb->all_fcbs) {
2235 bool lock_paused_balance =
false;
2237 TRACE(
"FSCTL_LOCK_VOLUME\n");
2239 if (
Vcb->scrub.thread) {
2240 WARN(
"cannot lock while scrub running\n");
2244 if (
Vcb->balance.thread) {
2245 WARN(
"cannot lock while balance running\n");
2249 TRACE(
"locking volume\n");
2271 lock_paused_balance =
true;
2278 if (
Vcb->need_write && !
Vcb->readonly)
2288 ERR(
"do_write returned %08lx\n",
Status);
2298 Vcb->lock_paused_balance = lock_paused_balance;
2303 if (lock_paused_balance)
2325 Vcb->locked =
false;
2331 if (
Vcb->lock_paused_balance)
2338 TRACE(
"FSCTL_UNLOCK_VOLUME\n");
2343 TRACE(
"unlocking volume\n");
2361 TRACE(
"FSCTL_INVALIDATE_VOLUMES\n");
2367 if (IoIs32bitProcess(
Irp)) {
2385 ERR(
"ObReferenceObjectByHandle returned %08lx\n",
Status);
2389 devobj = fileobj->DeviceObject;
2398 if (
Vcb->Vpb &&
Vcb->Vpb->RealDevice == devobj) {
2399 if (
Vcb->Vpb == devobj->Vpb) {
2402 bool free_newvpb =
false;
2406 ERR(
"out of memory\n");
2417 Vcb->removing =
true;
2427 if (
Vcb->need_write && !
Vcb->readonly)
2435 ERR(
"do_write returned %08lx\n",
Status);
2454 devobj->Vpb = newvpb;
2463 if (
Vcb->open_files == 0)
2489 if (
Irp->AssociatedIrp.SystemBuffer) {
2490 volstate =
Irp->AssociatedIrp.SystemBuffer;
2491 }
else if (
Irp->MdlAddress !=
NULL) {
2507 Irp->IoStatus.Information =
sizeof(
ULONG);
2516 TRACE(
"FSCTL_GET_COMPRESSION\n");
2518 if (
Irp->AssociatedIrp.SystemBuffer) {
2520 }
else if (
Irp->MdlAddress !=
NULL) {
2533 Irp->IoStatus.Information =
sizeof(
USHORT);
2542 TRACE(
"FSCTL_SET_COMPRESSION\n");
2582 TRACE(
"FSCTL_DISMOUNT_VOLUME\n");
2588 if (
Vcb->disallow_dismount ||
Vcb->page_file_count != 0) {
2589 WARN(
"attempting to dismount boot volume or one containing a pagefile\n");
2595 WARN(
"FsRtlNotifyVolumeEvent returned %08lx\n",
Status);
2604 if (
Vcb->need_write && !
Vcb->readonly) {
2608 ERR(
"do_write returned %08lx\n",
Status);
2614 Vcb->removing =
true;
2616 open_files =
Vcb->open_files > 0;
2620 Vcb->vde->mounted_device =
NULL;
2642 ERR(
"out of memory\n");
2648 ERR(
"sync_read_phys returned %08lx\n",
Status);
2654 TRACE(
"device is not Btrfs\n");
2660 TRACE(
"device has Btrfs magic, but invalid superblock checksum\n");
2682 if (
Vcb->superblock.num_devices > 1) {
2683 le2 =
Vcb->devices.Flink;
2684 while (le2 != &
Vcb->devices) {
2726 WARN(
"IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES returned %08lx\n",
Status);
2749 const GUID* pnp_guid;
2758 WARN(
"not allowing second device to be added to non-PNP device\n");
2766 if (IoIs32bitProcess(
Irp)) {
2784 ERR(
"ObReferenceObjectByHandle returned %08lx\n",
Status);
2792 ERR(
"get_device_pnp_name returned %08lx\n",
Status);
2803 ERR(
"IOCTL_DISK_IS_WRITABLE returned %08lx\n",
Status);
2810 ERR(
"is_device_part_of_mounted_btrfs_raid returned %08lx\n",
Status);
2818 DRIVE_LAYOUT_INFORMATION_EX* dli =
NULL;
2830 ERR(
"out of memory\n");
2840 ERR(
"not adding disk which has partitions\n");
2852 WARN(
"device was not disk\n");
2862 &gli,
sizeof(gli),
true,
NULL);
2864 ERR(
"error reading length information: %08lx\n",
Status);
2871 if (
size < 0x100000) {
2872 ERR(
"device was not large enough to hold FS (%I64x bytes, need at least 1 MB)\n",
size);
2881 if (
Vcb->need_write)
2889 ERR(
"do_write returned %08lx\n",
Status);
2895 ERR(
"out of memory\n");
2903 dev->fileobj = fileobj;
2904 dev->seeding =
false;
2909 if (
size > 0x100000) {
2912 ERR(
"add_space_entry returned %08lx\n",
Status);
2919 le =
Vcb->devices.Flink;
2920 while (le != &
Vcb->devices) {
2932 dev->devitem.num_bytes =
size;
2933 dev->devitem.bytes_used = 0;
2934 dev->devitem.optimal_io_align =
Vcb->superblock.sector_size;
2935 dev->devitem.optimal_io_width =
Vcb->superblock.sector_size;
2936 dev->devitem.minimal_io_size =
Vcb->superblock.sector_size;
2937 dev->devitem.type = 0;
2938 dev->devitem.generation = 0;
2939 dev->devitem.start_offset = 0;
2940 dev->devitem.dev_group = 0;
2941 dev->devitem.seek_speed = 0;
2942 dev->devitem.bandwidth = 0;
2944 dev->devitem.fs_uuid =
Vcb->superblock.uuid;
2948 ERR(
"out of memory\n");
2956 ERR(
"insert_tree_item returned %08lx\n",
Status);
2964 ERR(
"out of memory\n");
2977 ERR(
"error - find_item returned %08lx\n",
Status);
2985 ERR(
"delete_tree_item returned %08lx\n",
Status);
2993 ERR(
"insert_tree_item returned %08lx\n",
Status);
2998 if (
dev->trim && !
dev->readonly && !
Vcb->options.no_trim)
3004 ERR(
"out of memory\n");
3013 ERR(
"write_data_phys returned %08lx\n",
Status);
3025 ERR(
"out of memory\n");
3030 vc->
uuid =
dev->devitem.device_uuid;
3041 WARN(
"IoRegisterPlugPlayNotification returned %08lx\n",
Status);
3054 if (pnp_name2.
Length == 0)
3059 ERR(
"out of memory\n");
3082 ERR(
"IoGetDeviceObjectPointer returned %08lx\n",
Status);
3086 WARN(
"remove_drive_letter returned %08lx\n",
Status);
3093 Vcb->superblock.num_devices++;
3094 Vcb->superblock.total_bytes +=
size;
3095 Vcb->devices_loaded++;
3104 ERR(
"do_write returned %08lx\n",
Status);
3129 TRACE(
"FSCTL_ALLOW_EXTENDED_DASD_IO\n");
3140 if (
fcb !=
Vcb->volume_fcb)
3178 le =
Vcb->devices.Flink;
3180 while (le != &
Vcb->devices) {
3185 dev->stats_changed =
true;
3186 Vcb->stats_changed =
true;
3187 Vcb->need_write =
true;
3195 WARN(
"device %I64x not found\n", devid);
3207 TRACE(
"FSCTL_GET_INTEGRITY_INFORMATION\n");
3227 TRACE(
"FSCTL_SET_INTEGRITY_INFORMATION\n");
3284 WARN(
"insufficient privileges\n");
3293 ERR(
"ObReferenceObjectByHandle returned %08lx\n",
Status);
3297 if (sourcefo->DeviceObject !=
FileObject->DeviceObject) {
3298 WARN(
"source and destination are on different volumes\n");
3303 sourcefcb = sourcefo->FsContext;
3304 sourceccb = sourcefo->FsContext2;
3306 if (!sourcefcb || !sourceccb || sourcefcb ==
Vcb->volume_fcb) {
3311 if (!sourcefcb->ads && !
fcb->
ads) {
3324 WARN(
"insufficient privileges\n");
3334 sourcelen = sourcefcb->ads ? sourcefcb->adsdata.Length : sourcefcb->inode_item.st_size;
3341 if (
fcb == sourcefcb &&
3344 WARN(
"source and destination are the same, and the ranges overlap\n");
3362 if (
fcb != sourcefcb)
3379 ULONG bytes_read, dataoff, datalen2;
3394 ERR(
"out of memory\n");
3406 ERR(
"read_file returned %08lx\n",
Status);
3412 if (sourcefcb->ads) {
3415 ERR(
"read_stream returned %08lx\n",
Status);
3422 ERR(
"read_file returned %08lx\n",
Status);
3428 if (dataoff + bytes_read < datalen2)
3433 else if (make_inline) {
3439 ERR(
"excise_extents returned %08lx\n",
Status);
3448 ERR(
"out of memory\n");
3465 ERR(
"add_extent_to_fcb returned %08lx\n",
Status);
3476 ERR(
"do_write_file returned %08lx\n",
Status);
3486 le = sourcefcb->extents.
Flink;
3487 while (le != &sourcefcb->extents) {
3509 ERR(
"out of memory\n");
3520 ext2->unique =
false;
3521 ext2->ignore =
false;
3522 ext2->inserted =
true;
3524 ext2->extent_data.generation =
Vcb->superblock.generation;
3525 ext2->extent_data.decoded_size =
ext->extent_data.decoded_size;
3526 ext2->extent_data.compression =
ext->extent_data.compression;
3527 ext2->extent_data.encryption =
ext->extent_data.encryption;
3528 ext2->extent_data.encoding =
ext->extent_data.encoding;
3529 ext2->extent_data.type =
ext->extent_data.type;
3548 ERR(
"out of memory\n");
3559 ERR(
"out of memory\n");
3574 ERR(
"get_chunk_from_address(%I64x) failed\n", ed2s->
address);
3582 ERR(
"update_changed_extent_ref returned %08lx\n",
Status);
3595 ERR(
"excise_extents returned %08lx\n",
Status);
3606 le = sourcefcb->extents.
Flink;
3607 while (le != &sourcefcb->extents) {
3614 le2 = newexts.
Flink;
3615 while (le2 != &newexts) {
3622 ext->unique =
false;
3639 lastextle = &
ext->list_entry;
3672 if (
FileObject->SectionObjectPointer->DataSectionObject)
3685 if (
fcb != sourcefcb)
3725 WARN(
"trying to create file in something other than a directory\n");
3751 WARN(
"insufficient privileges\n");
3755 if (bmn->
inode != 0) {
3761 if (bmn->
name[
i] == 0 || bmn->
name[
i] ==
'/')
3771 ERR(
"utf16_to_utf8 returned %08lx\n",
Status);
3776 ERR(
"utf16_to_utf8 returned a length of 0\n");
3781 ERR(
"len was too long (%lx)\n",
len);
3789 ERR(
"out of memory\n");
3795 ERR(
"utf16_to_utf8 failed with error %08lx\n",
Status);
3805 ERR(
"find_file_in_dir returned %08lx\n",
Status);
3810 WARN(
"filename already exists\n");
3820 ERR(
"out of memory\n");
3884 fcb->
Header.AllocationSize.QuadPart = 0;
3886 fcb->
Header.ValidDataLength.QuadPart = 0;
3890 if (bmn->
name[0] ==
'.')
3907 ERR(
"SeAssignSecurityEx returned %08lx\n",
Status);
3914 WARN(
"RtlGetOwnerSecurityDescriptor returned %08lx\n",
Status);
3924 acquire_fcb_lock_exclusive(
Vcb);
3926 if (bmn->
inode == 0) {
3928 lastle = parfcb->
subvol->fcbs.Blink;
3932 lastle = parfcb->
subvol->fcbs.Blink;
3936 lastle = parfcb->
subvol->fcbs.Blink;;
3937 while (le != &parfcb->
subvol->fcbs) {
3941 release_fcb_lock(
Vcb);
3944 WARN(
"inode collision\n");
3964 release_fcb_lock(
Vcb);
3967 ERR(
"out of memory\n");
3978 fcb->
subvol->root_item.ctransid =
Vcb->superblock.generation;
3988 WARN(
"add_dir_child returned %08lx\n",
Status);