xref: /illumos-gate/usr/src/man/man3nvpair/nvpair_value_byte.3nvpair (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
te
Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
NVPAIR_VALUE_BYTE 3NVPAIR "Aug 1, 2008"
NAME
nvpair_value_byte, nvpair_value_boolean_value, nvpair_value_int8, nvpair_value_uint8, nvpair_value_int16, nvpair_value_uint16, nvpair_value_int32, nvpair_value_uint32, nvpair_value_int64, nvpair_value_uint64, nvpair_value_double, nvpair_value_string, nvpair_value_nvlist, nvpair_value_boolean_array, nvpair_value_byte_array, nvpair_value_int8_array, nvpair_value_uint8_array, nvpair_value_int16_array, nvpair_value_uint16_array, nvpair_value_int32_array, nvpair_value_uint32_array, nvpair_value_int64_array, nvpair_value_uint64_array, nvpair_value_string_array, nvpair_value_nvlist_array - retrieve value from a name-value pair
SYNOPSIS

cc [ flag... ] file... -lnvpair [ library... ]
#include <libnvpair.h>

int nvpair_value_byte(nvpair_t *nvpair, uchar_t *val);

int nvpair_value_boolean_value(nvpair_t *nvpair,
 boolean_t *val);

int nvpair_value_int8(nvpair_t *nvpair, int8_t *val);

int nvpair_value_uint8(nvpair_t *nvpair, uint8_t *val);

int nvpair_value_int16(nvpair_t *nvpair, int16_t *val);

int nvpair_value_uint16(nvpair_t *nvpair, uint16_t *val);

int nvpair_value_int32(nvpair_t *nvpair, int32_t *val);

int nvpair_value_uint32(nvpair_t *nvpair, uint32_t *val);

int nvpair_value_int64(nvpair_t *nvpair, int64_t *val);

int nvpair_value_uint64(nvpair_t *nvpair, uint64_t *val);

int nvpair_value_double(nvpair_t *nvpair, double *val);

int nvpair_value_string(nvpair_t *nvpair, char **val);

int nvpair_value_nvlist(nvpair_t *nvpair, nvlist_t **val);

int nvpair_value_boolean_array(nvpair_t *nvpair,
 boolean_t **val, uint_t *nelem);

int nvpair_value_byte_array(nvpair_t *nvpair, uchar_t **val,
 uint_t *nelem);

int nvpair_value_int8_array(nvpair_t *nvpair, int8_t **val,
 uint_t *nelem);

int nvpair_value_uint8_array(nvpair_t *nvpair, uint8_t **val,
 uint_t *nelem);

int nvpair_value_int16_array(nvpair_t *nvpair, int16_t **val,
 uint_t *nelem);

int nvpair_value_uint16_array(nvpair_t *nvpair,
 uint16_t **val, uint_t *nelem);

int nvpair_value_int32_array(nvpair_t *nvpair,
 int32_t **val, uint_t *nelem);

int nvpair_value_uint32_array(nvpair_t *nvpair,
 uint32_t **val, uint_t *nelem);

int nvpair_value_int64_array(nvpair_t *nvpair,
 int64_t **val, uint_t *nelem);

int nvpair_value_uint64_array(nvpair_t *nvpair,
 uint64_t **val, uint_t *nelem);

int nvpair_value_string_array(nvpair_t *nvpair,
 char ***val, uint_t *nelem);

int nvpair_value_nvlist_array(nvpair_t *nvpair,
 nvlist_t ***val, uint_t *nelem);
PARAMETERS
nvpair

Name-value pair to be processed.

nelem

Address to store the number of elements in value.

val

Address to store the value or the starting address of the array value.

DESCRIPTION

These functions retrieve the value of nvpair. The data type of nvpair must match the interface name for the call to be successful.

There is no nvpair_value_boolean(); the existence of the name implies the value is true.

For array data types, including string, the memory containing the data is managed by the library and references to the value remains valid until nvlist_free() is called on the nvlist_t from which nvpair is obtained. See nvlist_free(3NVPAIR).

The value of an nvpair may not be retrieved after the nvpair has been removed from or replaced in an nvlist. Replacement can occur during pair additions to nvlists created with NV_UNIQUE_NAME_TYPE and NV_UNIQUE_NAME. See nvlist_alloc(3NVPAIR).

RETURN VALUES

These functions return 0 on success and an error value on failure.

ERRORS

These functions will fail if: EINVAL

Either one of the arguments is NULL or the type of nvpair does not match the function name.

ATTRIBUTES

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO

libnvpair (3LIB), nvlist_alloc (3NVPAIR), attributes (7)