xref: /netbsd/common/lib/libppath/ppath_bool.3 (revision 3b3d4371)
1.\"	$NetBSD: ppath_bool.3,v 1.5 2011/09/13 18:05:20 dyoung Exp $
2.\"	$Id: ppath_bool.3,v 1.5 2011/09/13 18:05:20 dyoung Exp $
3.\"
4.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by David Young <dyoung@NetBSD.org>.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY EXPRESS
20.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL David Young BE LIABLE FOR ANY
23.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
29.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd September 13, 2011
32.Dt PPATH_BOOL 3
33.Os
34.Sh NAME
35.Nm ppath_bool ,
36.\" ,
37.Nm ppath_copydel_bool ,
38.Nm ppath_copyset_bool ,
39.Nm ppath_set_bool ,
40.Nm ppath_get_bool ,
41.Nm ppath_delete_bool
42.Nd boolean property path operations
43.Sh LIBRARY
44.Lb libppath
45.Sh SYNOPSIS
46.In ppath/ppath.h
47.\"
48.Ft int
49.Fn ppath_copydel_bool "prop_object_t" "prop_object_t *" "const ppath_t *"
50.Ft int
51.Fn ppath_copyset_bool "prop_object_t" "prop_object_t *" "const ppath_t *" \
52    "bool"
53.Ft int
54.Fn ppath_set_bool "prop_object_t" "const ppath_t *" "bool"
55.Ft int
56.Fn ppath_get_bool "prop_object_t" "const ppath_t *" "bool *"
57.Ft int
58.Fn ppath_delete_bool "prop_object_t" "const ppath_t *"
59.Sh DESCRIPTION
60The
61.Nm
62routines read, write, or
63delete boolean values in a property list by path.
64.Sh FUNCTIONS
65.Nm
66provides these functions for manipulating boolean values in a property list
67by the values' paths:
68.Bl -tag -width ppath
69.It Fn ppath_copydel_bool "prop_object_t o" "prop_object_t *op" \
70    "const ppath_t *p"
71Create a copy of the property list
72.Fa o
73at
74.Fa *op .
75Delete from the copy the
76.Vt prop_bool_t
77named by
78.Fa p .
79.Pp
80If
81.Fa *op
82is
83.Dv NULL ,
84.Fn ppath_copydel_bool
85creates a shallow copy of
86.Fa o
87at
88.Fa *op .
89If
90.Fa *op
91is not
92.Dv NULL ,
93.Fn ppath_copydel_bool
94expects for
95.Fa *op
96to be an existing shallow copy of
97.Fa o .
98.Pp
99For the purposes of
100.Fn ppath_copydel_bool ,
101.Fa *op
102is a shallow copy of property list
103.Fa o
104if equal properties at equal paths are shared between the two.
105Before
106.Fn ppath_copydel_bool
107modifies a property shared by
108.Fa *op
109and
110.Fa o ,
111it creates a private copy of the property for
112.Fa *op .
113.It Fn ppath_copyset_bool "prop_object_t o" "prop_object_t *op" \
114    "const ppath_t *p" "bool v"
115Create a copy of the property list
116.Fa o
117at
118.Fa *op .
119In the copy, replace with
120.Fa v
121the
122.Vt prop_bool_t
123named by
124.Fa p .
125.Pp
126If
127.Fa *op
128is
129.Dv NULL ,
130.Fn ppath_copyset_bool
131creates a shallow copy of
132.Fa o
133at
134.Fa *op .
135If
136.Fa *op
137is not
138.Dv NULL ,
139.Fn ppath_copyset_bool
140expects for
141.Fa *op
142to be an existing shallow copy of
143.Fa o .
144.Pp
145For the purposes of
146.Fn ppath_copyset_bool ,
147.Fa *op
148is a shallow copy of property list
149.Fa o
150if equal properties at equal paths are shared between the two.
151Before
152.Fn ppath_copydel_bool
153modifies a property shared by
154.Fa *op
155and
156.Fa o ,
157it creates a private copy of the property for
158.Fa *op .
159.It Fn ppath_set_bool "prop_object_t o" "const ppath_t *p" "bool v"
160Replace with
161.Fa v
162the
163.Vt prop_bool_t
164in
165.Fa o
166named by
167.Fa p .
168.It Fn ppath_get_bool "prop_object_t o" "const ppath_t *p" "bool *vp"
169Retrieve the
170.Vt prop_bool_t
171named by
172.Fa p
173from
174.Fa o ,
175and write it to
176.Fa *vp .
177.It Fn ppath_delete_bool "prop_object_t o" "const ppath_t *p"
178Delete the
179.Vt prop_bool_t
180named by
181.Fa p
182from
183.Fa o .
184.Fn ppath_delete_bool
185decreases by one the deleted boolean value's reference count.
186.El
187.\"
188.\" This next request is for sections 2 and 3 function return values only.
189.Sh RETURN VALUES
190.Nm
191routines return 0 on success, and non-zero on error.
192.\" The next request is for sections 2 and 3 error and signal handling only.
193.Sh ERRORS
194.Bl -tag -width Er
195.It Bq Er EFTYPE
196A
197.Nm
198operation returns
199.Er EFTYPE
200when the object named by the path is not a
201.Vt prop_bool_t .
202.It Bq Er ENOENT
203.Nm
204routines return
205.Er ENOENT
206if the path
207.Fa p
208does not exist in
209.Fa o .
210.It Bq Er ENOMEM
211.Fn ppath_set_bool ,
212and
213.Fn ppath_copyset_bool
214return
215.Er ENOMEM
216if there was insufficient memory to complete the operation.
217.El
218.Sh SEE ALSO
219.\" Cross-references should be ordered by section (low to high), then in
220.\"     alphabetical order.
221.Xr ppath 3 ,
222.Xr ppath_data 3 ,
223.Xr ppath_object 3 ,
224.Xr ppath_string 3 ,
225.Xr proplib 3
226.Sh HISTORY
227The
228.Nm
229property container path library first appeared in
230.Nx 6.0 .
231.Sh AUTHORS
232.An David Young
233.Aq dyoung@pobox.com
234.\" .Sh CAVEATS
235.\" .Sh BUGS
236.\" .Sh SECURITY CONSIDERATIONS
237