diff --git a/include/runlist.h b/include/runlist.h index 62ad9431..8a369fbd 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -63,5 +63,7 @@ extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, 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); + #endif /* defined _NTFS_RUNLIST_H */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 0fbf2ced..3e3d70cc 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1106,7 +1106,7 @@ rl_err_out: * * Create the mapping pairs array from the runlist @rl and save the array in * @dst. @dst_len is the size of @dst in bytes and it should be at least equal - * to the value obtained by calling ntfs_get_size_for_mapping_pairs(@rl). + * to the value obtained by calling ntfs_get_size_for_mapping_pairs(). * * Return 0 on success or when @rl is NULL. On error, return -1 with errno set * to the error code. The following error codes are defined: @@ -1174,3 +1174,19 @@ err_out: return -1; } +/** + * ntfs_rl_truncate - truncate a runlist starting at a specified vcn + * @rl: 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 + * buffer holding the runlist. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn) +{ + errno = ENOTSUP; + return -1; +} +