1*be89757eSLionel Sambuc /* $NetBSD: prop_object.h,v 1.8 2008/12/05 13:11:41 ad Exp $ */ 2*be89757eSLionel Sambuc 3*be89757eSLionel Sambuc /*- 4*be89757eSLionel Sambuc * Copyright (c) 2006 The NetBSD Foundation, Inc. 5*be89757eSLionel Sambuc * All rights reserved. 6*be89757eSLionel Sambuc * 7*be89757eSLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 8*be89757eSLionel Sambuc * by Jason R. Thorpe. 9*be89757eSLionel Sambuc * 10*be89757eSLionel Sambuc * Redistribution and use in source and binary forms, with or without 11*be89757eSLionel Sambuc * modification, are permitted provided that the following conditions 12*be89757eSLionel Sambuc * are met: 13*be89757eSLionel Sambuc * 1. Redistributions of source code must retain the above copyright 14*be89757eSLionel Sambuc * notice, this list of conditions and the following disclaimer. 15*be89757eSLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 16*be89757eSLionel Sambuc * notice, this list of conditions and the following disclaimer in the 17*be89757eSLionel Sambuc * documentation and/or other materials provided with the distribution. 18*be89757eSLionel Sambuc * 19*be89757eSLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*be89757eSLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*be89757eSLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*be89757eSLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*be89757eSLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*be89757eSLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*be89757eSLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*be89757eSLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*be89757eSLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*be89757eSLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*be89757eSLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 30*be89757eSLionel Sambuc */ 31*be89757eSLionel Sambuc 32*be89757eSLionel Sambuc #ifndef _PROPLIB_PROP_OBJECT_H_ 33*be89757eSLionel Sambuc #define _PROPLIB_PROP_OBJECT_H_ 34*be89757eSLionel Sambuc 35*be89757eSLionel Sambuc #include <sys/types.h> 36*be89757eSLionel Sambuc 37*be89757eSLionel Sambuc #if !defined(_KERNEL) && !defined(_STANDALONE) 38*be89757eSLionel Sambuc #include <stdbool.h> 39*be89757eSLionel Sambuc #endif /* ! _KERNEL && ! _STANDALONE */ 40*be89757eSLionel Sambuc 41*be89757eSLionel Sambuc typedef void *prop_object_t; 42*be89757eSLionel Sambuc 43*be89757eSLionel Sambuc typedef enum { 44*be89757eSLionel Sambuc PROP_TYPE_UNKNOWN = 0x00000000, 45*be89757eSLionel Sambuc #ifndef _PROPLIB_ZFS_CONFLICT 46*be89757eSLionel Sambuc PROP_TYPE_BOOL = 0x626f6f6c, /* 'bool' */ 47*be89757eSLionel Sambuc PROP_TYPE_NUMBER = 0x6e6d6272, /* 'nmbr' */ 48*be89757eSLionel Sambuc PROP_TYPE_STRING = 0x73746e67, /* 'stng' */ 49*be89757eSLionel Sambuc PROP_TYPE_DATA = 0x64617461, /* 'data' */ 50*be89757eSLionel Sambuc PROP_TYPE_ARRAY = 0x61726179, /* 'aray' */ 51*be89757eSLionel Sambuc PROP_TYPE_DICTIONARY = 0x64696374, /* 'dict' */ 52*be89757eSLionel Sambuc PROP_TYPE_DICT_KEYSYM = 0x646b6579 /* 'dkey' */ 53*be89757eSLionel Sambuc #endif /* !_PROPLIB_ZFS_CONFLICT */ 54*be89757eSLionel Sambuc } prop_type_t; 55*be89757eSLionel Sambuc 56*be89757eSLionel Sambuc __BEGIN_DECLS 57*be89757eSLionel Sambuc void prop_object_retain(prop_object_t); 58*be89757eSLionel Sambuc void prop_object_release(prop_object_t); 59*be89757eSLionel Sambuc 60*be89757eSLionel Sambuc prop_type_t prop_object_type(prop_object_t); 61*be89757eSLionel Sambuc 62*be89757eSLionel Sambuc bool prop_object_equals(prop_object_t, prop_object_t); 63*be89757eSLionel Sambuc bool prop_object_equals_with_error(prop_object_t, prop_object_t, bool *); 64*be89757eSLionel Sambuc 65*be89757eSLionel Sambuc typedef struct _prop_object_iterator *prop_object_iterator_t; 66*be89757eSLionel Sambuc 67*be89757eSLionel Sambuc prop_object_t prop_object_iterator_next(prop_object_iterator_t); 68*be89757eSLionel Sambuc void prop_object_iterator_reset(prop_object_iterator_t); 69*be89757eSLionel Sambuc void prop_object_iterator_release(prop_object_iterator_t); 70*be89757eSLionel Sambuc __END_DECLS 71*be89757eSLionel Sambuc 72*be89757eSLionel Sambuc #endif /* _PROPLIB_PROP_OBJECT_H_ */ 73