2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH CT_DEV_STATUS_GET_DEV_STATE 3CONTRACT "Aug 9, 2007"
8 ct_dev_status_get_dev_state, ct_dev_status_get_aset, ct_dev_status_get_minor,
9 ct_dev_status_get_noneg \- read contract status information from a status
14 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-D_LARGEFILE64_SOURCE\fR \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
15 #include <libcontract.h>
16 #include <sys/contract/device.h>
18 \fBint\fR \fBct_dev_status_get_dev_state\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
19 \fBuint_t *\fR\fIstatep\fR);
24 \fBint\fR \fBct_dev_status_get_aset\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
25 \fBuint_t *\fR\fIasetp\fR);
30 \fBint\fR \fBct_dev_status_get_minor\fR(\fBct_stathdl_t\fR \fIstathdl\fR, \fBchar *\fR\fIbuf\fR,
31 \fBsize_t *\fR\fIbuflenp\fR);
36 \fBint\fR \fBct_dev_status_get_noneg\fR(\fBct_stathdl_t\fR \fIstathdl\fR,
37 \fBuint_t *\fR\fInonegp\fR);
47 a pointer to a \fBuint_t\fR variable for receiving the acceptable state set
48 (such as A-set) for the contract
57 a buffer for receiving the \fBdevfs\fR path of a minor in a contract
66 a pointer to a variable of type \fBsize_t\fR for passing the size of the buffer
67 \fIbuf\fR. If the buffer is too small (< \fBPATH_MAX\fR), the minimum size of
68 the buffer needed (\fBPATH_MAX\fR) is passed back to the caller with this
78 a pointer to a \fBuint_t\fR variable for receiving the setting of the "noneg"
88 a status object returned by \fBct_status_read\fR(3CONTRACT)
97 a pointer to a \fBuint_t\fR variable for receiving the current state of the
98 device which is the subject of the contract
104 These functions read contract status information from a status object
105 \fIstathdl\fR returned by \fBct_status_read()\fR. The detail level in the call
106 to \fBct_status_read()\fR needs to be at least \fBCTD_FIXED\fR for the
107 following calls to be successful. The one exception is
108 \fBct_dev_status_get_minor()\fR, which requires a detail level of
112 The \fBct_dev_status_get_dev_state()\fR function returns the current state of
113 the device which is the subject of the contract. This can be one of the
118 \fB\fBCT_DEV_EV_ONLINE\fR\fR
121 The device is online and functioning normally.
127 \fB\fBCT_DEV_EV_DEGRADED\fR\fR
130 The device is online but degraded.
136 \fB\fBCT_DEV_EV_OFFLINE\fR\fR
139 The device is offline and not configured.
144 The \fBct_dev_status_get_aset()\fR function returns the A-set of the contract.
145 This can be the bitset of one or more of the following states:
146 \fBCT_DEV_EV_ONLINE\fR, \fBCT_DEV_EV_DEGRADED\fR, or \fBCT_DEV_EV_OFFLINE\fR.
149 The \fBct_dev_status_get_minor()\fR function reads the \fBdevfs\fR path of the
150 minor participating in the contract. The \fBdevfs\fR path returned does not
151 include the \fB/devices\fR prefix. If the buffer passed in by the caller is too
152 small (< \fBPATH_MAX\fR), the minimum size of the buffer required (
153 \fBPATH_MAX\fR) is returned to the caller via the \fIbuflenp\fR argument.
156 The \fBct_dev_status_get_noneg()\fR function returns the "noneg" setting for
157 the contract. A value of 1 is returned in the \fInonegp\fR argument if
158 \fBNONEG\fR is set, else 0 is returned.
162 Upon successful completion, these functions return 0. Otherwise, they return a
163 non-zero error value.
167 The \fBct_dev_status_get_minor()\fR function will fail if:
171 \fB\fBEOVERFLOW\fR\fR
174 The buffer size is too small to hold the result.
179 The \fBct_dev_status_get_dev_state()\fR, \fBct_dev_status_get_aset()\fR,
180 \fBct_dev_status_get_minor()\fR and \fBct_dev_status_get_noneg()\fR functions
188 An invalid argument was specified.
197 The requested data is not present in the status object.
203 See \fBattributes\fR(5) for descriptions of the following attributes:
211 ATTRIBUTE TYPE ATTRIBUTE VALUE
213 Interface Stability Committed
221 \fBct_status_free\fR(3CONTRACT), \fBct_status_read\fR(3CONTRACT),
222 \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBdevices\fR(4),
223 \fBattributes\fR(5), \fBlfcompile\fR(5)