aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/rlist.h
blob: cf86c8a84cb4d1d0cfbfc11bca1f6d425187c7da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (c) 1992 William Jolitz. All rights reserved.
 * Written by William Jolitz 1/92
 *
 * Redistribution and use in source and binary forms are freely permitted
 * provided that the above copyright notice and attribution and date of work
 * and this paragraph are duplicated in all such forms.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Resource lists.
 *
 *	Usage:
 *		rlist_free(&swapmap, 100, 200);	add space to swapmap
 *		rlist_alloc(&swapmap, 100, &loc); obtain 100 sectors from swap
 *
 *	from: unknown?
 *	$Id: rlist.h,v 1.8 1996/01/30 23:01:12 mpp Exp $
 */

#ifndef _SYS_RLIST_H_
#define _SYS_RLIST_H_

/* A resource list element. */
struct rlist {
	unsigned	rl_start;	/* boundaries of extent - inclusive */
	unsigned	rl_end;		/* boundaries of extent - inclusive */
	struct rlist	*rl_next;	/* next list entry, if present */
};

struct rlisthdr {
	int		rlh_lock;		/* list lock */
	struct		rlist *rlh_list;	/* list itself */
};

#define	RLH_DESIRED 	0x2
#define RLH_LOCKED 	0x1

/* extern struct rlisthdr swaplist; */

/* Functions to manipulate resource lists.  */
extern void rlist_free __P((struct rlisthdr *, unsigned, unsigned));
int rlist_alloc __P((struct rlisthdr *, unsigned, unsigned *));
extern void rlist_destroy __P((struct rlisthdr *));

#endif	/* _SYS_RLIST_H_ */