]>
git.saurik.com Git - apple/hfs.git/blob - livefiles_hfs_plugin/lf_hfs_rangelist.h
1 /* Copyright © 2017-2018 Apple Inc. All rights reserved.
6 * Created by Yakov Ben Zaken on 19/03/2018.
9 #ifndef lf_hfs_rangelist_h
10 #define lf_hfs_rangelist_h
13 #include <sys/queue.h>
15 TAILQ_HEAD(rl_head
, rl_entry
);
18 TAILQ_ENTRY(rl_entry
) rl_link
;
24 RL_NOOVERLAP
= 0, /* 0 */
25 RL_MATCHINGOVERLAP
, /* 1 */
26 RL_OVERLAPCONTAINSRANGE
, /* 2 */
27 RL_OVERLAPISCONTAINED
, /* 3 */
28 RL_OVERLAPSTARTSBEFORE
, /* 4 */
29 RL_OVERLAPENDSAFTER
/* 5 */
32 #define RL_INFINITY INT64_MAX
34 void rl_init(struct rl_head
*rangelist
);
35 enum rl_overlaptype
rl_overlap(const struct rl_entry
*range
, off_t start
, off_t end
);
36 void rl_remove(off_t start
, off_t end
, struct rl_head
*rangelist
);
37 off_t
rl_len(const struct rl_entry
*range
);
38 void rl_remove_all(struct rl_head
*rangelist
);
39 enum rl_overlaptype
rl_scan(struct rl_head
*rangelist
, off_t start
, off_t end
, struct rl_entry
**overlap
);
40 void rl_add(off_t start
, off_t end
, struct rl_head
*rangelist
);
41 void rl_subtract(struct rl_entry
*a
, const struct rl_entry
*b
);
42 struct rl_entry
rl_make(off_t start
, off_t end
);
44 #endif /* lf_hfs_rangelist_h */