int ntfs_mapping_pairs_build (const ntfs_volume * vol, s8 * dst, const int dst_len, const runlist_element * rl, const VCN first_vcn, const VCN last_vcn, VCN *const stop_vcn);
Create the mapping pairs array from the locked runlist rl, starting at vcn first_vcn and finishing with vcn last_vcn 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.
A last_vcn of -1 means end of runlist and in that case the mapping pairs array corresponding to the runlist starting at vcn first_vcn and finishing at the end of the runlist is created.
If rl is NULL, just write a single terminator byte to dst.
On success or -ENOSPC error, if stop_vcn is not NULL, *stop_vcn is set to the first vcn outside the destination buffer. Note that on error, dst has been filled with all the mapping pairs that will fit, thus it can be treated as partial success, in that a new attribute extent needs to be created or the next extent has to be used and the mapping pairs build has to be continued with first_vcn set to *stop_vcn.
Return 0 on success and -errno on error. The following error codes are
-EINVAL - Run list contains unmapped elements. Make sure to only pass fully mapped runlists to this function. -EIO - The runlist is corrupt. -ENOSPC - The destination buffer is too small.
rl must be locked on entry (either for reading or writing), it remains locked throughout, and is left locked upon return.