Lines Matching refs:action
85 /* check whether a MFT or INDX record is older than action */
88 /* check whether a MFT or INDX record is newer than action */
647 " (record %s than action 0x%llx)\n",
673 " (index %s than action 0x%llx)\n",
827 * The action UpdateFileNameRoot updates the time stamps and/or the
862 static int change_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
872 if (action->record.undo_length != action->record.redo_length)
875 lcn = sle64_to_cpu(action->record.lcn_list[0]);
877 (long long)inode_number(&action->record),
881 + le16_to_cpu(action->record.record_offset));
888 attrend = le16_to_cpu(action->record.record_offset)
905 err = write_protected(vol, &action->record,
916 static int change_resident_expect(ntfs_volume *vol, const struct ACTION_RECORD *action,
926 if (action->record.undo_length != action->record.redo_length)
929 lcn = sle64_to_cpu(action->record.lcn_list[0]);
931 (long long)inode_number(&action->record),
935 + le16_to_cpu(action->record.record_offset));
953 err = write_protected(vol, &action->record,
969 static int change_index_value(ntfs_volume *vol, const struct ACTION_RECORD *action,
979 count = le16_to_cpu(action->record.lcns_to_follow);
981 lcn = sle64_to_cpu(action->record.lcn_list[0]);
999 err = write_protected(vol, &action->record,
1014 static int add_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1026 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1028 (long long)inode_number(&action->record),
1040 /* This has to be an idempotent action */
1064 err = write_protected(vol, &action->record,
1080 const struct ACTION_RECORD *action,
1094 static int expand_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1108 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1110 (long long)inode_number(&action->record),
1115 + le16_to_cpu(action->record.record_offset));
1124 /* This has to be an idempotent action */
1146 err = write_protected(vol, &action->record,
1162 const struct ACTION_RECORD *action,
1176 static int insert_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1191 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1193 (long long)inode_number(&action->record),
1198 + le16_to_cpu(action->record.record_offset));
1214 /* This has to be an idempotent action */
1226 if (action->record.redo_operation
1244 err = write_protected(vol, &action->record,
1259 static int remove_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1273 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1275 (long long)inode_number(&action->record),
1280 + le16_to_cpu(action->record.record_offset));
1287 /* This has to be an idempotent action */
1306 - le16_to_cpu(action->record.record_offset));
1314 if (action->record.redo_operation
1330 err = write_protected(vol, &action->record,
1345 static int delete_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1359 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1361 (long long)inode_number(&action->record),
1373 /* This has to be an idempotent action */
1392 err = write_protected(vol, &action->record,
1403 static int shrink_resident(ntfs_volume *vol, const struct ACTION_RECORD *action,
1419 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1421 (long long)inode_number(&action->record),
1426 + le16_to_cpu(action->record.record_offset));
1437 /* This has to be an idempotent action */
1473 err = write_protected(vol, &action->record,
1484 static int update_index(ntfs_volume *vol, const struct ACTION_RECORD *action,
1495 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1501 + le16_to_cpu(action->record.record_offset));
1509 /* This has to be an idempotent action */
1519 err = write_protected(vol, &action->record,
1702 * Check whether a full MFT record is fed by an action
1707 static BOOL check_full_mft(const struct ACTION_RECORD *action, BOOL redoing)
1716 record = (const MFT_RECORD*)((const char*)&action->record
1717 + get_redo_offset(&action->record));
1718 length = le16_to_cpu(action->record.redo_length);
1720 record = (const MFT_RECORD*)((const char*)&action->record
1721 + get_undo_offset(&action->record));
1722 length = le16_to_cpu(action->record.undo_length);
1725 ok = !action->record.record_offset
1726 && !action->record.attribute_offset
1753 static BOOL check_full_index(const struct ACTION_RECORD *action, BOOL redoing)
1759 indx = (const INDEX_BLOCK*)((const char*)&action->record
1760 + get_redo_offset(&action->record));
1761 length = le16_to_cpu(action->record.redo_length);
1763 indx = (const INDEX_BLOCK*)((const char*)&action->record
1764 + get_undo_offset(&action->record));
1765 length = le16_to_cpu(action->record.undo_length);
1768 return (!action->record.record_offset
1769 && !action->record.attribute_offset
1783 static int create_indx(ntfs_volume *vol, const struct ACTION_RECORD *action,
1802 indx->lsn = action->record.this_lsn;
1803 vcn = sle64_to_cpu(action->record.target_vcn);
1825 static int redo_action37(ntfs_volume *vol, const struct ACTION_RECORD *action,
1835 length = le16_to_cpu(action->record.redo_length);
1836 target = le16_to_cpu(action->record.record_offset)
1837 + le16_to_cpu(action->record.attribute_offset);
1844 err = write_protected(vol, &action->record,
1850 printf("** Bad action-37, inode %lld record :\n",
1851 (long long)inode_number(&action->record));
1860 static int redo_add_index(ntfs_volume *vol, const struct ACTION_RECORD *action,
1876 data = ((const char*)&action->record)
1877 + get_redo_offset(&action->record);
1878 length = le16_to_cpu(action->record.redo_length);
1879 target = le16_to_cpu(action->record.record_offset)
1880 + le16_to_cpu(action->record.attribute_offset);
1882 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1888 + le16_to_cpu(action->record.record_offset));
1896 /* This has to be an idempotent action */
1912 err = write_protected(vol, &action->record,
1924 const struct ACTION_RECORD *action, char *buffer)
1939 data = ((const char*)&action->record)
1940 + get_redo_offset(&action->record);
1941 length = le16_to_cpu(action->record.redo_length);
1942 target = le16_to_cpu(action->record.record_offset)
1943 + le16_to_cpu(action->record.attribute_offset);
1945 lcn = sle64_to_cpu(action->record.lcn_list[0]);
1947 (long long)inode_number(&action->record),
1952 + le16_to_cpu(action->record.record_offset));
1962 /* This has to be an idempotent action */
1976 err = write_protected(vol, &action->record,
1988 const struct ACTION_RECORD *action,
1996 lsn = sle64_to_cpu(action->record.this_lsn);
2004 const struct ACTION_RECORD *action, char *buffer)
2017 data = ((const char*)&action->record)
2018 + get_redo_offset(&action->record);
2019 length = le16_to_cpu(action->record.redo_length);
2020 target = le16_to_cpu(action->record.record_offset)
2021 + le16_to_cpu(action->record.attribute_offset);
2023 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2025 (long long)inode_number(&action->record),
2043 err = write_protected(vol, &action->record,
2057 const struct ACTION_RECORD *action, char *buffer)
2067 data = ((const char*)&action->record)
2068 + get_redo_offset(&action->record);
2069 length = le16_to_cpu(action->record.redo_length);
2070 target = le16_to_cpu(action->record.record_offset)
2071 + le16_to_cpu(action->record.attribute_offset);
2073 if (!action->record.undo_length)
2074 err = insert_resident(vol, action, buffer, data,
2080 const struct ACTION_RECORD *action, char *buffer)
2090 data = ((const char*)&action->record)
2091 + get_undo_offset(&action->record);
2092 length = le16_to_cpu(action->record.undo_length);
2093 target = le16_to_cpu(action->record.record_offset)
2094 + le16_to_cpu(action->record.attribute_offset);
2095 if (!action->record.redo_length)
2096 err = remove_resident(vol, action, buffer, data,
2102 const struct ACTION_RECORD *action, char *buffer)
2115 data = ((const char*)&action->record)
2116 + get_undo_offset(&action->record);
2117 length = le16_to_cpu(action->record.undo_length);
2118 target = le16_to_cpu(action->record.record_offset)
2119 + le16_to_cpu(action->record.attribute_offset);
2121 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2123 (long long)inode_number(&action->record),
2143 err = write_protected(vol, &action->record,
2155 const struct ACTION_RECORD *action, char *buffer)
2170 data = ((const char*)&action->record)
2171 + get_undo_offset(&action->record);
2172 length = le16_to_cpu(action->record.undo_length);
2173 target = le16_to_cpu(action->record.record_offset)
2174 + le16_to_cpu(action->record.attribute_offset);
2176 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2182 + le16_to_cpu(action->record.record_offset));
2190 /* This has to be an idempotent action */
2191 found = (action->record.undo_operation
2203 err = write_protected(vol, &action->record,
2215 const struct ACTION_RECORD *action, char *buffer)
2230 data = ((const char*)&action->record)
2231 + get_undo_offset(&action->record);
2232 length = le16_to_cpu(action->record.undo_length);
2233 target = le16_to_cpu(action->record.record_offset)
2234 + le16_to_cpu(action->record.attribute_offset);
2237 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2239 (long long)inode_number(&action->record),
2244 + le16_to_cpu(action->record.record_offset));
2254 /* This has to be an idempotent action */
2255 found = (action->record.undo_operation
2270 err = write_protected(vol, &action->record,
2282 const struct ACTION_RECORD *action, char *buffer)
2296 (((const char*)&action->record)
2297 + get_redo_offset(&action->record));
2300 if (action->record.redo_operation
2308 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2314 if (!write_raw(vol, &action->record, buffer)) {
2325 const struct ACTION_RECORD *action)
2341 data = ((const char*)&action->record)
2342 + get_redo_offset(&action->record);
2343 length = le16_to_cpu(action->record.redo_length);
2344 extra = get_extra_offset(&action->record);
2345 if (action->record.undo_length) {
2346 name = ((const char*)&action->record) + extra;
2347 namelen = le32_to_cpu(action->record.client_data_length)
2360 pa = getattrentry(le16_to_cpu(action->record.target_attribute),0);
2405 static int redo_sizes(ntfs_volume *vol, const struct ACTION_RECORD *action,
2416 data = ((const char*)&action->record)
2417 + get_redo_offset(&action->record);
2418 length = le16_to_cpu(action->record.redo_length);
2419 target = le16_to_cpu(action->record.record_offset)
2420 + le16_to_cpu(action->record.attribute_offset)
2422 err = change_resident(vol, action, buffer,
2428 const struct ACTION_RECORD *action, char *buffer)
2438 data = ((const char*)&action->record)
2439 + get_redo_offset(&action->record);
2440 length = le16_to_cpu(action->record.redo_length);
2442 target = le16_to_cpu(action->record.record_offset)
2443 + le16_to_cpu(action->record.attribute_offset)
2445 err = update_index(vol, action, buffer, data, target, length);
2450 const struct ACTION_RECORD *action, char *buffer)
2460 data = ((const char*)&action->record)
2461 + get_redo_offset(&action->record);
2462 length = le16_to_cpu(action->record.redo_length);
2463 target = le16_to_cpu(action->record.record_offset)
2464 + le16_to_cpu(action->record.attribute_offset);
2465 err = change_index_value(vol, action, buffer, data, target, length);
2470 const struct ACTION_RECORD *action, char *buffer)
2488 data = ((const char*)&action->record)
2489 + get_redo_offset(&action->record);
2490 length = le16_to_cpu(action->record.redo_length);
2491 resize = length - le16_to_cpu(action->record.undo_length);
2492 target = le16_to_cpu(action->record.record_offset)
2493 + le16_to_cpu(action->record.attribute_offset);
2495 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2497 (long long)inode_number(&action->record),
2506 + le16_to_cpu(action->record.record_offset));
2545 &action->record,
2558 const struct ACTION_RECORD *action, char *buffer)
2573 end = le32_to_cpu(action->record.client_data_length)
2575 length = le16_to_cpu(action->record.redo_length);
2576 redo = get_redo_offset(&action->record);
2580 data = ((const char*)&action->record) + redo;
2581 oldlength = le16_to_cpu(action->record.undo_length);
2582 target = le16_to_cpu(action->record.record_offset)
2583 + le16_to_cpu(action->record.attribute_offset);
2586 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2589 (long long)inode_number(&action->record),
2597 changed = (action->record.undo_operation
2607 err = write_protected(vol, &action->record,
2617 err = expand_resident(vol, action, buffer, data,
2620 err = shrink_resident(vol, action, buffer, data,
2627 const struct ACTION_RECORD *action, char *buffer)
2638 data = ((const char*)&action->record)
2639 + get_redo_offset(&action->record);
2640 expected = ((const char*)&action->record)
2641 + get_undo_offset(&action->record);
2642 length = le16_to_cpu(action->record.redo_length);
2644 target = le16_to_cpu(action->record.record_offset)
2645 + le16_to_cpu(action->record.attribute_offset)
2648 if (action->record.undo_operation
2650 err = change_resident(vol, action, buffer, data,
2653 err = change_resident_expect(vol, action, buffer, data,
2659 const struct ACTION_RECORD *action, char *buffer)
2670 data = ((const char*)&action->record)
2671 + get_redo_offset(&action->record);
2672 expected = ((const char*)&action->record)
2673 + get_undo_offset(&action->record);
2674 length = le16_to_cpu(action->record.redo_length);
2676 target = le16_to_cpu(action->record.record_offset)
2677 + le16_to_cpu(action->record.attribute_offset);
2680 err = change_resident_expect(vol, action, buffer, data,
2687 const struct ACTION_RECORD *action, char *buffer)
2703 length = le16_to_cpu(action->record.redo_length);
2704 redo = get_redo_offset(&action->record);
2705 end = le32_to_cpu(action->record.client_data_length)
2711 data = ((const char*)&action->record) + redo;
2712 target = le16_to_cpu(action->record.record_offset)
2713 + le16_to_cpu(action->record.attribute_offset);
2714 count = le16_to_cpu(action->record.lcns_to_follow);
2716 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2741 err = write_raw(vol, &action->record, buffer);
2753 const struct ACTION_RECORD *action, char *buffer)
2763 data = ((const char*)&action->record)
2764 + get_redo_offset(&action->record);
2765 length = le16_to_cpu(action->record.redo_length);
2767 target = le16_to_cpu(action->record.record_offset)
2768 + le16_to_cpu(action->record.attribute_offset);
2771 err = update_index(vol, action, buffer, data, target, length);
2777 const struct ACTION_RECORD *action, char *buffer)
2792 end = le32_to_cpu(action->record.client_data_length)
2794 length = le16_to_cpu(action->record.redo_length);
2795 redo = get_redo_offset(&action->record);
2799 data = ((const char*)&action->record) + redo;
2800 oldlength = le16_to_cpu(action->record.undo_length);
2801 target = le16_to_cpu(action->record.record_offset)
2802 + le16_to_cpu(action->record.attribute_offset);
2805 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2808 (long long)inode_number(&action->record),
2824 err = write_protected(vol, &action->record,
2834 err = add_resident(vol, action, buffer, data,
2837 err = delete_resident(vol, action, buffer, data,
2844 const struct ACTION_RECORD *action, char *buffer)
2858 data = ((const char*)&action->record)
2859 + get_redo_offset(&action->record);
2860 length = le16_to_cpu(action->record.redo_length);
2862 target = le16_to_cpu(action->record.record_offset)
2863 + le16_to_cpu(action->record.attribute_offset);
2865 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2871 if (action->record.record_offset) {
2881 /* This has to be an idempotent action */
2894 err = write_protected(vol, &action->record,
2906 const struct ACTION_RECORD *action,
2920 data = ((const char*)&action->record)
2921 + get_redo_offset(&action->record);
2922 length = le16_to_cpu(action->record.redo_length);
2923 target = le16_to_cpu(action->record.record_offset)
2924 + le16_to_cpu(action->record.attribute_offset);
2926 printf("* Ignored action-37, inode %lld record :\n",
2927 (long long)inode_number(&action->record));
2933 const struct ACTION_RECORD *action, char *buffer)
2948 data = ((const char*)&action->record)
2949 + get_redo_offset(&action->record);
2950 length = le16_to_cpu(action->record.redo_length);
2951 target = le16_to_cpu(action->record.record_offset)
2952 + le16_to_cpu(action->record.attribute_offset);
2954 lcn = sle64_to_cpu(action->record.lcn_list[0]);
2960 + le16_to_cpu(action->record.record_offset));
2968 /* This has to be an idempotent action */
2979 err = write_protected(vol, &action->record,
2995 const struct ACTION_RECORD *action, char *buffer)
3010 data = ((const char*)&action->record)
3011 + get_redo_offset(&action->record);
3012 length = le16_to_cpu(action->record.redo_length);
3013 target = le16_to_cpu(action->record.record_offset)
3014 + le16_to_cpu(action->record.attribute_offset);
3016 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3018 (long long)inode_number(&action->record),
3023 + le16_to_cpu(action->record.record_offset));
3033 /* This has to be an idempotent action */
3036 if (found && !older_record(entry, &action->record)) {
3046 err = write_protected(vol, &action->record,
3058 const struct ACTION_RECORD *action, char *buffer)
3068 data = ((const char*)&action->record)
3069 + get_redo_offset(&action->record);
3070 length = le16_to_cpu(action->record.redo_length);
3071 target = le16_to_cpu(action->record.record_offset)
3072 + le16_to_cpu(action->record.attribute_offset);
3073 if (!action->record.undo_length)
3074 err = remove_resident(vol, action, buffer, data,
3080 const struct ACTION_RECORD *action, char *buffer)
3090 data = ((const char*)&action->record)
3091 + get_undo_offset(&action->record);
3092 length = le16_to_cpu(action->record.undo_length);
3093 target = le16_to_cpu(action->record.record_offset)
3094 + le16_to_cpu(action->record.attribute_offset);
3095 if (!action->record.redo_length)
3096 err = insert_resident(vol, action, buffer, data,
3102 const struct ACTION_RECORD *action, char *buffer)
3118 data = ((const char*)&action->record)
3119 + get_undo_offset(&action->record);
3120 length = le16_to_cpu(action->record.undo_length);
3121 target = le16_to_cpu(action->record.record_offset)
3122 + le16_to_cpu(action->record.attribute_offset);
3124 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3130 + le16_to_cpu(action->record.record_offset));
3139 /* This has to be an idempotent action */
3157 err = write_protected(vol, &action->record,
3169 const struct ACTION_RECORD *action, char *buffer)
3184 data = ((const char*)&action->record)
3185 + get_undo_offset(&action->record);
3186 length = le16_to_cpu(action->record.undo_length);
3187 target = le16_to_cpu(action->record.record_offset)
3188 + le16_to_cpu(action->record.attribute_offset);
3190 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3192 (long long)inode_number(&action->record),
3197 + le16_to_cpu(action->record.record_offset));
3215 /* This has to be an idempotent action */
3230 err = write_protected(vol, &action->record,
3242 const struct ACTION_RECORD *action, char *buffer)
3256 data = ((const char*)&action->record)
3257 + get_redo_offset(&action->record);
3258 length = le16_to_cpu(action->record.redo_length);
3259 target = le16_to_cpu(action->record.record_offset)
3260 + le16_to_cpu(action->record.attribute_offset);
3262 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3264 (long long)inode_number(&action->record),
3282 err = write_protected(vol, &action->record,
3294 const struct ACTION_RECORD *action, char *buffer)
3307 data = ((const char*)&action->record)
3308 + get_undo_offset(&action->record);
3309 length = le16_to_cpu(action->record.undo_length);
3310 target = le16_to_cpu(action->record.record_offset)
3311 + le16_to_cpu(action->record.attribute_offset);
3313 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3315 (long long)inode_number(&action->record),
3351 &action->record,
3363 const struct ACTION_RECORD *action, char *buffer)
3377 (((const char*)&action->record)
3378 + get_redo_offset(&action->record));
3381 if (action->record.redo_operation
3389 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3395 if (!write_raw(vol, &action->record, buffer)) {
3406 const struct ACTION_RECORD *action)
3422 data = ((const char*)&action->record)
3423 + get_redo_offset(&action->record);
3424 length = le16_to_cpu(action->record.redo_length);
3425 extra = get_extra_offset(&action->record);
3426 if (action->record.undo_length) {
3427 name = ((const char*)&action->record) + extra;
3428 namelen = le32_to_cpu(action->record.client_data_length)
3441 pa = getattrentry(le16_to_cpu(action->record.target_attribute),0);
3476 const struct ACTION_RECORD *action, char *buffer)
3489 data = ((const char*)&action->record)
3490 + get_undo_offset(&action->record);
3491 length = le16_to_cpu(action->record.undo_length);
3492 target = le16_to_cpu(action->record.record_offset)
3493 + le16_to_cpu(action->record.attribute_offset)
3497 err = change_resident(vol, action, buffer,
3501 offs = le16_to_cpu(action->record.record_offset);
3506 err = change_resident(vol, action, buffer,
3509 err = change_resident(vol, action, buffer,
3515 static int undo_update_index(ntfs_volume *vol, const struct ACTION_RECORD *action,
3526 data = ((const char*)&action->record)
3527 + get_undo_offset(&action->record);
3528 length = le16_to_cpu(action->record.undo_length);
3530 target = le16_to_cpu(action->record.record_offset)
3531 + le16_to_cpu(action->record.attribute_offset)
3533 err = update_index(vol, action, buffer, data, target, length);
3538 const struct ACTION_RECORD *action, char *buffer)
3550 data = ((const char*)&action->record)
3551 + get_undo_offset(&action->record);
3552 length = le16_to_cpu(action->record.undo_length);
3553 target = le16_to_cpu(action->record.record_offset)
3554 + le16_to_cpu(action->record.attribute_offset);
3556 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3573 err = write_protected(vol, &action->record, buffer,
3584 static int undo_update_vcn(ntfs_volume *vol, const struct ACTION_RECORD *action,
3595 data = ((const char*)&action->record)
3596 + get_undo_offset(&action->record);
3597 length = le16_to_cpu(action->record.undo_length);
3599 target = le16_to_cpu(action->record.record_offset)
3600 + le16_to_cpu(action->record.attribute_offset);
3603 err = update_index(vol, action, buffer, data, target, length);
3608 static int undo_update_mapping(ntfs_volume *vol, const struct ACTION_RECORD *action,
3627 data = ((const char*)&action->record)
3628 + get_undo_offset(&action->record);
3629 length = le16_to_cpu(action->record.undo_length);
3630 resize = length - le16_to_cpu(action->record.redo_length);
3631 target = le16_to_cpu(action->record.record_offset)
3632 + le16_to_cpu(action->record.attribute_offset);
3634 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3636 (long long)inode_number(&action->record),
3646 + le16_to_cpu(action->record.record_offset));
3685 &action->record, buffer,
3698 const struct ACTION_RECORD *action, char *buffer)
3713 end = le32_to_cpu(action->record.client_data_length)
3715 length = le16_to_cpu(action->record.undo_length);
3716 undo = get_undo_offset(&action->record);
3720 data = ((const char*)&action->record) + undo;
3721 oldlength = le16_to_cpu(action->record.redo_length);
3722 target = le16_to_cpu(action->record.record_offset)
3723 + le16_to_cpu(action->record.attribute_offset);
3726 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3728 (long long)inode_number(&action->record),
3744 err = write_protected(vol, &action->record,
3754 err = expand_resident(vol, action, buffer, data,
3757 err = shrink_resident(vol, action, buffer, data,
3764 const struct ACTION_RECORD *action, char *buffer)
3775 data = ((const char*)&action->record)
3776 + get_undo_offset(&action->record);
3777 expected = ((const char*)&action->record)
3778 + get_redo_offset(&action->record);
3779 length = le16_to_cpu(action->record.undo_length);
3781 target = le16_to_cpu(action->record.record_offset)
3782 + le16_to_cpu(action->record.attribute_offset)
3785 err = change_resident_expect(vol, action, buffer, data, expected,
3791 const struct ACTION_RECORD *action, char *buffer)
3802 data = ((const char*)&action->record)
3803 + get_undo_offset(&action->record);
3804 expected = ((const char*)&action->record)
3805 + get_redo_offset(&action->record);
3806 length = le16_to_cpu(action->record.undo_length);
3808 target = le16_to_cpu(action->record.record_offset)
3809 + le16_to_cpu(action->record.attribute_offset);
3812 err = change_resident_expect(vol, action, buffer, data,
3819 const struct ACTION_RECORD *action, char *buffer)
3832 data = ((const char*)&action->record)
3833 + get_undo_offset(&action->record);
3834 length = le16_to_cpu(action->record.undo_length);
3835 target = le16_to_cpu(action->record.record_offset)
3836 + le16_to_cpu(action->record.attribute_offset);
3837 count = le16_to_cpu(action->record.lcns_to_follow);
3839 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3857 err = write_raw(vol, &action->record, buffer);
3879 const struct ACTION_RECORD *action, char *buffer)
3894 end = le32_to_cpu(action->record.client_data_length)
3896 length = le16_to_cpu(action->record.undo_length);
3897 undo = get_undo_offset(&action->record);
3901 data = ((const char*)&action->record) + undo;
3902 oldlength = le16_to_cpu(action->record.redo_length);
3903 target = le16_to_cpu(action->record.record_offset)
3904 + le16_to_cpu(action->record.attribute_offset);
3907 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3910 (long long)inode_number(&action->record),
3926 err = write_protected(vol, &action->record,
3936 err = add_resident(vol, action, buffer, data,
3939 err = delete_resident(vol, action, buffer, data,
3946 const struct ACTION_RECORD *action, char *buffer)
3961 end = le32_to_cpu(action->record.client_data_length)
3963 length = le16_to_cpu(action->record.undo_length);
3964 undo = get_undo_offset(&action->record);
3968 data = ((const char*)&action->record) + undo;
3969 oldlength = le16_to_cpu(action->record.redo_length);
3970 target = le16_to_cpu(action->record.record_offset)
3971 + le16_to_cpu(action->record.attribute_offset);
3974 lcn = sle64_to_cpu(action->record.lcn_list[0]);
3977 (long long)inode_number(&action->record),
3993 err = write_protected(vol, &action->record,
4003 err = add_non_resident(/*vol, action, data,
4006 err = delete_non_resident(/*vol, action, data,
4014 static enum ACTION_KIND get_action_kind(const struct ACTION_RECORD *action)
4020 * If we are sure the action was defined by Vista
4023 * the action was defined by Win10 (or subsequent).
4025 if (action->record.log_record_flags
4027 if (action->record.attribute_flags & ACTS_ON_INDX)
4030 if (action->record.attribute_flags & ACTS_ON_MFT)
4040 action->record.target_attribute),0);
4048 * the action cannot apply to MFT or INDX.
4051 data = (const char*)&action->record
4052 + get_redo_offset(&action->record);
4053 if (action->record.record_offset
4054 || (!action->record.attribute_offset
4055 && (le16_to_cpu(action->record.redo_length)
4064 action->record.target_attribute));
4097 const struct ACTION_RECORD *action, char *buffer)
4103 rop = le16_to_cpu(action->record.redo_operation);
4104 uop = le16_to_cpu(action->record.undo_operation);
4107 if (action->record.undo_operation
4109 err = redo_add_index(vol, action, buffer);
4112 if (action->record.undo_operation
4114 err = redo_add_root_index(vol, action, buffer);
4117 if ((action->record.undo_operation
4119 || (action->record.undo_operation
4121 err = redo_force_bits(vol, action, buffer);
4124 if (action->record.undo_operation
4126 err = redo_compensate(vol, action, buffer);
4129 if ((action->record.undo_operation
4131 || (action->record.undo_operation
4133 err = redo_create_attribute(vol, action, buffer);
4136 if ((action->record.undo_operation
4138 || (action->record.undo_operation
4140 err = redo_delete_file(vol, action, buffer);
4143 if ((action->record.undo_operation
4145 || (action->record.undo_operation
4147 err = redo_delete_attribute(vol, action, buffer);
4150 if ((action->record.undo_operation
4152 || (action->record.undo_operation
4154 err = redo_delete_index(vol, action, buffer);
4157 if ((action->record.undo_operation
4159 || (action->record.undo_operation
4161 err = redo_delete_root_index(vol, action, buffer);
4164 if (action->record.undo_operation
4166 err = redo_create_file(vol, action, buffer);
4169 if (action->record.undo_operation
4171 err = redo_open_attribute(vol, action);
4174 if (action->record.undo_operation
4176 err = redo_force_bits(vol, action, buffer);
4179 if ((action->record.undo_operation
4181 || (action->record.undo_operation
4183 err = redo_update_vcn(vol, action, buffer);
4186 if (action->record.undo_operation
4188 err = redo_update_root_vcn(vol, action, buffer);
4191 if ((action->record.undo_operation
4193 || (action->record.undo_operation
4195 err = redo_sizes(vol, action, buffer);
4198 if ((action->record.undo_operation
4200 || (action->record.undo_operation
4202 err = redo_update_index(vol, action, buffer);
4205 if ((action->record.undo_operation
4207 || (action->record.undo_operation
4209 err = redo_update_root_index(vol, action, buffer);
4212 if (action->record.undo_operation
4214 err = redo_update_mapping(vol, action, buffer);
4217 switch (get_action_kind(action)) {
4219 err = redo_update_index_value(vol, action, buffer);
4222 err = redo_update_value(vol, action, buffer);
4230 if ((action->record.undo_operation
4232 || (action->record.undo_operation
4234 err = redo_update_resident(vol, action, buffer);
4237 if (action->record.undo_operation
4239 err = redo_action37(vol, action, buffer);
4242 if (action->record.undo_operation
4244 err = redo_write_end(vol, action, buffer);
4247 if ((action->record.undo_operation
4249 || (action->record.undo_operation
4251 err = redo_write_index(vol, action, buffer);
4266 printf("* Redoing action %d %s (%s) failed\n",
4267 action->num,actionname(rop), actionname(uop));
4272 * Redo a single action
4274 * The record the action acts on is read and, when it is an MFT or
4277 * When this is an action which creates a new MFT or INDX record
4282 static int play_one_redo(ntfs_volume *vol, const struct ACTION_RECORD *action)
4298 rop = le16_to_cpu(action->record.redo_operation);
4299 uop = le16_to_cpu(action->record.undo_operation);
4300 this_lsn = sle64_to_cpu(action->record.this_lsn);
4302 printf("Redo action %d %s (%s) 0x%llx\n",
4303 action->num,
4306 action->record.this_lsn));
4345 kind = get_action_kind(action);
4382 if (!(action->record.attribute_flags & ACTS_ON_MFT))
4383 printf("** %s (action %d) not acting on MFT\n",actionname(rop),(int)action->num);
4387 || !check_full_mft(action,TRUE);
4388 buffer = read_protected(vol, &action->record,
4401 && !exception(action->num);
4412 printf("** %s (action %d) not"
4415 (int)action->num);
4423 if (!(action->record.attribute_flags & ACTS_ON_INDX))
4424 printf("** %s (action %d) not acting on INDX\n",actionname(rop),(int)action->num);
4429 || !check_full_index(action,TRUE);
4430 buffer = read_protected(vol, &action->record,
4443 && ! exception(action->num);
4454 printf("** %s (action %d) not"
4457 (int)action->num);
4463 if (action->record.attribute_flags
4465 printf("** Error : action %s on MFT"
4470 buffer = read_raw(vol, &action->record);
4480 err = distribute_redos(vol, action, buffer);
4485 action->num,
4504 const struct ACTION_RECORD *action;
4508 action = firstaction;
4509 while (action && !err) {
4511 if ((!optc || within_lcn_range(&action->record))
4512 && (action->flags & ACTION_TO_REDO))
4513 err = play_one_redo(vol, action);
4515 action = action->next;
4520 static int distribute_undos(ntfs_volume *vol, const struct ACTION_RECORD *action,
4527 rop = le16_to_cpu(action->record.redo_operation);
4528 uop = le16_to_cpu(action->record.undo_operation);
4531 if (action->record.undo_operation
4533 err = undo_add_index(vol, action, buffer);
4536 if (action->record.undo_operation
4538 err = undo_add_root_index(vol, action, buffer);
4541 if (action->record.undo_operation
4543 err = undo_force_bits(vol, action, buffer);
4546 if (action->record.undo_operation
4548 err = undo_create_attribute(vol, action, buffer);
4551 if (action->record.undo_operation
4553 err = undo_delete_file(vol, action, buffer);
4556 if (action->record.undo_operation
4558 err = undo_delete_attribute(vol, action, buffer);
4561 if (action->record.undo_operation
4563 err = undo_delete_index(vol, action, buffer);
4566 if (action->record.undo_operation
4568 err = undo_delete_root_index(vol, action, buffer);
4571 if (action->record.undo_operation
4573 err = undo_create_file(vol, action, buffer);
4576 if (action->record.undo_operation
4578 err = undo_open_attribute(vol, action);
4581 if (action->record.undo_operation
4583 err = undo_force_bits(vol, action, buffer);
4586 if (action->record.undo_operation
4588 err = undo_update_vcn(vol, action, buffer);
4591 if (action->record.undo_operation
4593 err = undo_update_root_vcn(vol, action, buffer);
4596 if (action->record.undo_operation
4598 err = undo_sizes(vol, action, buffer);
4601 if (action->record.undo_operation
4603 err = undo_update_index(vol, action, buffer);
4606 if (action->record.undo_operation
4608 err = undo_update_root_index(vol, action, buffer);
4611 if (action->record.undo_operation
4613 err = undo_update_mapping(vol, action, buffer);
4616 switch (get_action_kind(action)) {
4618 err = undo_update_index_value(vol, action, buffer);
4621 err = undo_update_value(vol, action, buffer);
4629 if (action->record.undo_operation
4631 err = undo_update_resident(vol, action, buffer);
4634 if (action->record.undo_operation
4636 err = undo_action37(vol, action, buffer);
4639 if (action->record.undo_operation
4641 err = undo_write_end(vol, action, buffer);
4644 if (action->record.undo_operation
4646 err = undo_write_index(vol, action, buffer);
4661 printf("* Undoing action %d %s (%s) failed\n",
4662 action->num,actionname(rop), actionname(uop));
4667 * Undo a single action
4669 * The record the action acts on is read and, when it is an MFT or
4673 static int play_one_undo(ntfs_volume *vol, const struct ACTION_RECORD *action)
4686 rop = le16_to_cpu(action->record.redo_operation);
4687 uop = le16_to_cpu(action->record.undo_operation);
4689 printf("Undo action %d %s (%s) lsn 0x%llx\n",
4690 action->num,
4693 action->record.this_lsn));
4733 kind = get_action_kind(action);
4764 if (!(action->record.attribute_flags & ACTS_ON_MFT))
4765 printf("** %s (action %d) not acting on MFT\n",actionname(rop),(int)action->num);
4767 buffer = read_protected(vol, &action->record, mftrecsz, TRUE);
4772 &action->record);
4774 && exception(action->num))
4777 printf("record lsn 0x%llx is %s than action %d lsn 0x%llx\n",
4780 (int)action->num,
4781 (long long)sle64_to_cpu(action->record.this_lsn));
4783 printf("** %s (action %d) not acting on MFT\n",
4784 actionname(rop), (int)action->num);
4794 if (check_full_mft(action,TRUE))
4803 if (!(action->record.attribute_flags & ACTS_ON_INDX))
4804 printf("** %s (action %d) not acting on INDX\n",actionname(rop),(int)action->num);
4807 buffer = read_protected(vol, &action->record, xsize, TRUE);
4812 &action->record);
4814 && exception(action->num))
4817 printf("index lsn 0x%llx is %s than action %d lsn 0x%llx\n",
4820 (int)action->num,
4821 (long long)sle64_to_cpu(action->record.this_lsn));
4823 printf("** %s (action %d) not acting on INDX\n",
4824 actionname(rop), (int)action->num);
4838 if (check_full_index(action,TRUE))
4847 action, buffer);
4853 if (action->record.attribute_flags
4855 printf("** Error : action %s on MFT or INDX\n",
4859 buffer = read_raw(vol, &action->record);
4871 err = distribute_undos(vol, action, buffer);
4892 const struct ACTION_RECORD *action;
4896 action = lastaction;
4897 while (action && !err) {
4898 if (!optc || within_lcn_range(&action->record))
4899 err = play_one_undo(vol, action);
4901 action = action->prev;