xref: /netbsd-src/common/lib/libppath/ppath_object.3 (revision aa4b308c77cf1961c3a33de274eb53bc123ac329)
1*aa4b308cSwiz.\"	$NetBSD: ppath_object.3,v 1.4 2017/10/23 00:59:44 wiz Exp $
233ce21e2Sdyoung.\"
333ce21e2Sdyoung.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
433ce21e2Sdyoung.\" All rights reserved.
533ce21e2Sdyoung.\"
633ce21e2Sdyoung.\" This code is derived from software contributed to The NetBSD Foundation
733ce21e2Sdyoung.\" by David Young <dyoung@NetBSD.org>.
833ce21e2Sdyoung.\"
933ce21e2Sdyoung.\" Redistribution and use in source and binary forms, with or without
1033ce21e2Sdyoung.\" modification, are permitted provided that the following conditions
1133ce21e2Sdyoung.\" are met:
1233ce21e2Sdyoung.\" 1. Redistributions of source code must retain the above copyright
1333ce21e2Sdyoung.\"    notice, this list of conditions and the following disclaimer.
1433ce21e2Sdyoung.\" 2. Redistributions in binary form must reproduce the above copyright
1533ce21e2Sdyoung.\"    notice, this list of conditions and the following disclaimer in the
1633ce21e2Sdyoung.\"    documentation and/or other materials provided with the distribution.
1733ce21e2Sdyoung.\"
1833ce21e2Sdyoung.\" THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY EXPRESS
1933ce21e2Sdyoung.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2033ce21e2Sdyoung.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2133ce21e2Sdyoung.\" ARE DISCLAIMED.  IN NO EVENT SHALL David Young BE LIABLE FOR ANY
2233ce21e2Sdyoung.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2333ce21e2Sdyoung.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2433ce21e2Sdyoung.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2533ce21e2Sdyoung.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2633ce21e2Sdyoung.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2733ce21e2Sdyoung.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2833ce21e2Sdyoung.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2933ce21e2Sdyoung.\"
3033ce21e2Sdyoung.Dd August 24, 2011
31b6947e90Swiz.Dt PPATH_OBJECT 3
3233ce21e2Sdyoung.Os
3333ce21e2Sdyoung.Sh NAME
3433ce21e2Sdyoung.Nm ppath_object ,
3533ce21e2Sdyoung.\" ,
3633ce21e2Sdyoung.Nm ppath_copydel_object ,
3733ce21e2Sdyoung.Nm ppath_copyset_object ,
3833ce21e2Sdyoung.Nm ppath_set_object ,
3933ce21e2Sdyoung.Nm ppath_get_object ,
4033ce21e2Sdyoung.Nm ppath_delete_object ,
4133ce21e2Sdyoung.\" ,
4233ce21e2Sdyoung.Nm ppath_copydel_data ,
4333ce21e2Sdyoung.Nm ppath_copyset_data ,
4433ce21e2Sdyoung.Nm ppath_set_data ,
4533ce21e2Sdyoung.Nm ppath_get_data ,
4633ce21e2Sdyoung.Nm ppath_dup_data ,
4733ce21e2Sdyoung.Nm ppath_delete_data ,
4833ce21e2Sdyoung.\" ,
4933ce21e2Sdyoung.Nm ppath_copydel_string ,
5033ce21e2Sdyoung.Nm ppath_copyset_string ,
5133ce21e2Sdyoung.Nm ppath_set_string ,
5233ce21e2Sdyoung.Nm ppath_get_string ,
5333ce21e2Sdyoung.Nm ppath_dup_string ,
5433ce21e2Sdyoung.Nm ppath_delete_string
5533ce21e2Sdyoung.Nd property object path operations
5633ce21e2Sdyoung.Sh LIBRARY
5733ce21e2Sdyoung.Lb libppath
5833ce21e2Sdyoung.Sh SYNOPSIS
5933ce21e2Sdyoung.In ppath/ppath.h
6033ce21e2Sdyoung.\"
6133ce21e2Sdyoung.Ft int
6233ce21e2Sdyoung.Fn ppath_copydel_object "prop_object_t" "prop_object_t *" "const ppath_t *"
6333ce21e2Sdyoung.Ft int
6433ce21e2Sdyoung.Fn ppath_copyset_object "prop_object_t" "prop_object_t *" "const ppath_t *" \
6533ce21e2Sdyoung    "prop_object_t"
6633ce21e2Sdyoung.Ft int
6733ce21e2Sdyoung.Fn ppath_set_object "prop_object_t" "const ppath_t *" "prop_object_t"
6833ce21e2Sdyoung.Ft int
6933ce21e2Sdyoung.Fn ppath_get_object "prop_object_t" "const ppath_t *" "prop_object_t *"
7033ce21e2Sdyoung.Ft int
7133ce21e2Sdyoung.Fn ppath_delete_object "prop_object_t" "const ppath_t *"
7233ce21e2Sdyoung.\"
7333ce21e2Sdyoung.Ft int
7433ce21e2Sdyoung.Fn ppath_copydel_data "prop_object_t" "prop_object_t *" "const ppath_t *"
7533ce21e2Sdyoung.Ft int
7633ce21e2Sdyoung.Fn ppath_copyset_data "prop_object_t" "prop_object_t *" "const ppath_t *" \
7733ce21e2Sdyoung    "const void *" "size_t"
7833ce21e2Sdyoung.Ft int
7933ce21e2Sdyoung.Fn ppath_set_data "prop_object_t" "const ppath_t *" "const void *" "size_t"
8033ce21e2Sdyoung.Ft int
8133ce21e2Sdyoung.Fn ppath_get_data "prop_object_t" "const ppath_t *" "const void **" "size_t *"
8233ce21e2Sdyoung.Ft int
8333ce21e2Sdyoung.Fn ppath_dup_data "prop_object_t" "const ppath_t *" "void **" "size_t *"
8433ce21e2Sdyoung.Ft int
8533ce21e2Sdyoung.Fn ppath_delete_data "prop_object_t" "const ppath_t *"
8633ce21e2Sdyoung.\"
8733ce21e2Sdyoung.Ft int
8833ce21e2Sdyoung.Fn ppath_copydel_string "prop_object_t" "prop_object_t *" "const ppath_t *"
8933ce21e2Sdyoung.Ft int
9033ce21e2Sdyoung.Fn ppath_copyset_string "prop_object_t" "prop_object_t *" "const ppath_t *" \
9133ce21e2Sdyoung    "const char *"
9233ce21e2Sdyoung.Ft int
9333ce21e2Sdyoung.Fn ppath_set_string "prop_object_t" "const ppath_t *" "const char *"
9433ce21e2Sdyoung.Ft int
9533ce21e2Sdyoung.Fn ppath_get_string "prop_object_t" "const ppath_t *" "const char **"
9633ce21e2Sdyoung.Ft int
9733ce21e2Sdyoung.Fn ppath_dup_string "prop_object_t" "const ppath_t *" "char **"
9833ce21e2Sdyoung.Ft int
9933ce21e2Sdyoung.Fn ppath_delete_string "prop_object_t" "const ppath_t *"
10033ce21e2Sdyoung.Sh DESCRIPTION
10133ce21e2SdyoungThe
10233ce21e2Sdyoung.Nm
10333ce21e2Sdyoungroutines read, write, or
10433ce21e2Sdyoungdelete objects in a property list by path.
10533ce21e2Sdyoung.Sh FUNCTIONS
10633ce21e2Sdyoung.Nm
10733ce21e2Sdyoungprovides these functions for manipulating objects in a property list
10833ce21e2Sdyoungby the objects' paths:
10933ce21e2Sdyoung.Bl -tag -width ppath
11033ce21e2Sdyoung.It Fn ppath_copydel_object "prop_object_t o" "prop_object_t *op" \
11133ce21e2Sdyoung    "const ppath_t *p"
11233ce21e2SdyoungCreate a copy of the property list
11333ce21e2Sdyoung.Fa o
11433ce21e2Sdyoungat
11533ce21e2Sdyoung.Fa *op .
11633ce21e2SdyoungDelete from the copy the property named by
11733ce21e2Sdyoung.Fa p .
11833ce21e2Sdyoung.Pp
11933ce21e2SdyoungIf
12033ce21e2Sdyoung.Fa *op
12133ce21e2Sdyoungis
12233ce21e2Sdyoung.Dv NULL ,
12333ce21e2Sdyoung.Fn ppath_copydel_object
12433ce21e2Sdyoungcreates a shallow copy of
12533ce21e2Sdyoung.Fa o
12633ce21e2Sdyoungat
12733ce21e2Sdyoung.Fa *op .
12833ce21e2SdyoungIf
12933ce21e2Sdyoung.Fa *op
13033ce21e2Sdyoungis not
13133ce21e2Sdyoung.Dv NULL ,
13233ce21e2Sdyoung.Fn ppath_copydel_object
13333ce21e2Sdyoungexpects for
13433ce21e2Sdyoung.Fa *op
13533ce21e2Sdyoungto be an existing shallow copy of
13633ce21e2Sdyoung.Fa o .
13733ce21e2Sdyoung.Pp
13833ce21e2SdyoungFor the purposes of
13933ce21e2Sdyoung.Fn ppath_copydel_object ,
14033ce21e2Sdyoung.Fa *op
14133ce21e2Sdyoungis a shallow copy of property list
14233ce21e2Sdyoung.Fa o
14333ce21e2Sdyoungif equal properties at equal paths are shared between the two.
14433ce21e2SdyoungBefore
14533ce21e2Sdyoung.Fn ppath_copydel_object
14633ce21e2Sdyoungmodifies a property shared by
14733ce21e2Sdyoung.Fa *op
14833ce21e2Sdyoungand
14933ce21e2Sdyoung.Fa o ,
15033ce21e2Sdyoungit creates a private copy of the property for
15133ce21e2Sdyoung.Fa *op .
15233ce21e2Sdyoung.It Fn ppath_copyset_object "prop_object_t o" "prop_object_t *op" \
15333ce21e2Sdyoung    "const ppath_t *p" "prop_object_t v"
15433ce21e2SdyoungCreate a copy of the property list
15533ce21e2Sdyoung.Fa o
15633ce21e2Sdyoungat
15733ce21e2Sdyoung.Fa *op .
15833ce21e2SdyoungIn the copy, replace with
15933ce21e2Sdyoung.Fa v
16033ce21e2Sdyoungthe property named by
16133ce21e2Sdyoung.Fa p .
16233ce21e2Sdyoung.Pp
16333ce21e2SdyoungIf
16433ce21e2Sdyoung.Fa *op
16533ce21e2Sdyoungis
16633ce21e2Sdyoung.Dv NULL ,
16733ce21e2Sdyoung.Fn ppath_copyset_object
16833ce21e2Sdyoungcreates a shallow copy of
16933ce21e2Sdyoung.Fa o
17033ce21e2Sdyoungat
17133ce21e2Sdyoung.Fa *op .
17233ce21e2SdyoungIf
17333ce21e2Sdyoung.Fa *op
17433ce21e2Sdyoungis not
17533ce21e2Sdyoung.Dv NULL ,
17633ce21e2Sdyoung.Fn ppath_copyset_object
17733ce21e2Sdyoungexpects for
17833ce21e2Sdyoung.Fa *op
17933ce21e2Sdyoungto be an existing shallow copy of
18033ce21e2Sdyoung.Fa o .
18133ce21e2Sdyoung.Pp
18233ce21e2SdyoungFor the purposes of
18333ce21e2Sdyoung.Fn ppath_copyset_object ,
18433ce21e2Sdyoung.Fa *op
18533ce21e2Sdyoungis a shallow copy of property list
18633ce21e2Sdyoung.Fa o
18733ce21e2Sdyoungif equal properties at equal paths are shared between the two.
18833ce21e2SdyoungBefore
18933ce21e2Sdyoung.Fn ppath_copydel_object
19033ce21e2Sdyoungmodifies a property shared by
19133ce21e2Sdyoung.Fa *op
19233ce21e2Sdyoungand
19333ce21e2Sdyoung.Fa o ,
19433ce21e2Sdyoungit creates a private copy of the property for
19533ce21e2Sdyoung.Fa *op .
19633ce21e2Sdyoung.It Fn ppath_set_object "prop_object_t o" "const ppath_t *p" "prop_object_t v"
19733ce21e2SdyoungReplace with
19833ce21e2Sdyoung.Fa v
19933ce21e2Sdyoungthe
20033ce21e2Sdyoung.Vt prop_object_t
20133ce21e2Sdyoungin
20233ce21e2Sdyoung.Fa o
20333ce21e2Sdyoungnamed by
20433ce21e2Sdyoung.Fa p .
20533ce21e2Sdyoung.It Fn ppath_get_object "prop_object_t o" "const ppath_t *p" "prop_object_t *vp"
20633ce21e2SdyoungRetrieve the
20733ce21e2Sdyoung.Vt prop_object_t
20833ce21e2Sdyoungnamed by
20933ce21e2Sdyoung.Fa p
21033ce21e2Sdyoungfrom
21133ce21e2Sdyoung.Fa o ,
21233ce21e2Sdyoungand write it to
21333ce21e2Sdyoung.Fa *vp .
21433ce21e2Sdyoung.Fn ppath_get_object
21533ce21e2Sdyoungdoes
21633ce21e2Sdyoung.Em not
21733ce21e2Sdyoungincrease the reference count of the retrieved object.
21833ce21e2Sdyoung.It Fn ppath_delete_object "prop_object_t o" "const ppath_t *p"
21933ce21e2SdyoungDelete the
22033ce21e2Sdyoung.Vt prop_object_t
22133ce21e2Sdyoungnamed by
22233ce21e2Sdyoung.Fa p
22333ce21e2Sdyoungfrom
22433ce21e2Sdyoung.Fa o .
22533ce21e2Sdyoung.Fn ppath_delete_object
22633ce21e2Sdyoungdecreases by one the deleted object's reference count.
22733ce21e2Sdyoung.El
22833ce21e2Sdyoung.\"
22933ce21e2Sdyoung.\" This next request is for sections 2 and 3 function return values only.
23033ce21e2Sdyoung.Sh RETURN VALUES
23133ce21e2Sdyoung.Nm
23233ce21e2Sdyoungroutines return 0 on success, and non-zero on error.
23333ce21e2Sdyoung.\" The next request is for sections 2 and 3 error and signal handling only.
23433ce21e2Sdyoung.Sh ERRORS
23533ce21e2Sdyoung.Bl -tag -width Er
23633ce21e2Sdyoung.It Bq Er EFTYPE
23733ce21e2SdyoungThe
23833ce21e2Sdyoung.Nm
23933ce21e2Sdyoungcall requested a
24033ce21e2Sdyoung.It Bq Er ENOENT
24133ce21e2Sdyoung.Fn ppath_copyset_object ,
24233ce21e2Sdyoung.Fn ppath_delete_object ,
24333ce21e2Sdyoung.Fn ppath_get_object ,
24433ce21e2Sdyoungand
24533ce21e2Sdyoung.Fn ppath_set_object
24633ce21e2Sdyoungreturn
24733ce21e2Sdyoung.Er ENOENT
24833ce21e2Sdyoungif the path
24933ce21e2Sdyoung.Fa p
25033ce21e2Sdyoungdoes not exist in
25133ce21e2Sdyoung.Fa o .
25233ce21e2Sdyoung.It Bq Er ENOMEM
25333ce21e2Sdyoung.Fn ppath_set_object
25433ce21e2Sdyoungand
25533ce21e2Sdyoung.Fn ppath_copyset_object
25633ce21e2Sdyoungwill return
25733ce21e2Sdyoung.Er ENOMEM
25833ce21e2Sdyoungif there was insufficient memory to complete the operation.
25933ce21e2Sdyoung.El
26033ce21e2Sdyoung.Sh SEE ALSO
26133ce21e2Sdyoung.\" Cross-references should be ordered by section (low to high), then in
26233ce21e2Sdyoung.\"     alphabetical order.
26333ce21e2Sdyoung.Xr ppath 3 ,
264*aa4b308cSwiz.\" .Xr ppath_data 3 ,
26533ce21e2Sdyoung.Xr ppath_number 3 ,
266*aa4b308cSwiz.\" .Xr ppath_string 3 ,
26733ce21e2Sdyoung.Xr proplib 3
26833ce21e2Sdyoung.Sh HISTORY
26933ce21e2SdyoungThe
27033ce21e2Sdyoung.Nm
27133ce21e2Sdyoungproperty container path library first appeared in
27233ce21e2Sdyoung.Nx 6.0 .
27333ce21e2Sdyoung.Sh AUTHORS
27433ce21e2Sdyoung.An David Young
27533ce21e2Sdyoung.Aq dyoung@pobox.com
27633ce21e2Sdyoung.\" .Sh CAVEATS
27733ce21e2Sdyoung.\" .Sh BUGS
27833ce21e2Sdyoung.\" .Sh SECURITY CONSIDERATIONS
279