• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/dev/bhnd/nvram/

Lines Matching defs:plist

53 				     bhnd_nvram_plist *plist, const char *name);
67 bhnd_nvram_plist *plist;
69 plist = bhnd_nv_calloc(1, sizeof(*plist));
70 if (plist == NULL)
74 plist->refs = 1;
77 plist->num_entries = 0;
78 TAILQ_INIT(&plist->entries);
81 for (size_t i = 0; i < nitems(plist->names); i++)
82 LIST_INIT(&plist->names[i]);
84 return (plist);
88 * Retain a reference and return @p plist to the caller.
93 * @param plist The property list to be retained.
96 bhnd_nvram_plist_retain(bhnd_nvram_plist *plist)
98 BHND_NV_ASSERT(plist->refs >= 1, ("plist over-released"));
100 refcount_acquire(&plist->refs);
101 return (plist);
105 * Release a reference to @p plist.
109 * @param plist The property list to be released.
112 bhnd_nvram_plist_release(bhnd_nvram_plist *plist)
116 BHND_NV_ASSERT(plist->refs >= 1, ("plist over-released"));
119 if (!refcount_release(&plist->refs))
123 TAILQ_FOREACH_SAFE(ple, &plist->entries, pl_link, ple_next) {
128 /* Free plist instance */
129 bhnd_nv_free(plist);
133 * Return a shallow copy of @p plist.
142 bhnd_nvram_plist_copy(bhnd_nvram_plist *plist)
148 /* Allocate new, empty plist */
154 while ((prop = bhnd_nvram_plist_next(plist, prop)) != NULL) {
172 * Return the number of properties in @p plist.
175 bhnd_nvram_plist_count(bhnd_nvram_plist *plist)
177 return (plist->num_entries);
181 * Return true if @p plist contains a property name @p name, false otherwise.
183 * @param plist The property list to be queried.
187 bhnd_nvram_plist_contains(bhnd_nvram_plist *plist, const char *name)
189 if (bhnd_nvram_plist_get_entry(plist, name) != NULL)
197 * of @p prop, maintaining the property's current order in @p plist.
199 * If a matching property is not found in @p plist, @p prop will instead be
202 * @param plist The property list to be modified.
207 * @retval non-zero if modifying @p plist otherwise fails, a regular unix
211 bhnd_nvram_plist_replace(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop)
216 entry = bhnd_nvram_plist_get_entry(plist, prop->name);
219 return (bhnd_nvram_plist_append(plist, prop));
231 * maintaining the property's order in @p plist.
233 * If @p name is not found in @p plist, a new property will be appended.
235 * @param plist The property list to be modified.
241 * @retval non-zero if modifying @p plist otherwise fails, a regular unix
245 bhnd_nvram_plist_replace_val(bhnd_nvram_plist *plist, const char *name,
256 error = bhnd_nvram_plist_replace(plist, prop);
266 * The current property order of @p name in @p plist will be maintained.
268 * If @p name is not found in @p plist, a new property will be appended.
270 * @param plist The property list to be modified.
278 * @retval non-zero if modifying @p plist otherwise fails, a regular unix
282 bhnd_nvram_plist_replace_bytes(bhnd_nvram_plist *plist, const char *name,
291 error = bhnd_nvram_plist_replace(plist, prop);
301 * The current property order of @p name in @p plist will be maintained.
303 * If @p name is not found in @p plist, a new property will be appended.
305 * @param plist The property list to be modified.
311 * @retval non-zero if modifying @p plist otherwise fails, a regular unix
315 bhnd_nvram_plist_replace_string(bhnd_nvram_plist *plist, const char *name,
318 return (bhnd_nvram_plist_replace_bytes(plist, name, val, strlen(val)+1,
325 * @param plist The property list to be modified.
329 bhnd_nvram_plist_remove(bhnd_nvram_plist *plist, const char *name)
334 entry = bhnd_nvram_plist_get_entry(plist, name);
339 TAILQ_REMOVE(&plist->entries, entry, pl_link);
342 /* Free plist entry */
347 BHND_NV_ASSERT(plist->num_entries > 0, ("entry count over-release"));
348 plist->num_entries--;
354 * @param plist The property list to be queried.
361 bhnd_nvram_plist_get_entry(bhnd_nvram_plist *plist, const char *name)
368 hash_list = &plist->names[h % nitems(plist->names)];
380 * Append all properties from @p tail to @p plist.
382 * @param plist The property list to be modified.
387 * @retval EEXIST an existing property from @p tail was found in @p plist.
390 bhnd_nvram_plist_append_list(bhnd_nvram_plist *plist, bhnd_nvram_plist *tail)
397 if ((error = bhnd_nvram_plist_append(plist, p)))
405 * Append @p prop to @p plist.
407 * @param plist The property list to be modified.
412 * @retval EEXIST an existing property with @p name was found in @p plist.
415 bhnd_nvram_plist_append(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop)
421 if (bhnd_nvram_plist_contains(plist, prop->name))
425 if (plist->num_entries == SIZE_MAX)
436 TAILQ_INSERT_TAIL(&plist->entries, entry, pl_link);
440 hash_list = &plist->names[h % nitems(plist->names)];
444 plist->num_entries++;
450 * Append a new property to @p plist with @p name and @p val.
452 * @param plist The property list to be modified.
458 * @retval EEXIST an existing property with @p name was found in @p plist.
461 bhnd_nvram_plist_append_val(bhnd_nvram_plist *plist, const char *name,
470 error = bhnd_nvram_plist_append(plist, prop);
477 * Append a new property to @p plist, copying the property value from the
480 * @param plist The property list to be modified.
488 * @retval EEXIST an existing property with @p name was found in @p plist.
491 bhnd_nvram_plist_append_bytes(bhnd_nvram_plist *plist, const char *name,
500 error = bhnd_nvram_plist_append(plist, prop);
507 * Append a new string property to @p plist, copying the property value from
510 * @param plist The property list to be modified.
516 * @retval EEXIST an existing property with @p name was found in @p plist.
519 bhnd_nvram_plist_append_string(bhnd_nvram_plist *plist, const char *name,
522 return (bhnd_nvram_plist_append_bytes(plist, name, val, strlen(val)+1,
527 * Iterate over all properties in @p plist.
529 * @param plist The property list to be iterated.
530 * @param prop A property in @p plist, or NULL to return the first
531 * property in @p plist.
533 * @retval non-NULL A borrowed reference to the next property in @p plist.
535 * is not found in @p plist.
538 bhnd_nvram_plist_next(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop)
543 if ((entry = TAILQ_FIRST(&plist->entries)) == NULL)
550 if ((entry = bhnd_nvram_plist_get_entry(plist, prop->name)) == NULL)
566 * not found in @p plist.
568 * @param plist The property list to be queried.
575 bhnd_nvram_plist_get_prop(bhnd_nvram_plist *plist, const char *name)
579 if ((entry = bhnd_nvram_plist_get_entry(plist, name)) == NULL)
587 * @p name is not found in @p plist.
589 * @param plist The property list to be queried.
596 bhnd_nvram_plist_get_val(bhnd_nvram_plist *plist, const char *name)
600 if ((prop = bhnd_nvram_plist_get_prop(plist, name)) == NULL)
610 * @param plist The property list to be queried.
620 * @retval ENOENT If @p name is not found in @p plist.
629 bhnd_nvram_plist_get_encoded(bhnd_nvram_plist *plist, const char *name,
634 if ((prop = bhnd_nvram_plist_get_prop(plist, name)) == NULL)
643 * @param plist The property list to be queried.
648 * @retval ENOENT If @p name is not found in @p plist.
654 bhnd_nvram_plist_get_char(bhnd_nvram_plist *plist, const char *name,
657 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
664 * @param plist The property list to be queried.
669 * @retval ENOENT If @p name is not found in @p plist.
675 bhnd_nvram_plist_get_uint8(bhnd_nvram_plist *plist, const char *name,
678 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
685 * @param plist The property list to be queried.
690 * @retval ENOENT If @p name is not found in @p plist.
696 bhnd_nvram_plist_get_uint16(bhnd_nvram_plist *plist, const char *name,
699 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
706 * @param plist The property list to be queried.
711 * @retval ENOENT If @p name is not found in @p plist.
717 bhnd_nvram_plist_get_uint32(bhnd_nvram_plist *plist, const char *name,
720 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
727 * @param plist The property list to be queried.
732 * @retval ENOENT If @p name is not found in @p plist.
738 bhnd_nvram_plist_get_uint64(bhnd_nvram_plist *plist, const char *name,
741 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
748 * @param plist The property list to be queried.
753 * @retval ENOENT If @p name is not found in @p plist.
759 bhnd_nvram_plist_get_bool(bhnd_nvram_plist *plist, const char *name,
762 return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),