Change ntfs_rl_truncate() to take address of the runlist

rather than the runlist to allow reallocation of the runlist
buffer.

(Logical change 1.61)
edge.strict_endians
cantab.net!aia21 2002-12-27 16:48:52 +00:00
parent 66fb584c1a
commit eb98ae1dca
3 changed files with 8 additions and 5 deletions

View File

@ -71,7 +71,7 @@ extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max,
extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
const int dst_len, const runlist_element *rl);
extern int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn);
extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn);
#endif /* defined _NTFS_RUNLIST_H */

View File

@ -2110,7 +2110,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
}
/* Truncate the runlist itself. */
if (ntfs_rl_truncate(na->rl, first_free_vcn)) {
if (ntfs_rl_truncate(&na->rl, first_free_vcn)) {
// FIXME: Eeek! We need rollback! (AIA)
fprintf(stderr, "%s(): Eeek! Run list truncation failed. "
"Leaving inconsistent metadata!\n",

View File

@ -1309,15 +1309,18 @@ err_out:
/**
* ntfs_rl_truncate - truncate a runlist starting at a specified vcn
* @rl: runlist to truncate
* @rl: address of runlist to truncate
* @start_vcn: first vcn which should be cut off
*
* Truncate the runlist @rl starting at vcn @start_vcn as well as the memory
* Truncate the runlist *@rl starting at vcn @start_vcn as well as the memory
* buffer holding the runlist.
*
* Return 0 on success and -1 on error with errno set to the error code.
*
* NOTE: @rl is the address of the runlist. We need the address so we can
* modify the pointer to the runlist with the new, reallocated memory buffer.
*/
int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn)
int ntfs_rl_truncate(runlist **rl, const VCN start_vcn)
{
errno = ENOTSUP;
return -1;