0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_NTFS_RUNLIST_H
0011 #define _LINUX_NTFS_RUNLIST_H
0012
0013 #include "types.h"
0014 #include "layout.h"
0015 #include "volume.h"
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 typedef struct {
0029 VCN vcn;
0030 LCN lcn;
0031 s64 length;
0032 } runlist_element;
0033
0034
0035
0036
0037
0038
0039
0040 typedef struct {
0041 runlist_element *rl;
0042 struct rw_semaphore lock;
0043 } runlist;
0044
0045 static inline void ntfs_init_runlist(runlist *rl)
0046 {
0047 rl->rl = NULL;
0048 init_rwsem(&rl->lock);
0049 }
0050
0051 typedef enum {
0052 LCN_HOLE = -1,
0053 LCN_RL_NOT_MAPPED = -2,
0054 LCN_ENOENT = -3,
0055 LCN_ENOMEM = -4,
0056 LCN_EIO = -5,
0057 } LCN_SPECIAL_VALUES;
0058
0059 extern runlist_element *ntfs_runlists_merge(runlist_element *drl,
0060 runlist_element *srl);
0061
0062 extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
0063 const ATTR_RECORD *attr, runlist_element *old_rl);
0064
0065 extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
0066
0067 #ifdef NTFS_RW
0068
0069 extern runlist_element *ntfs_rl_find_vcn_nolock(runlist_element *rl,
0070 const VCN vcn);
0071
0072 extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
0073 const runlist_element *rl, const VCN first_vcn,
0074 const VCN last_vcn);
0075
0076 extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
0077 const int dst_len, const runlist_element *rl,
0078 const VCN first_vcn, const VCN last_vcn, VCN *const stop_vcn);
0079
0080 extern int ntfs_rl_truncate_nolock(const ntfs_volume *vol,
0081 runlist *const runlist, const s64 new_length);
0082
0083 int ntfs_rl_punch_nolock(const ntfs_volume *vol, runlist *const runlist,
0084 const VCN start, const s64 length);
0085
0086 #endif
0087
0088 #endif