Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
.\"	$NetBSD: ppath.3,v 1.5 2017/10/23 00:59:44 wiz Exp $
.\"
.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by David Young <dyoung@NetBSD.org>.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL David Young BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 24, 2011
.Dt PPATH 3
.Os
.Sh NAME
.Nm ppath ,
.Nm ppath_idx ,
.Nm ppath_key ,
.\" ,
.Nm ppath_component_retain ,
.Nm ppath_component_release ,
.\" ,
.Nm ppath_create ,
.Nm ppath_length ,
.Nm ppath_component_idx ,
.Nm ppath_component_key ,
.Nm ppath_pop ,
.Nm ppath_push ,
.Nm ppath_component_at ,
.Nm ppath_subpath ,
.Nm ppath_push_idx ,
.Nm ppath_push_key ,
.Nm ppath_replace_idx ,
.Nm ppath_replace_key ,
.\" ,
.Nm ppath_copy ,
.Nm ppath_retain ,
.Nm ppath_release ,
.\" ,
.Nm ppath_lookup
.\" ,
.Nd property container path library
.Sh LIBRARY
.Lb libppath
.Sh SYNOPSIS
.In ppath/ppath.h
.\"
.Ft "ppath_component_t *"
.Fn ppath_idx "unsigned int index"
.Ft "ppath_component_t *"
.Fn ppath_key "const char *key"
.\"
.Ft "ppath_component_t *"
.Fn ppath_component_retain "ppath_component_t *pc"
.Ft void
.Fn ppath_component_release "ppath_component_t *pc"
.\"
.Ft "ppath_t *"
.Fn ppath_create "void"
.Ft "unsigned int"
.Fn ppath_length "const ppath_t *p"
.Ft int
.Fn ppath_component_idx "const ppath_component_t *"
.Ft const char *
.Fn ppath_component_key "const ppath_component_t *"
.Ft "ppath_t *"
.Fn ppath_pop "ppath_t *" "ppath_component_t **"
.Ft ppath_t *
.Fn ppath_push "ppath_t *" "ppath_component_t *"
.Ft ppath_component_t *
.Fn ppath_component_at "const ppath_t *" "unsigned int"
.Ft ppath_t *
.Fn ppath_subpath "const ppath_t *" "unsigned int" "unsigned int"
.Ft ppath_t *
.Fn ppath_push_idx "ppath_t *" "unsigned int"
.Ft ppath_t *
.Fn ppath_push_key "ppath_t *" "const char *"
.Ft ppath_t *
.Fn ppath_replace_idx "ppath_t *" "unsigned int"
.Ft ppath_t *
.Fn ppath_replace_key "ppath_t *" "const char *"
.\"
.Ft ppath_t *
.Fn ppath_copy "const ppath_t *"
.Ft ppath_t *
.Fn ppath_retain "ppath_t *"
.Ft void
.Fn ppath_release "ppath_t *"
.\"
.Ft prop_object_t
.Fn ppath_lookup "prop_object_t" "const ppath_t *"
.\"
.Sh DESCRIPTION
The
.Nm
library provides functions to read, write, or delete objects in a
property list.
A property-list
.Dq path
names the object in a property list to read, write, or delete.
.Pp
A property-list path is an ordered array of zero or more array
indices and dictionary keys that names at most one
.Vt prop_object_t
in a property list.
The abstract function
.Fn E
evaluates
a property-list path against a
.Vt prop_object_t ,
.Va o ,
to yield a
.Vt prop_object_t
result according to the following recursive definition, where
.Fa empty
indicates the empty
.Pq zero-length
path and the operator
.Dq |
indicates the concatenation of the path on the left-hand side with
the key or index on the right-hand side:
.Bl -tag -width "E(o, p | index)"
.It Fn E "o" "empty"
Evaluates to
.Fa o .
.It Fn E "o" "p | index"
If
.Fn E "o" "p"
evaluates to a
.Vt prop_array_t ,
then
.Fn E "o" "p | index"
evaluates to the
.Fa index 'th
element of that array.
Otherwise, an error occurs.
.It Fn E "o" "p | key"
If
.Fn E "o" "p"
evaluates to a
.Vt prop_dictionary_t ,
then
.Fn E "o" "p | key"
evaluates to the dictionary value stored under
.Fa key .
Otherwise, an error occurs.
.El
.Pp
The programmer may think of property-list paths as working similarly
to paths in a file system, where property arrays and dictionaries
correspond to directories, and all other property types correspond
to files.
.Sh DATA TYPES
.Nm
provides two opaque types:
.Bl -tag -width ppath_component
.It Vt ppath_component_t
A property-list path component: a single key or index.
.Nm
counts references to a
.Vt ppath_component_t
and reclaims its storage when there are no more references.
.It Vt ppath_t
An array of zero or more property-list path components.
.Nm
counts references to a
.Vt ppath_t
and reclaims its storage when there are no more references.
.El
.Sh FUNCTIONS
.Nm
provides these functions for manipulating property-list paths
and their components:
.Bl -tag -width ppath
.It Fn ppath_idx "unsigned int index"
Allocate a new
.Vt ppath_component_t
for the given array index and return it.
Its reference count is initially one.
.Pp
If there is not sufficient memory to complete the request, return
.Dv NULL .
.It Fn ppath_key "const char *key"
Allocate a new
.Vt ppath_component_t
for the given dictionary key and return it.
Its reference count is initially one.
.Pp
If there is not sufficient memory to complete the request, return
.Dv NULL .
.\"
.It Fn ppath_component_retain "ppath_component_t *pc"
Increase the reference count on
.Fa pc
by one.
.It Fn ppath_component_release "ppath_component_t *pc"
Decrease the reference count on
.Fa pc
by one.
If the reference count reaches zero, reclaim the storage
for
.Fa pc .
.\"
.It Fn ppath_create "void"
Create a new property-list path and return it.
Its reference count is initially one.
The path's length is initially zero.
.Pp
If there is not sufficient memory to complete the request, return
.Dv NULL .
.It Fn ppath_length "const ppath_t *p"
Return the number of components in path
.Fa p .
.It Fn ppath_component_idx "const ppath_component_t *pc"
Return the array index represented by the component
.Fa pc ,
or \-1 if
.Fa pc
does not represent an array index.
.It Fn ppath_component_key "const ppath_component_t *pc"
Return the dictionary key represented by the component
.Fa pc ,
or
.Dv NULL
if
.Fa pc
does not represent a dictionary key.
.It Fn ppath_pop "ppath_t *p" "ppath_component_t **pcp"
If
.Fa p
is the empty path or
.Dv NULL ,
return
.Dv NULL .
Otherwise, remove the last component from
.Fa p
and return
.Fa p ,
and if
.Fa pcp
is not
.Dv NULL ,
write the removed component to
.Fa "*pcp" .
.It Fn ppath_push "ppath_t *p" "ppath_component_t *pc"
If
either
.Fa p
is
.Dv NULL
or no more components can be added to
.Fa p ,
return
.Dv NULL .
Otherwise, append
.Fa pc
to the end of the component array
.Fa p
and return
.Fa p .
.It Fn ppath_component_at "const ppath_t *p" "unsigned int i"
If
either
.Fa p
is
.Dv NULL
or there is no
.Fa ith
component to
.Fa p ,
return
.Dv NULL .
Otherwise, return the
.Fa ith
component of
.Fa p .
Before returning a component,
.Fn ppath_component_at
increases its reference count.
(The first component is 0.)
.It Fn ppath_subpath "const ppath_t *p" "unsigned int first" "unsigned int exclast"
Create a new
.Vt ppath_t
and fill it with components
.Fa first
to
.Fa exclast
.Pq exclusive
of
.Fa p .
If there are no such components as those in
.Fa p ,
.Fn ppath_subpath
returns an empty
.Vt ppath_t .
If there is insufficient memory to create the new path, or if
.Fa p
is
.Dv NULL ,
return
.Dv NULL .
Otherwise, return the new path.
.It Fn ppath_push_idx "ppath_t *p" "unsigned int idx"
Append an array index,
.Fa idx ,
to the end of path
.Fa p .
If
.Fa p
is
.Dv NULL ,
or if there is insufficient memory to complete the operation,
return
.Dv NULL .
Otherwise, return
.Fa p .
.It Fn ppath_push_key "ppath_t *" "const char *key"
Append a dictionary key,
.Fa key ,
to the end of path
.Fa p .
If
.Fa p
is
.Dv NULL ,
or if there is insufficient memory to complete the operation,
return
.Dv NULL .
Otherwise, return
.Fa p .
.It Fn ppath_replace_idx "ppath_t *p" "unsigned int idx"
Replace the array index at the end of path
.Fa p
with the array index
.Fa idx .
If
.Fa p
is
.Dv NULL ,
if the last component of
.Fa p
is not an array index,
or if there is insufficient memory to complete the operation,
return
.Dv NULL .
Otherwise, return
.Fa p .
.It Fn ppath_replace_key "ppath_t *p" "const char *key"
Replace the dictionary key at the end of path
.Fa p
with the dictionary key
.Fa idx .
If
.Fa p
is
.Dv NULL ,
if the last component of
.Fa p
is not a dictionary key,
or if there is insufficient memory to complete the operation,
return
.Dv NULL .
Otherwise, return
.Fa p .
.\"
.It Fn ppath_copy "const ppath_t *p"
Create a copy of path
.Fa p .
If
.Fa p
is
.Dv NULL ,
or if there is insufficient memory to complete the operation,
return
.Dv NULL .
Otherwise, return the copy, whose reference count will be one.
.It Fn ppath_retain "ppath_t *p"
Increase the reference count on
.Fa p
and return
.Fa p .
.It Fn ppath_release "ppath_t *p"
Decrease the reference count on
.Fa p .
Reclaim the storage for
.Fa p
if the reference count reaches zero.
.\"
.It Fn ppath_lookup "prop_object_t o" "const ppath_t *p"
Return the
.Vt prop_object_t
under
.Fa o
named by
.Fa p ,
or return
.Dv NULL
if no such
.Vt prop_object_t
is under
.Fa o .
.El
.Sh SEE ALSO
.\" Cross-references should be ordered by section (low to high), then in
.\"     alphabetical order.
.Xr ppath_bool 3 ,
.\" .Xr ppath_data 3 ,
.Xr ppath_number 3 ,
.Xr ppath_object 3 ,
.\" .Xr ppath_string 3 ,
.Xr proplib 3
.Sh HISTORY
The
.Nm
property container path library first appeared in
.Nx 6.0 .
.Sh AUTHORS
.An David Young
.Aq dyoung@pobox.com
.\" .Sh CAVEATS
.\" .Sh BUGS
.\" .Sh SECURITY CONSIDERATIONS