1*dc579d1dSchristos /* $NetBSD: prop_object_impl.h,v 1.8 2006/10/15 19:08:48 christos Exp $ */ 2774eb1a3Sthorpej 3774eb1a3Sthorpej /*- 4774eb1a3Sthorpej * Copyright (c) 2006 The NetBSD Foundation, Inc. 5774eb1a3Sthorpej * All rights reserved. 6774eb1a3Sthorpej * 7774eb1a3Sthorpej * This code is derived from software contributed to The NetBSD Foundation 8774eb1a3Sthorpej * by Jason R. Thorpe. 9774eb1a3Sthorpej * 10774eb1a3Sthorpej * Redistribution and use in source and binary forms, with or without 11774eb1a3Sthorpej * modification, are permitted provided that the following conditions 12774eb1a3Sthorpej * are met: 13774eb1a3Sthorpej * 1. Redistributions of source code must retain the above copyright 14774eb1a3Sthorpej * notice, this list of conditions and the following disclaimer. 15774eb1a3Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 16774eb1a3Sthorpej * notice, this list of conditions and the following disclaimer in the 17774eb1a3Sthorpej * documentation and/or other materials provided with the distribution. 18774eb1a3Sthorpej * 3. All advertising materials mentioning features or use of this software 19774eb1a3Sthorpej * must display the following acknowledgement: 20774eb1a3Sthorpej * This product includes software developed by the NetBSD 21774eb1a3Sthorpej * Foundation, Inc. and its contributors. 22774eb1a3Sthorpej * 4. Neither the name of The NetBSD Foundation nor the names of its 23774eb1a3Sthorpej * contributors may be used to endorse or promote products derived 24774eb1a3Sthorpej * from this software without specific prior written permission. 25774eb1a3Sthorpej * 26774eb1a3Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27774eb1a3Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28774eb1a3Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29774eb1a3Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30774eb1a3Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31774eb1a3Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32774eb1a3Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33774eb1a3Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34774eb1a3Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35774eb1a3Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36774eb1a3Sthorpej * POSSIBILITY OF SUCH DAMAGE. 37774eb1a3Sthorpej */ 38774eb1a3Sthorpej 39774eb1a3Sthorpej #ifndef _PROPLIB_PROP_OBJECT_IMPL_H_ 40774eb1a3Sthorpej #define _PROPLIB_PROP_OBJECT_IMPL_H_ 41774eb1a3Sthorpej 4225b42587Sthorpej #if defined(_KERNEL) || defined(_STANDALONE) 4325b42587Sthorpej #include <lib/libkern/libkern.h> 4425b42587Sthorpej #else 4525b42587Sthorpej #include <inttypes.h> 4625b42587Sthorpej #endif 4725b42587Sthorpej 48774eb1a3Sthorpej struct _prop_object_externalize_context { 49774eb1a3Sthorpej char * poec_buf; /* string buffer */ 50774eb1a3Sthorpej size_t poec_capacity; /* capacity of buffer */ 51774eb1a3Sthorpej size_t poec_len; /* current length of string */ 52774eb1a3Sthorpej unsigned int poec_depth; /* nesting depth */ 53774eb1a3Sthorpej }; 54774eb1a3Sthorpej 55774eb1a3Sthorpej boolean_t _prop_object_externalize_start_tag( 56774eb1a3Sthorpej struct _prop_object_externalize_context *, 57774eb1a3Sthorpej const char *); 58774eb1a3Sthorpej boolean_t _prop_object_externalize_end_tag( 59774eb1a3Sthorpej struct _prop_object_externalize_context *, 60774eb1a3Sthorpej const char *); 61774eb1a3Sthorpej boolean_t _prop_object_externalize_empty_tag( 62774eb1a3Sthorpej struct _prop_object_externalize_context *, 63774eb1a3Sthorpej const char *); 64774eb1a3Sthorpej boolean_t _prop_object_externalize_append_cstring( 65774eb1a3Sthorpej struct _prop_object_externalize_context *, 66774eb1a3Sthorpej const char *); 67774eb1a3Sthorpej boolean_t _prop_object_externalize_append_encoded_cstring( 68774eb1a3Sthorpej struct _prop_object_externalize_context *, 69774eb1a3Sthorpej const char *); 70774eb1a3Sthorpej boolean_t _prop_object_externalize_append_char( 71774eb1a3Sthorpej struct _prop_object_externalize_context *, 72774eb1a3Sthorpej unsigned char); 73d21620b2Sthorpej boolean_t _prop_object_externalize_header( 74d21620b2Sthorpej struct _prop_object_externalize_context *); 75d21620b2Sthorpej boolean_t _prop_object_externalize_footer( 76d21620b2Sthorpej struct _prop_object_externalize_context *); 77774eb1a3Sthorpej 78774eb1a3Sthorpej struct _prop_object_externalize_context * 79774eb1a3Sthorpej _prop_object_externalize_context_alloc(void); 80774eb1a3Sthorpej void _prop_object_externalize_context_free( 81774eb1a3Sthorpej struct _prop_object_externalize_context *); 82774eb1a3Sthorpej 83774eb1a3Sthorpej typedef enum { 84774eb1a3Sthorpej _PROP_TAG_TYPE_START, /* e.g. <dict> */ 85774eb1a3Sthorpej _PROP_TAG_TYPE_END, /* e.g. </dict> */ 86774eb1a3Sthorpej _PROP_TAG_TYPE_EITHER 87774eb1a3Sthorpej } _prop_tag_type_t; 88774eb1a3Sthorpej 89774eb1a3Sthorpej struct _prop_object_internalize_context { 90774eb1a3Sthorpej const char *poic_xml; 91774eb1a3Sthorpej const char *poic_cp; 92774eb1a3Sthorpej 93774eb1a3Sthorpej const char *poic_tag_start; 94774eb1a3Sthorpej 95774eb1a3Sthorpej const char *poic_tagname; 96774eb1a3Sthorpej size_t poic_tagname_len; 97774eb1a3Sthorpej const char *poic_tagattr; 98774eb1a3Sthorpej size_t poic_tagattr_len; 99774eb1a3Sthorpej const char *poic_tagattrval; 100774eb1a3Sthorpej size_t poic_tagattrval_len; 101774eb1a3Sthorpej 102774eb1a3Sthorpej boolean_t poic_is_empty_element; 103774eb1a3Sthorpej _prop_tag_type_t poic_tag_type; 104774eb1a3Sthorpej }; 105774eb1a3Sthorpej 106774eb1a3Sthorpej #define _PROP_EOF(c) ((c) == '\0') 107774eb1a3Sthorpej #define _PROP_ISSPACE(c) \ 108774eb1a3Sthorpej ((c) == ' ' || (c) == '\t' || (c) == '\n' || _PROP_EOF(c)) 109774eb1a3Sthorpej 110774eb1a3Sthorpej #define _PROP_TAG_MATCH(ctx, t) \ 111774eb1a3Sthorpej _prop_object_internalize_match((ctx)->poic_tagname, \ 112774eb1a3Sthorpej (ctx)->poic_tagname_len, \ 113774eb1a3Sthorpej (t), strlen(t)) 114774eb1a3Sthorpej 115774eb1a3Sthorpej #define _PROP_TAGATTR_MATCH(ctx, a) \ 116774eb1a3Sthorpej _prop_object_internalize_match((ctx)->poic_tagattr, \ 117774eb1a3Sthorpej (ctx)->poic_tagattr_len, \ 118774eb1a3Sthorpej (a), strlen(a)) 119774eb1a3Sthorpej 120774eb1a3Sthorpej #define _PROP_TAGATTRVAL_MATCH(ctx, a) \ 121774eb1a3Sthorpej _prop_object_internalize_match((ctx)->poic_tagattrval, \ 122774eb1a3Sthorpej (ctx)->poic_tagattrval_len,\ 123774eb1a3Sthorpej (a), strlen(a)) 124774eb1a3Sthorpej 125774eb1a3Sthorpej boolean_t _prop_object_internalize_find_tag( 126774eb1a3Sthorpej struct _prop_object_internalize_context *, 127774eb1a3Sthorpej const char *, _prop_tag_type_t); 128774eb1a3Sthorpej boolean_t _prop_object_internalize_match(const char *, size_t, 129774eb1a3Sthorpej const char *, size_t); 130774eb1a3Sthorpej prop_object_t _prop_object_internalize_by_tag( 131774eb1a3Sthorpej struct _prop_object_internalize_context *); 132774eb1a3Sthorpej boolean_t _prop_object_internalize_decode_string( 133774eb1a3Sthorpej struct _prop_object_internalize_context *, 134774eb1a3Sthorpej char *, size_t, size_t *, const char **); 135774eb1a3Sthorpej 136774eb1a3Sthorpej struct _prop_object_internalize_context * 137774eb1a3Sthorpej _prop_object_internalize_context_alloc(const char *); 138774eb1a3Sthorpej void _prop_object_internalize_context_free( 139774eb1a3Sthorpej struct _prop_object_internalize_context *); 140774eb1a3Sthorpej 141d21620b2Sthorpej #if !defined(_KERNEL) && !defined(_STANDALONE) 142d21620b2Sthorpej boolean_t _prop_object_externalize_write_file(const char *, 143d21620b2Sthorpej const char *, size_t); 144d21620b2Sthorpej 145d21620b2Sthorpej struct _prop_object_internalize_mapped_file { 146d21620b2Sthorpej char * poimf_xml; 147d21620b2Sthorpej size_t poimf_mapsize; 148d21620b2Sthorpej }; 149d21620b2Sthorpej 150d21620b2Sthorpej struct _prop_object_internalize_mapped_file * 151d21620b2Sthorpej _prop_object_internalize_map_file(const char *); 152d21620b2Sthorpej void _prop_object_internalize_unmap_file( 153d21620b2Sthorpej struct _prop_object_internalize_mapped_file *); 154d21620b2Sthorpej #endif /* !_KERNEL && !_STANDALONE */ 155d21620b2Sthorpej 156774eb1a3Sthorpej /* These are here because they're required by shared code. */ 157774eb1a3Sthorpej prop_object_t _prop_array_internalize( 158774eb1a3Sthorpej struct _prop_object_internalize_context *); 159774eb1a3Sthorpej prop_object_t _prop_bool_internalize( 160774eb1a3Sthorpej struct _prop_object_internalize_context *); 161774eb1a3Sthorpej prop_object_t _prop_data_internalize( 162774eb1a3Sthorpej struct _prop_object_internalize_context *); 163774eb1a3Sthorpej prop_object_t _prop_dictionary_internalize( 164774eb1a3Sthorpej struct _prop_object_internalize_context *); 165774eb1a3Sthorpej prop_object_t _prop_number_internalize( 166774eb1a3Sthorpej struct _prop_object_internalize_context *); 167774eb1a3Sthorpej prop_object_t _prop_string_internalize( 168774eb1a3Sthorpej struct _prop_object_internalize_context *); 169774eb1a3Sthorpej 1703e69f1b2Sthorpej struct _prop_object_type { 1713e69f1b2Sthorpej uint32_t pot_type; /* type indicator */ 1723e69f1b2Sthorpej void (*pot_free)(void *); /* func to free object */ 1733e69f1b2Sthorpej boolean_t (*pot_extern) /* func to externalize object */ 174774eb1a3Sthorpej (struct _prop_object_externalize_context *, 175774eb1a3Sthorpej void *); 1763e69f1b2Sthorpej boolean_t (*pot_equals) /* func to test quality */ 1773e69f1b2Sthorpej (void *, void *); 178774eb1a3Sthorpej }; 179774eb1a3Sthorpej 1803e69f1b2Sthorpej struct _prop_object { 1813e69f1b2Sthorpej const struct _prop_object_type *po_type;/* type descriptor */ 1823e69f1b2Sthorpej uint32_t po_refcnt; /* reference count */ 1833e69f1b2Sthorpej }; 1843e69f1b2Sthorpej 1853e69f1b2Sthorpej void _prop_object_init(struct _prop_object *, 1863e69f1b2Sthorpej const struct _prop_object_type *); 187774eb1a3Sthorpej void _prop_object_fini(struct _prop_object *); 188774eb1a3Sthorpej 189774eb1a3Sthorpej struct _prop_object_iterator { 190774eb1a3Sthorpej prop_object_t (*pi_next_object)(void *); 191774eb1a3Sthorpej void (*pi_reset)(void *); 192774eb1a3Sthorpej prop_object_t pi_obj; 193774eb1a3Sthorpej uint32_t pi_version; 194774eb1a3Sthorpej }; 195774eb1a3Sthorpej 196774eb1a3Sthorpej #if defined(_KERNEL) 197774eb1a3Sthorpej 198774eb1a3Sthorpej /* 199774eb1a3Sthorpej * proplib in the kernel... 200774eb1a3Sthorpej */ 201774eb1a3Sthorpej 202eb2acb85Sthorpej #include <sys/param.h> 203774eb1a3Sthorpej #include <sys/malloc.h> 204774eb1a3Sthorpej #include <sys/pool.h> 205774eb1a3Sthorpej #include <sys/systm.h> 206eff71884Sthorpej #include <sys/lock.h> 207774eb1a3Sthorpej 208774eb1a3Sthorpej #define _PROP_ASSERT(x) KASSERT(x) 209774eb1a3Sthorpej 210774eb1a3Sthorpej #define _PROP_MALLOC(s, t) malloc((s), (t), M_WAITOK) 211774eb1a3Sthorpej #define _PROP_CALLOC(s, t) malloc((s), (t), M_WAITOK | M_ZERO) 2123e69f1b2Sthorpej #define _PROP_REALLOC(v, s, t) realloc((v), (s), (t), M_WAITOK) 213774eb1a3Sthorpej #define _PROP_FREE(v, t) free((v), (t)) 214774eb1a3Sthorpej 215774eb1a3Sthorpej #define _PROP_POOL_GET(p) pool_get(&(p), PR_WAITOK) 216774eb1a3Sthorpej #define _PROP_POOL_PUT(p, v) pool_put(&(p), (v)) 217774eb1a3Sthorpej 218774eb1a3Sthorpej #define _PROP_POOL_INIT(p, s, d) \ 219774eb1a3Sthorpej POOL_INIT(p, s, 0, 0, 0, d, &pool_allocator_nointr); 220774eb1a3Sthorpej 221774eb1a3Sthorpej #define _PROP_MALLOC_DEFINE(t, s, l) \ 222774eb1a3Sthorpej MALLOC_DEFINE(t, s, l); 223774eb1a3Sthorpej 224eb2acb85Sthorpej #define _PROP_MUTEX_DECL_STATIC(x) \ 225eff71884Sthorpej static struct simplelock x = SIMPLELOCK_INITIALIZER; 226eff71884Sthorpej #define _PROP_MUTEX_LOCK(x) simple_lock(&(x)) 227eff71884Sthorpej #define _PROP_MUTEX_UNLOCK(x) simple_unlock(&(x)) 228eff71884Sthorpej 229eb2acb85Sthorpej #define _PROP_RWLOCK_DECL(x) struct lock x ; 230eb2acb85Sthorpej #define _PROP_RWLOCK_INIT(x) lockinit(&(x), PZERO, "proprwlk", 0, 0) 231eb2acb85Sthorpej #define _PROP_RWLOCK_RDLOCK(x) lockmgr(&(x), LK_SHARED, NULL) 232eb2acb85Sthorpej #define _PROP_RWLOCK_WRLOCK(x) lockmgr(&(x), LK_EXCLUSIVE, NULL) 233eb2acb85Sthorpej #define _PROP_RWLOCK_UNLOCK(x) lockmgr(&(x), LK_RELEASE, NULL) 234eb2acb85Sthorpej #define _PROP_RWLOCK_DESTROY(x) lockmgr(&(x), LK_DRAIN, NULL) 235eb2acb85Sthorpej 236774eb1a3Sthorpej #elif defined(_STANDALONE) 237774eb1a3Sthorpej 238774eb1a3Sthorpej /* 239774eb1a3Sthorpej * proplib in a standalone environment... 240774eb1a3Sthorpej */ 241774eb1a3Sthorpej 242774eb1a3Sthorpej #include <lib/libsa/stand.h> 243774eb1a3Sthorpej 244774eb1a3Sthorpej void * _prop_standalone_calloc(size_t); 2453e69f1b2Sthorpej void * _prop_standalone_realloc(void *, size_t); 246774eb1a3Sthorpej 247774eb1a3Sthorpej #define _PROP_ASSERT(x) /* nothing */ 248774eb1a3Sthorpej 249774eb1a3Sthorpej #define _PROP_MALLOC(s, t) alloc((s)) 250774eb1a3Sthorpej #define _PROP_CALLOC(s, t) _prop_standalone_calloc((s)) 2513e69f1b2Sthorpej #define _PROP_REALLOC(v, s, t) _prop_standalone_realloc((v), (s)) 252774eb1a3Sthorpej #define _PROP_FREE(v, t) dealloc((v), 0) /* XXX */ 253774eb1a3Sthorpej 254774eb1a3Sthorpej #define _PROP_POOL_GET(p) alloc((p)) 255774eb1a3Sthorpej #define _PROP_POOL_PUT(p, v) dealloc((v), (p)) 256774eb1a3Sthorpej 257774eb1a3Sthorpej #define _PROP_POOL_INIT(p, s, d) static const size_t p = s; 258774eb1a3Sthorpej 259774eb1a3Sthorpej #define _PROP_MALLOC_DEFINE(t, s, l) /* nothing */ 260774eb1a3Sthorpej 261eb2acb85Sthorpej #define _PROP_MUTEX_DECL_STATIC(x) /* nothing */ 262eff71884Sthorpej #define _PROP_MUTEX_LOCK(x) /* nothing */ 263eff71884Sthorpej #define _PROP_MUTEX_UNLOCK(x) /* nothing */ 264eff71884Sthorpej 265eb2acb85Sthorpej #define _PROP_RWLOCK_DECL(x) /* nothing */ 266eb2acb85Sthorpej #define _PROP_RWLOCK_INIT(x) /* nothing */ 267eb2acb85Sthorpej #define _PROP_RWLOCK_RDLOCK(x) /* nothing */ 268eb2acb85Sthorpej #define _PROP_RWLOCK_WRLOCK(x) /* nothing */ 269eb2acb85Sthorpej #define _PROP_RWLOCK_UNLOCK(x) /* nothing */ 270a8e91bcbSdbj #define _PROP_RWLOCK_DESTROY(x) /* nothing */ 271eb2acb85Sthorpej 272774eb1a3Sthorpej #else 273774eb1a3Sthorpej 274774eb1a3Sthorpej /* 275774eb1a3Sthorpej * proplib in user space... 276774eb1a3Sthorpej */ 277774eb1a3Sthorpej 278774eb1a3Sthorpej #include <assert.h> 279774eb1a3Sthorpej #include <string.h> 280774eb1a3Sthorpej #include <stdio.h> 281774eb1a3Sthorpej #include <stdlib.h> 28225b42587Sthorpej #include <stddef.h> 283774eb1a3Sthorpej 284*dc579d1dSchristos #define _PROP_ASSERT(x) /*LINTED*/assert(x) 285774eb1a3Sthorpej 286774eb1a3Sthorpej #define _PROP_MALLOC(s, t) malloc((s)) 287774eb1a3Sthorpej #define _PROP_CALLOC(s, t) calloc(1, (s)) 2883e69f1b2Sthorpej #define _PROP_REALLOC(v, s, t) realloc((v), (s)) 289774eb1a3Sthorpej #define _PROP_FREE(v, t) free((v)) 290774eb1a3Sthorpej 291774eb1a3Sthorpej #define _PROP_POOL_GET(p) malloc((p)) 292774eb1a3Sthorpej #define _PROP_POOL_PUT(p, v) free((v)) 293774eb1a3Sthorpej 294774eb1a3Sthorpej #define _PROP_POOL_INIT(p, s, d) static const size_t p = s; 295774eb1a3Sthorpej 296774eb1a3Sthorpej #define _PROP_MALLOC_DEFINE(t, s, l) /* nothing */ 297774eb1a3Sthorpej 298eff71884Sthorpej #if defined(__NetBSD__) && defined(_LIBPROP) 299eff71884Sthorpej /* 300eff71884Sthorpej * Use the same mechanism as libc; we get pthread mutexes for threaded 301eff71884Sthorpej * programs and do-nothing stubs for non-threaded programs. 302eff71884Sthorpej */ 303eff71884Sthorpej #include "reentrant.h" 304eb2acb85Sthorpej #define _PROP_MUTEX_DECL_STATIC(x) static mutex_t x = MUTEX_INITIALIZER; 305eff71884Sthorpej #define _PROP_MUTEX_LOCK(x) mutex_lock(&(x)) 306eff71884Sthorpej #define _PROP_MUTEX_UNLOCK(x) mutex_unlock(&(x)) 307eb2acb85Sthorpej 308eb2acb85Sthorpej #define _PROP_RWLOCK_DECL(x) rwlock_t x ; 309eb2acb85Sthorpej #define _PROP_RWLOCK_INIT(x) rwlock_init(&(x), NULL) 310eb2acb85Sthorpej #define _PROP_RWLOCK_RDLOCK(x) rwlock_rdlock(&(x)) 311eb2acb85Sthorpej #define _PROP_RWLOCK_WRLOCK(x) rwlock_wrlock(&(x)) 312eb2acb85Sthorpej #define _PROP_RWLOCK_UNLOCK(x) rwlock_unlock(&(x)) 313eb2acb85Sthorpej #define _PROP_RWLOCK_DESTROY(x) rwlock_destroy(&(x)) 314eff71884Sthorpej #elif defined(HAVE_NBTOOL_CONFIG_H) 315eff71884Sthorpej /* 316eff71884Sthorpej * None of NetBSD's build tools are multi-threaded. 317eff71884Sthorpej */ 318eb2acb85Sthorpej #define _PROP_MUTEX_DECL_STATIC(x) /* nothing */ 319eff71884Sthorpej #define _PROP_MUTEX_LOCK(x) /* nothing */ 320eff71884Sthorpej #define _PROP_MUTEX_UNLOCK(x) /* nothing */ 321eb2acb85Sthorpej 322eb2acb85Sthorpej #define _PROP_RWLOCK_DECL(x) /* nothing */ 323eb2acb85Sthorpej #define _PROP_RWLOCK_INIT(x) /* nothing */ 324eb2acb85Sthorpej #define _PROP_RWLOCK_RDLOCK(x) /* nothing */ 325eb2acb85Sthorpej #define _PROP_RWLOCK_WRLOCK(x) /* nothing */ 326eb2acb85Sthorpej #define _PROP_RWLOCK_UNLOCK(x) /* nothing */ 327eb2acb85Sthorpej #define _PROP_RWLOCK_DESTROY(x) /* nothing */ 328eff71884Sthorpej #else 329eff71884Sthorpej /* 330eff71884Sthorpej * Use pthread mutexes everywhere else. 331eff71884Sthorpej */ 332eff71884Sthorpej #include <pthread.h> 333eb2acb85Sthorpej #define _PROP_MUTEX_DECL_STATIC(x) \ 334eff71884Sthorpej static pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; 335eff71884Sthorpej #define _PROP_MUTEX_LOCK(x) pthread_mutex_lock(&(x)) 336eff71884Sthorpej #define _PROP_MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x)) 337eb2acb85Sthorpej 338eb2acb85Sthorpej #define _PROP_RWLOCK_DECL(x) pthread_rwlock_t x ; 339eb2acb85Sthorpej #define _PROP_RWLOCK_INIT(x) pthread_rwlock_init(&(x), NULL) 340eb2acb85Sthorpej #define _PROP_RWLOCK_RDLOCK(x) pthread_rwlock_rdlock(&(x)) 341eb2acb85Sthorpej #define _PROP_RWLOCK_WRLOCK(x) pthread_rwlock_wrlock(&(x)) 342eb2acb85Sthorpej #define _PROP_RWLOCK_UNLOCK(x) pthread_rwlock_unlock(&(x)) 343eb2acb85Sthorpej #define _PROP_RWLOCK_DESTROY(x) pthread_rwlock_destroy(&(x)) 344eff71884Sthorpej #endif 345eff71884Sthorpej 346774eb1a3Sthorpej #endif /* _KERNEL */ 347774eb1a3Sthorpej 348774eb1a3Sthorpej #endif /* _PROPLIB_PROP_OBJECT_IMPL_H_ */ 349