]> git.saurik.com Git - apple/xnu.git/blame - bsd/hfs/rangelist.h
xnu-792.25.20.tar.gz
[apple/xnu.git] / bsd / hfs / rangelist.h
CommitLineData
1c79356b 1/*
0b4e3aa0 2 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
6601e61a 4 * @APPLE_LICENSE_HEADER_START@
1c79356b 5 *
6601e61a
A
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.
8f6c56a5 11 *
6601e61a
A
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
8f6c56a5
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
6601e61a
A
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.
8f6c56a5 19 *
6601e61a 20 * @APPLE_LICENSE_HEADER_END@
1c79356b 21 */
9bccf70c
A
22#ifndef _HFS_RANGELIST_H_
23#define _HFS_RANGELIST_H_
1c79356b 24
9bccf70c
A
25#include <sys/appleapiopts.h>
26
27#ifdef KERNEL
28#ifdef __APPLE_API_PRIVATE
0b4e3aa0
A
29#include <sys/types.h>
30#include <sys/queue.h>
1c79356b 31
0b4e3aa0
A
32enum rl_overlaptype {
33 RL_NOOVERLAP = 0, /* 0 */
34 RL_MATCHINGOVERLAP, /* 1 */
35 RL_OVERLAPCONTAINSRANGE, /* 2 */
36 RL_OVERLAPISCONTAINED, /* 3 */
37 RL_OVERLAPSTARTSBEFORE, /* 4 */
38 RL_OVERLAPENDSAFTER /* 5 */
1c79356b 39};
1c79356b 40
0b4e3aa0 41#define RL_INFINITY ((off_t)-1)
1c79356b 42
0b4e3aa0 43CIRCLEQ_HEAD(rl_head, rl_entry);
1c79356b 44
0b4e3aa0
A
45struct rl_entry {
46 CIRCLEQ_ENTRY(rl_entry) rl_link;
47 off_t rl_start;
48 off_t rl_end;
49};
1c79356b 50
0b4e3aa0
A
51__BEGIN_DECLS
52void rl_init(struct rl_head *rangelist);
53void rl_add(off_t start, off_t end, struct rl_head *rangelist);
54void rl_remove(off_t start, off_t end, struct rl_head *rangelist);
55enum rl_overlaptype rl_scan(struct rl_head *rangelist,
56 off_t start,
57 off_t end,
58 struct rl_entry **overlap);
59__END_DECLS
9bccf70c
A
60
61#endif /* __APPLE_API_PRIVATE */
62#endif /* KERNEL */
63#endif /* ! _HFS_RANGELIST_H_ */