110#define MAX_SEND_WRITE 0xc000
111#define SEND_BUFFER_LENGTH 0x100000
155 *tmp = (
num % 10) +
'0';
161 return &
buf[tmp2 +
sizeof(tmp2) - tmp];
191 ERR(
"find_item returned %08lx\n",
Status);
201 ERR(
"find_item returned %08lx\n",
Status);
221 while (le != &
context->orphans) {
247 ERR(
"find_item returned %08lx\n",
Status);
265 WARN(
"symlink data was not inline, returning blank string\n");
297 context->lastinode.deleting =
true;
316 context->lastinode.deleting =
false;
326 context->lastinode.file =
false;
350 context->lastinode.file =
true;
352 context->lastinode.new =
false;
355 while (le != &
context->orphans) {
374 ERR(
"find_send_dir returned %08lx\n",
Status);
395 while (le != &
context->orphans) {
424 context->lastinode.file =
true;
431 ERR(
"get_orphan_name returned %08lx\n",
Status);
449 ERR(
"send_read_symlink returned %08lx\n",
Status);
461 ERR(
"find_send_dir returned %08lx\n",
Status);
473 ERR(
"out of memory\n");
484 if (!
context->lastinode.path) {
485 ERR(
"out of memory\n");
502 ERR(
"out of memory\n");
519 ERR(
"out of memory\n");
619 if (
context->lastinode.o->sd) {
620 if (
context->lastinode.o->sd->name)
624 if (!
context->lastinode.o->sd->name) {
625 ERR(
"out of memory\n");
639 if (!
context->lastinode.path) {
640 ERR(
"out of memory\n");
645 context->lastinode.path[pathlen] = 0;
685 *added_dummy =
false;
696 ERR(
"send_add_dir returned %08lx\n",
Status);
701 *added_dummy =
false;
712 searchkey.
offset = 0xffffffffffffffff;
716 ERR(
"find_item returned %08lx\n",
Status);
734 ERR(
"find_send_dir returned %08lx\n",
Status);
741 ERR(
"send_add_dir returned %08lx\n",
Status);
746 *added_dummy =
false;
754 ERR(
"get_orphan_name returned %08lx\n",
Status);
760 ERR(
"send_add_dir returned %08lx\n",
Status);
793 ERR(
"find_send_dir returned %08lx\n",
Status);
802 while (le != &
context->orphans) {
827 ERR(
"out of memory\n");
855 ERR(
"out of memory\n");
902 ERR(
"find_send_dir returned %08lx\n",
Status);
911 while (le != &
context->orphans) {
935 ERR(
"out of memory\n");
952 ERR(
"out of memory\n");
1074 ERR(
"find_item returned %08lx\n",
Status);
1109 ERR(
"out of memory\n");
1116 le =
context->pending_rmdirs.Flink;
1117 while (le != &
context->pending_rmdirs) {
1146 ERR(
"find_item returned %08lx\n",
Status);
1188 ERR(
"out of memory\n");
1192 dc->namelen =
r->namelen;
1198 while (le != &
context->orphans) {
1217 ERR(
"get_orphan_name returned %08lx\n",
Status);
1224 ERR(
"find_send_dir returned %08lx\n",
Status);
1243 ERR(
"out of memory\n");
1261 ERR(
"out of memory\n");
1283 if (or && !
context->lastinode.o) {
1287 if (!
context->lastinode.path) {
1288 ERR(
"out of memory\n");
1298 ERR(
"find_send_dir returned %08lx\n",
Status);
1310 ERR(
"look_for_collision returned %08lx\n",
Status);
1317 ERR(
"make_file_orphan returned %08lx\n",
Status);
1325 ERR(
"found_path returned %08lx\n",
Status);
1345 if (
context->lastinode.sd->name)
1349 if (!
context->lastinode.sd->name) {
1350 ERR(
"out of memory\n");
1355 context->lastinode.sd->parent =
r->sd;
1362 if (!
context->lastinode.path) {
1363 ERR(
"out of memory\n");
1370 }
else if (
r && !or) {
1373 ERR(
"found_path returned %08lx\n",
Status);
1384 ERR(
"get_dir_last_child returned %08lx\n",
Status);
1388 if (last_inode <= context->
lastinode.inode) {
1399 ERR(
"get_orphan_name returned %08lx\n",
Status);
1408 if (
context->lastinode.sd->name)
1412 if (!
context->lastinode.sd->name) {
1413 ERR(
"out of memory\n");
1419 context->lastinode.sd->dummy =
true;
1426 ERR(
"add_pending_rmdir returned %08lx\n",
Status);
1449 if (!
context->lastinode.path) {
1450 ERR(
"out of memory\n");
1460 le =
context->lastinode.oldrefs.Flink;
1461 while (le != &
context->lastinode.oldrefs) {
1464 bool matched =
false;
1466 le2 =
context->lastinode.refs.Flink;
1467 while (le2 != &
context->lastinode.refs) {
1498 ERR(
"look_for_collision returned %08lx\n",
Status);
1505 ERR(
"make_file_orphan returned %08lx\n",
Status);
1514 ERR(
"wait_for_flush returned %08lx\n",
Status);
1518 if (
context->send->cancelling)
1524 ERR(
"found_path returned %08lx\n",
Status);
1531 if (nameref && !nameref2)
1539 bool deleted =
false;
1559 ERR(
"wait_for_flush returned %08lx\n",
Status);
1563 if (
context->send->cancelling)
1569 ERR(
"send_unlink_command returned %08lx\n",
Status);
1577 if (or == nameref && nameref2) {
1584 if (!
context->lastinode.path) {
1585 ERR(
"out of memory\n");
1589 find_path(
context->lastinode.path, nameref2->sd, nameref2->name, nameref2->namelen);
1620 if (
context->send->cancelling)
1626 ERR(
"find_item returned %08lx\n",
Status);
1631 ERR(
"readonly subvolume changed\n");
1639 ERR(
"find_item returned %08lx\n",
Status);
1644 ERR(
"readonly subvolume changed\n");
1657 while (le !=
exts) {
1660 if (
ext->offset > lastoff) {
1665 ERR(
"out of memory\n");
1671 ext2->offset = lastoff;
1681 lastoff =
ext->offset +
ext->data.decoded_size;
1690 if (
size > lastoff) {
1695 ERR(
"out of memory\n");
1701 ext2->offset = lastoff;
1722 ERR(
"out of memory\n");
1728 ext2->data.decoded_size =
ext->data.decoded_size -
len;
1729 ext2->data.compression =
ext->data.compression;
1730 ext2->data.encryption =
ext->data.encryption;
1731 ext2->data.encoding =
ext->data.encoding;
1732 ext2->data.type =
ext->data.type;
1738 ext->data.decoded_size =
len;
1749 ERR(
"out of memory\n");
1758 ext2->data.compression =
ext->data.compression;
1759 ext2->data.encryption =
ext->data.encryption;
1760 ext2->data.encoding =
ext->data.encoding;
1761 ext2->data.type =
ext->data.type;
1764 if (ed2a->
size == 0) {
1766 ext->data.decoded_size =
len;
1770 ext2->data.decoded_size =
ext->data.decoded_size;
1805 ERR(
"divide_ext returned %08lx\n",
Status);
1808 }
else if (len2 < len1) {
1811 ERR(
"divide_ext returned %08lx\n",
Status);
1816 if (
ext1->list_entry.Flink == &
context->lastinode.exts ||
ext2->list_entry.Flink == &
context->lastinode.oldexts)
1828 ERR(
"divide_ext returned %08lx\n",
Status);
1834 ERR(
"divide_ext returned %08lx\n",
Status);
1854 searchkey.
offset = 0xffffffffffffffff;
1858 ERR(
"find_item returned %08lx\n",
Status);
1863 ERR(
"could not find INODE_REF for inode %I64x\n", searchkey.
obj_id);
1901 searchkey.
offset = 0xffffffffffffffff;
1905 ERR(
"find_item returned %08lx\n",
Status);
1910 ERR(
"could not find INODE_REF for inode %I64x\n", searchkey.
obj_id);
1947 if (!
r &&
context->num_clones > 0) {
1967 ERR(
"find_item returned %08lx\n",
Status);
1991 if ((clone_offset & (
context->Vcb->superblock.sector_size - 1)) == 0 && (clone_len & (
context->Vcb->superblock.sector_size - 1)) == 0) {
2042 ERR(
"find_item returned %08lx\n",
Status);
2069 if (sectlen >
len) {
2093 if (rc >= ei->refcount)
2101 ERR(
"find_item returned %08lx\n",
Status);
2136 ERR(
"add_ext_holes returned %08lx\n",
Status);
2142 ERR(
"add_ext_holes returned %08lx\n",
Status);
2148 ERR(
"sync_ext_cutoff_points returned %08lx\n",
Status);
2200 ERR(
"zlib_decompress returned %08lx\n",
Status);
2207 ERR(
"extent data was truncated\n");
2216 ERR(
"lzo_decompress returned %08lx\n",
Status);
2224 ERR(
"zlib_decompress returned %08lx\n",
Status);
2254 if (ed2->
size == 0) {
2263 ERR(
"wait_for_flush returned %08lx\n",
Status);
2269 if (
context->send->cancelling) {
2296 ERR(
"out of memory\n");
2311 ERR(
"wait_for_flush returned %08lx\n",
Status);
2318 if (
context->send->cancelling) {
2326 skip_start =
addr & (
context->Vcb->superblock.sector_size - 1);
2338 ERR(
"out of memory\n");
2347 ERR(
"load_csum returned %08lx\n",
Status);
2359 ERR(
"read_data returned %08lx\n",
Status);
2393 ERR(
"out of memory\n");
2401 ERR(
"out of memory\n");
2417 ERR(
"out of memory\n");
2427 ERR(
"load_csum returned %08lx\n",
Status);
2437 Status =
read_data(
context->Vcb, ed2->
address, (
uint32_t)ed2->
size,
csum,
false, compbuf,
NULL,
NULL,
NULL, 0,
false,
NormalPagePriority);
2439 ERR(
"read_data returned %08lx\n",
Status);
2454 ERR(
"zlib_decompress returned %08lx\n",
Status);
2464 ERR(
"lzo_decompress returned %08lx\n",
Status);
2474 ERR(
"zstd_decompress returned %08lx\n",
Status);
2492 ERR(
"wait_for_flush returned %08lx\n",
Status);
2499 if (
context->send->cancelling) {
2538 ERR(
"flush_refs returned %08lx\n",
Status);
2542 if (
context->send->cancelling)
2546 if (!
context->lastinode.deleting) {
2547 if (
context->lastinode.file) {
2550 ERR(
"flush_extents returned %08lx\n",
Status);
2554 if (
context->send->cancelling)
2579 le =
context->pending_rmdirs.Flink;
2581 while (le != &
context->pending_rmdirs) {
2611 if (
context->lastinode.path) {
2628 ERR(
"flush_refs returned %08lx\n",
Status);
2632 if (
context->send->cancelling)
2687 ERR(
"out of memory\n");
2746 ERR(
"out of memory\n");
2777 ERR(
"flush_refs returned %08lx\n",
Status);
2781 if (
context->send->cancelling)
2822 }
else if (!
tp && tp2) {
2826 len = tp2->item->size;
2833 ERR(
"(%I64x,%x,%I64x) was truncated\n", tp2->item->key.obj_id, tp2->item->key.obj_type, tp2->item->key.offset);
2866 ERR(
"out of memory\n");
2875 xa->namelen = di->
n;
2876 xa->name = di->
name;
2877 xa->value1len = di->
m;
2878 xa->value1 = di->
name + di->
n;
2888 len = tp2->item->size;
2897 ERR(
"(%I64x,%x,%I64x) was truncated\n", tp2->item->key.obj_id, tp2->item->key.obj_type, tp2->item->key.offset);
2902 while (le != &xattrs) {
2906 xa->value2len = di->
m;
2907 xa->value2 = di->
name + di->
n;
2918 ERR(
"out of memory\n");
2927 xa->namelen = di->
n;
2928 xa->name = di->
name;
2931 xa->value2len = di->
m;
2932 xa->value2 = di->
name + di->
n;
3005 ERR(
"do_write returned %08lx\n",
Status);
3017 ERR(
"find_item returned %08lx\n",
Status);
3023 bool ended1 =
false, ended2 =
false;
3026 ERR(
"find_item returned %08lx\n",
Status);
3043 if (
context->send->cancelling)
3051 ERR(
"find_item returned %08lx\n",
Status);
3057 ERR(
"readonly subvolume changed\n");
3067 ERR(
"find_item returned %08lx\n",
Status);
3073 ERR(
"readonly subvolume changed\n");
3084 ERR(
"skip_to_difference returned %08lx\n",
Status);
3091 bool no_next =
false, no_next2 =
false;
3098 ERR(
"finish_inode returned %08lx\n",
Status);
3103 if (
context->send->cancelling) {