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