]> git.saurik.com Git - apple/xnu.git/blob - bsd/hfs/rangelist.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / hfs / rangelist.h
1 /*
2 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #include <sys/types.h>
24 #include <sys/queue.h>
25
26 enum rl_overlaptype {
27 RL_NOOVERLAP = 0, /* 0 */
28 RL_MATCHINGOVERLAP, /* 1 */
29 RL_OVERLAPCONTAINSRANGE, /* 2 */
30 RL_OVERLAPISCONTAINED, /* 3 */
31 RL_OVERLAPSTARTSBEFORE, /* 4 */
32 RL_OVERLAPENDSAFTER /* 5 */
33 };
34
35 #define RL_INFINITY ((off_t)-1)
36
37 CIRCLEQ_HEAD(rl_head, rl_entry);
38
39 struct rl_entry {
40 CIRCLEQ_ENTRY(rl_entry) rl_link;
41 off_t rl_start;
42 off_t rl_end;
43 };
44
45 __BEGIN_DECLS
46 void rl_init(struct rl_head *rangelist);
47 void rl_add(off_t start, off_t end, struct rl_head *rangelist);
48 void rl_remove(off_t start, off_t end, struct rl_head *rangelist);
49 enum rl_overlaptype rl_scan(struct rl_head *rangelist,
50 off_t start,
51 off_t end,
52 struct rl_entry **overlap);
53 __END_DECLS