xref: /netbsd/sbin/gpt/map.h (revision 5c1ef4f7)
1 /*	$NetBSD: map.h,v 1.7 2019/06/30 11:38:16 sevan Exp $	*/
2 
3 /*-
4  * Copyright (c) 2002 Marcel Moolenaar
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sbin/gpt/map.h,v 1.6 2005/08/31 01:47:19 marcel Exp $
29  */
30 
31 #ifndef _MAP_H_
32 #define	_MAP_H_
33 
34 struct map {
35 	off_t	map_start;
36 	off_t	map_size;
37 	struct map *map_next;
38 	struct map *map_prev;
39 	int	map_type;
40 #define	MAP_TYPE_UNUSED		0
41 #define	MAP_TYPE_MBR		1
42 #define	MAP_TYPE_MBR_PART	2
43 #define	MAP_TYPE_PRI_GPT_HDR	3
44 #define	MAP_TYPE_SEC_GPT_HDR	4
45 #define	MAP_TYPE_PRI_GPT_TBL	5
46 #define	MAP_TYPE_SEC_GPT_TBL	6
47 #define	MAP_TYPE_GPT_PART	7
48 #define	MAP_TYPE_PMBR		8
49 	unsigned int map_index;
50 	void 	*map_data;
51 	int	map_alloc;
52 };
53 
54 struct gpt;
55 
56 struct map *map_add(struct gpt *, off_t, off_t, int, void *, int);
57 struct map *map_alloc(struct gpt *, off_t, off_t, off_t);
58 struct map *map_find(struct gpt *, int);
59 struct map *map_first(struct gpt *);
60 struct map *map_last(struct gpt *);
61 off_t map_resize(struct gpt *, struct map *, off_t, off_t);
62 off_t map_free(struct gpt *, off_t, off_t);
63 int map_init(struct gpt *, off_t);
64 
65 #endif /* _MAP_H_ */
66