di_prom_prop_lookup_bytes.3devinfo revision c10c16dec587a0662068f6e2991c29ed3a9db943
te
Copyright (c) 1998, 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]
di_prom_prop_lookup_bytes 3DEVINFO "1 Dec 1998" "SunOS 5.11" "Device Information Library Functions"
NAME
di_prom_prop_lookup_bytes, di_prom_prop_lookup_ints, di_prom_prop_lookup_strings - search for a PROM property
SYNOPSIS

cc [ flag... ] file... -ldevinfo [ library... ]
#include <libdevinfo.h>

int di_prom_prop_lookup_bytes(di_prom_handle_t ph, di_node_t node,
 const char *prop_name, uchar_t **prop_data);

int di_prom_prop_lookup_ints(di_prom_handle_t ph, di_node_t node,
 const char *prop_name, int **prop_data);

int di_prom_prop_lookup_strings(di_prom_handle_t ph, di_node_t node,
 const char *prop_name, char **prop_data);
PARAMETERS

node

Handle to device node in snapshot created by di_init(3DEVINFO).

ph

Handle returned by di_prom_init(3DEVINFO).

prop_data

For di_prom_prop_lookup_bytes(), the address of a pointer to an array of unsigned characters. For di_prom_prop_lookup_ints(), the address of a pointer to an integer. For di_prom_prop_lookup_strings(), the address of pointer to a buffer.

prop_name

The name of the property being searched.

DESCRIPTION

These functions return the value of a known PROM property name and value type and update the prop_data pointer to reference memory that contains the property value. All memory allocated by these functions is managed by the library and must not be freed by the caller.

RETURN VALUES

If the property is found, the number of entries in prop_data is returned. If the property is a boolean type, 0 is returned and the existence of this property indicates the value is true. Otherwise, -1 is returned and errno is set to indicate the error.

For di_prom_prop_lookup_bytes(), the number of entries is the number of unsigned characters contained in the buffer pointed to by prop_data.

For di_prom_prop_lookup_ints(), the number of entries is the number of integers contained in the buffer pointed to by prop_data.

For di_prom_prop_lookup_strings(), the number of entries is the number of null-terminated strings contained in the buffer. The strings are stored in a concatenated format in the buffer.

ERRORS

These functions will fail if::

EINVAL

Invalid argument.

ENXIO

The property does not exist.

ATTRIBUTES

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

ATTRIBUTE TYPEATTRIBUTE VALUE
Interface StabilityEvolving
MT-LevelSafe
SEE ALSO

di_init(3DEVINFO), di_prom_prop_next(3DEVINFO), libdevinfo(3LIB), attributes(5), openprom(7D)

Writing Device Drivers