NTFS_RUNLISTS_MERGE

Section: (9)
Updated: 09 October 2005
Index Return to Main Contents

 

NAME

ntfs_runlists_merge - merge two runlists into one  

SYNOPSIS

"SYNOPSIS"

runlist_element * ntfs_runlists_merge (runlist_element * drl, runlist_element * srl);  

ARGUMENTS

drl
original runlist to be worked on
srl
new runlist to be merged into drl
 

DESCRIPTION

First we sanity check the two runlists srl and drl to make sure that they are sensible and can be merged. The runlist srl must be either after the runlist drl or completely within a hole (or unmapped region) in drl.

It is up to the caller to serialize access to the runlists drl and srl.  

MERGING OF RUNLISTS IS NECESSARY IN TWO CASES

1. When attribute lists are used and a further extent is being mapped. 2. When new clusters are allocated to fill a hole or extend a file.

There are four possible ways srl can be merged. It can: - be inserted at the beginning of a hole, - split the hole in two and be inserted between the two fragments, - be appended at the end of a hole, or it can - replace the whole hole. It can also be appended to the end of the runlist, which is just a variant of the insert case.

On success, return a pointer to the new, combined, runlist. Note, both runlists drl and srl are deallocated before returning so you cannot use the pointers for anything any more. (Strictly speaking the returned runlist may be the same as dst but this is irrelevant.)

On error, return -errno. Both runlists are left unmodified. The following  

ERROR CODES ARE DEFINED

-ENOMEM - Not enough memory to allocate runlist array. -EINVAL - Invalid parameters were passed in. -ERANGE - The runlists overlap and cannot be merged.


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
MERGING OF RUNLISTS IS NECESSARY IN TWO CASES
ERROR CODES ARE DEFINED

This document was created by man2html, using the manual pages.
Time: 00:02:34 GMT, October 09, 2005