'\" te
.\" Copyright (c) 2001, 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]
.TH DI_PROP_BYTES 3DEVINFO "Mar 27, 2001"
.SH NAME
di_prop_bytes, di_prop_devt, di_prop_ints, di_prop_name, di_prop_strings,
di_prop_type, di_prop_int64 \- access property values and attributes
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
#include <libdevinfo.h>

\fBint\fR \fBdi_prop_bytes\fR(\fBdi_prop_t\fR \fIprop\fR, \fBuchar_t **\fR\fIprop_data\fR);
.fi

.LP
.nf
\fBdev_t\fR \fBdi_prop_devt\fR(\fBdi_prop_t\fR \fIprop\fR);
.fi

.LP
.nf
\fBint\fR \fBdi_prop_ints\fR(\fBdi_prop_t\fR \fIprop\fR, \fBint **\fR\fIprop_data\fR);
.fi

.LP
.nf
\fBint\fR \fBdi_prop_int64\fR(\fBdi_prop_t\fR \fIprop\fR, \fBint64_t **\fR\fIprop_data\fR);
.fi

.LP
.nf
\fBchar *\fR\fBdi_prop_name\fR(\fBdi_prop_t\fR \fIprop\fR);
.fi

.LP
.nf
\fBint\fR \fBdi_prop_strings\fR(\fBdi_prop_t\fR \fIprop\fR, \fBchar **\fR\fIprop_data\fR);
.fi

.LP
.nf
\fBint\fR \fBdi_prop_type\fR(\fBdi_prop_t\fR \fIprop\fR);
.fi

.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIprop\fR\fR
.ad
.RS 13n
Handle to a property returned by \fBdi_prop_next\fR(3DEVINFO).
.RE

.sp
.ne 2
.na
\fB\fIprop_data\fR\fR
.ad
.RS 13n
For \fBdi_prop_bytes()\fR, the address of a pointer to an unsigned character.
.sp
For \fBdi_prop_ints()\fR, the address of a pointer to an integer.
.sp
For \fBdi_prop_int64()\fR, the address of a pointer to a 64-bit integer.
.sp
For \fBdi_prop_strings()\fR, the address of pointer to a character.
.RE

.SH DESCRIPTION
.sp
.LP
These functions access information associated with property values and
attributes. All memory allocated by these functions is managed by the library
and must not be freed by the caller.
.sp
.LP
The \fBdi_prop_bytes()\fR function returns the property data as a series of
unsigned characters.
.sp
.LP
The \fBdi_prop_devt()\fR function returns the \fBdev_t\fR with which this
property is associated. If the value is \fBDDI_DEV_T_NONE\fR, the property is
not associated with any specific minor node.
.sp
.LP
The \fBdi_prop_ints()\fR function returns the property data as a series of
integers.
.sp
.LP
The \fBdi_prop_int64()\fR function returns the property data as a series of
64-bit integers.
.sp
.LP
The \fBdi_prop_name()\fR function returns the name of the property.
.sp
.LP
The \fBdi_prop_strings()\fR function returns the property data as a
concatenation of null-terminated strings.
.sp
.LP
The \fBdi_prop_type()\fR function returns the type of the property. The type
determines the appropriate interface to access property values. The following
is a list of possible types:
.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_BOOLEAN\fR\fR
.ad
.RS 25n
There is no interface to call since there is no property data associated with
boolean properties. The existence of the property defines a \fBTRUE\fR value.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_INT\fR\fR
.ad
.RS 25n
Use \fBdi_prop_ints()\fR to access property data.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_INT64\fR\fR
.ad
.RS 25n
Use \fBdi_prop_int64()\fR to access property data.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_STRING\fR\fR
.ad
.RS 25n
Use \fBdi_prop_strings()\fR to access property data.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_BYTE\fR\fR
.ad
.RS 25n
Use \fBdi_prop_bytes()\fR to access property data.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_UNKNOWN\fR\fR
.ad
.RS 25n
Use \fBdi_prop_bytes()\fR to access property data. Since the type of property
is unknown, the caller is responsible for interpreting the contents of the
data.
.RE

.sp
.ne 2
.na
\fB\fBDI_PROP_TYPE_UNDEF_IT\fR\fR
.ad
.RS 25n
The property has been undefined by the driver. No property data is available.
.RE

.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBdi_prop_bytes()\fR, \fBdi_prop_ints()\fR,
\fBdi_prop_int64()\fR, and \fBdi_prop_strings()\fR return a non-negative value,
indicating the number of entries in the property value buffer. See
\fBdi_prom_prop_lookup_bytes\fR(3DEVINFO) for a description of the return
values. Otherwise, -1 is returned and \fIerrno\fR is set to indicate the error.
.sp
.LP
The \fBdi_prop_devt()\fR function returns the \fBdev_t\fR value associated with
the property.
.sp
.LP
The \fBdi_prop_name()\fR function returns a pointer to a string containing the
name of the property.
.sp
.LP
The \fBdi_prop_type()\fR function can return one of types described in the
DESCRIPTION section.
.SH ERRORS
.sp
.LP
These functions will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
Invalid argument. For example, the property type does not match the interface.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBdi_prom_prop_lookup_bytes\fR(3DEVINFO), \fBdi_prop_next\fR(3DEVINFO),
\fBlibdevinfo\fR(3LIB), \fBattributes\fR(5)
.sp
.LP
\fIWriting Device Drivers\fR