diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e63af89d..b615efab 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2175,10 +2175,8 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) errno = EINVAL; return -1; } - if (type != AT_INDEX_ALLOCATION && type != AT_EA) return 0; - errno = EPERM; return -1; } @@ -2204,7 +2202,6 @@ static int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; - /* If the actual attribute length has changed, move things around. */ if (new_size != le32_to_cpu(a->length)) { u32 new_muse = le32_to_cpu(m->bytes_in_use) - @@ -2275,7 +2272,6 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, new_size + 7) & ~7) < 0) { if (errno != ENOSPC) { int eo = errno; - // FIXME: Eeek! fprintf(stderr, "%s(): Eeek! Attribute record resize " "failed. Aborting...\n", __FUNCTION__); @@ -2603,6 +2599,9 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) // TODO: Move the attribute to a new mft record, creating an attribute // list attribute or modifying it if it is already present. + // TODO: If that is still not enough, split the attribute into multiple + // extents and save them to several mft records. + err = ENOTSUP; goto put_err_out; @@ -3133,9 +3132,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = ENOTSUP; return -1; } - if (NAttrNonResident(na)) return ntfs_non_resident_attr_shrink(na, newsize); return ntfs_resident_attr_resize(na, newsize); } - diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 63c1082d..7ef1c0d9 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1427,9 +1427,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EINVAL; return -1; } - rl = *arl; - if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() fprintf(stderr, "%s(): Eeek! start_vcn lies outside front of " @@ -1437,7 +1435,6 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EIO; return -1; } - /* Find the starting vcn in the run list. */ while (rl->length) { if (start_vcn < rl[1].vcn) @@ -1458,13 +1455,10 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EIO; return -1; } - if (rl->length) { is_end = FALSE; - /* Truncate the run. */ rl->length = start_vcn - rl->vcn; - /* * If a run was partially truncated, make the following runlist * element a terminator instead of the truncated runlist @@ -1479,9 +1473,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) } } else is_end = TRUE; - rl->lcn = (LCN)LCN_ENOENT; - /* Reallocate memory if necessary. */ if (!is_end) { size_t new_size = (rl - *arl + 1) * sizeof(runlist_element); @@ -1498,8 +1490,6 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) __FUNCTION__); } } - /* Done! */ return 0; } -