]> git.saurik.com Git - apple/hfs.git/blame_incremental - livefiles_hfs_plugin/lf_hfs_rangelist.h
hfs-522.100.5.tar.gz
[apple/hfs.git] / livefiles_hfs_plugin / lf_hfs_rangelist.h
... / ...
CommitLineData
1/* Copyright © 2017-2018 Apple Inc. All rights reserved.
2 *
3 * lf_hfs_rangelist.h
4 * livefiles_hfs
5 *
6 * Created by Yakov Ben Zaken on 19/03/2018.
7 */
8
9#ifndef lf_hfs_rangelist_h
10#define lf_hfs_rangelist_h
11
12#include <stdio.h>
13#include <sys/queue.h>
14
15TAILQ_HEAD(rl_head, rl_entry);
16
17struct rl_entry {
18 TAILQ_ENTRY(rl_entry) rl_link;
19 off_t rl_start;
20 off_t rl_end;
21};
22
23enum rl_overlaptype {
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 */
30};
31
32#define RL_INFINITY INT64_MAX
33
34void rl_init(struct rl_head *rangelist);
35enum rl_overlaptype rl_overlap(const struct rl_entry *range, off_t start, off_t end);
36void rl_remove(off_t start, off_t end, struct rl_head *rangelist);
37off_t rl_len(const struct rl_entry *range);
38void rl_remove_all(struct rl_head *rangelist);
39enum rl_overlaptype rl_scan(struct rl_head *rangelist, off_t start, off_t end, struct rl_entry **overlap);
40void rl_add(off_t start, off_t end, struct rl_head *rangelist);
41void rl_subtract(struct rl_entry *a, const struct rl_entry *b);
42struct rl_entry rl_make(off_t start, off_t end);
43
44#endif /* lf_hfs_rangelist_h */