runlist_element * ntfs_attr_find_vcn_nolock (ntfs_inode * ni, const VCN vcn, const BOOL write_locked);
Find the virtual cluster number vcn in the runlist described by the ntfs inode ni and return the address of the runlist element containing the vcn.
If the vcn is not mapped yet, the attempt is made to map the attribute extent containing the vcn and the vcn to lcn conversion is retried.
If write_locked is true the caller has locked the runlist for writing and if false for reading.
Note you need to distinguish between the lcn of the returned runlist element being >= 0 and LCN_HOLE. In the later case you have to return zeroes on read and allocate clusters on write.
Return the runlist element containing the vcn on success and ERR_PTR(-errno) on error. You need to test the return value with IS_ERR to decide if the return is success or failure and PTR_ERR to get to the error code if IS_ERR is true.
-ENOENT - No such vcn in the runlist, i.e. vcn is out of bounds. -ENOMEM - Not enough memory to map runlist. -EIO - Critical error (runlist/file is corrupt, i/o error, etc).
- The runlist must be locked on entry and is left locked on return. - If write_locked is FALSE, i.e. the runlist is locked for reading, the lock may be dropped inside the function so you cannot rely on the runlist still being the same when this function returns.