1 /* $OpenBSD: mdesc.h,v 1.2 2009/05/10 12:37:01 kettenis Exp $ */ 2 /* 3 * Copyright (c) 2009 Mark Kettenis 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 struct md_header { 19 uint32_t transport_version; 20 uint32_t node_blk_sz; 21 uint32_t name_blk_sz; 22 uint32_t data_blk_sz; 23 }; 24 25 struct md_element { 26 uint8_t tag; 27 uint8_t name_len; 28 uint16_t _reserved_field; 29 uint32_t name_offset; 30 union { 31 struct { 32 uint32_t data_len; 33 uint32_t data_offset; 34 } y; 35 uint64_t val; 36 } d; 37 }; 38 39 #ifdef _KERNEL 40 extern caddr_t mdesc; 41 extern size_t mdesc_len; 42 43 void mdesc_init(void); 44 uint64_t mdesc_get_prop_val(int, const char *); 45 const char * mdesc_get_prop_str(int, const char *); 46 int mdesc_find(const char *, uint64_t); 47 int mdesc_find_child(int, const char *, uint64_t); 48 #endif 49