Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | runlist_element |
struct | runlist |
Enumerations | |
enum | LCN_SPECIAL_VALUES { LCN_HOLE = -1, LCN_RL_NOT_MAPPED = -2, LCN_ENOENT = -3, LCN_ENOMEM = -4, LCN_EIO = -5 } |
Functions | |
runlist_element * | ntfs_runlists_merge (runlist_element *drl, runlist_element *srl) |
runlist_element * | ntfs_mapping_pairs_decompress (const ntfs_volume *vol, const ATTR_RECORD *attr, runlist_element *old_rl) |
LCN | ntfs_rl_vcn_to_lcn (const runlist_element *rl, const VCN vcn) |
enum LCN_SPECIAL_VALUES |
runlist_element* ntfs_mapping_pairs_decompress | ( | const ntfs_volume * | vol, |
const ATTR_RECORD * | attr, | ||
runlist_element * | old_rl | ||
) |
ntfs_mapping_pairs_decompress - convert mapping pairs array to runlist : ntfs volume on which the attribute resides : attribute record whose mapping pairs array to decompress : optional runlist in which to insert 's runlist
It is up to the caller to serialize access to the runlist .
Decompress the attribute 's mapping pairs array into a runlist. On success, return the decompressed runlist.
If is not NULL, decompressed runlist is inserted into the appropriate place in and the resultant, combined runlist is returned. The original is deallocated.
On error, return -errno. is left unmodified in that case.
The following error codes are defined: -ENOMEM - Not enough memory to allocate runlist array. -EIO - Corrupt runlist. -EINVAL - Invalid parameters were passed in. -ERANGE - The two runlists overlap.
FIXME: For now we take the conceptionally simplest approach of creating the new runlist disregarding the already existing one and then splicing the two into one, if that is possible (we check for overlap and discard the new runlist if overlap present before returning ERR_PTR(-ERANGE)).
LCN ntfs_rl_vcn_to_lcn | ( | const runlist_element * | rl, |
const VCN | vcn | ||
) |
ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist : runlist to use for conversion : vcn to convert
Convert the virtual cluster number of an attribute into a logical cluster number (lcn) of a device using the runlist to map vcns to their corresponding lcns.
It is up to the caller to serialize access to the runlist .
Since lcns must be >= 0, we use negative return codes with special meaning:
LCN_HOLE Hole / not allocated on disk. LCN_RL_NOT_MAPPED This is part of the runlist which has not been inserted into the runlist yet. LCN_ENOENT There is no such vcn in the attribute.
Locking: - The caller must have locked the runlist (for reading or writing).
runlist_element* ntfs_runlists_merge | ( | runlist_element * | drl, |
runlist_element * | srl | ||
) |
ntfs_runlists_merge - merge two runlists into one : original runlist to be worked on : new runlist to be merged into
First we sanity check the two runlists and to make sure that they are sensible and can be merged. The runlist must be either after the runlist or completely within a hole (or unmapped region) in .
It is up to the caller to serialize access to the runlists and .
Merging of runlists is necessary in two cases:
There are four possible ways can be merged. It can:
On success, return a pointer to the new, combined, runlist. Note, both runlists and are deallocated before returning so you cannot use the pointers for anything any more. (Strictly speaking the returned runlist may be the same as 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.