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_TMPL_SET_ASET 3CONTRACT "Aug 9, 2007"
8 ct_dev_tmpl_set_aset, ct_dev_tmpl_get_aset, ct_dev_tmpl_set_minor,
9 ct_dev_tmpl_get_minor, ct_dev_tmpl_set_noneg, ct_dev_tmpl_clear_noneg,
10 ct_dev_tmpl_get_noneg \- device contract template functions
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 int ct_dev_tmpl_set_aset(int fd, uint_t aset);
23 \fBint\fR \fBct_dev_tmpl_get_aset\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fIasetp\fR);
28 \fBint\fR \fBct_dev_tmpl_set_minor\fR(\fBint\fR \fIfd\fR, \fBchar *\fR\fIminor\fR);
33 \fBint\fR \fBct_dev_tmpl_get_minor\fR(\fBint\fR \fIfd\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t *\fR\fIbuflenp\fR);
38 \fBint\fR \fBct_dev_tmpl_set_noneg\fR(\fBint\fR \fIfd\fR);
43 \fBint\fR \fBct_dev_tmpl_clear_noneg\fR(\fBint\fR \fIfd\fR);
48 \fBint\fR \fBct_dev_tmpl_get_noneg\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fInonegp\fR);
58 a bitset of one or more of device states
67 a pointer to a variable into which the current A-set is to be returned
76 a buffer into which the minor path is to be returned
85 a pointer to variable of type \fBsize_t\fR in which the size of the buffer
86 \fIbuf\fR is passed in. If the buffer is too small the size of the buffer
87 needed for a successful call is passed back to the caller.
96 a file descriptor from an open of the device contract template file in the
97 contract filesystem (ctfs)
106 the \fBdevfs\fR path (the \fB/devices\fR path without the "\fB/devices\fR"
107 prefix) of a minor which is to be the subject of a contract
116 a pointer to a \fIuint_t\fR variable for receiving the current setting of the
117 "nonnegotiable" term in the template
123 These functions read and write device contract terms and operate on device
124 contract template file descriptors obtained from the \fBcontract\fR(4)
128 The \fBct_dev_tmpl_set_aset()\fR and \fBct_dev_tmpl_get_aset()\fR functions
129 write and read the "acceptable states" set (or A-set for short). This is the
130 set of device states guaranteed by the contract. Any departure from these
131 states will result in the breaking of the contract and a delivery of a critical
132 contract event to the contract holder. The A-set value is a bitset of one or
133 more of the following device states: \fBCT_DEV_EV_ONLINE\fR,
134 \fBCT_DEV_EV_DEGRADED\fR, and \fBCT_DEV_EV_OFFLINE\fR.
137 The \fBct_dev_tmpl_set_minor()\fR and \fBct_dev_tmpl_get_minor()\fR functions
138 write and read the minor term (the device resource that is to be the subject of
139 the contract.) The value is a \fBdevfs\fR path to a device minor node (minus
140 the "\fB/devices\fR" prefix). For the \fBct_dev_tmpl_get_minor()\fR function, a
141 buffer at least \fBPATH_MAX\fR in size must be passed in. If the buffer is
142 smaller than \fBPATH_MAX\fR, then the minimum size of the buffer required
143 (\fBPATH_MAX\fR) for this function is passed back to the caller via the
144 \fIbuflenp\fR argument.
147 The \fBct_dev_tmpl_set_noneg()\fR and \fBct_dev_tmpl_get_noneg()\fR functions
148 write and read the nonnegotiable term. If this term is set, synchronous
149 negotiation events are automatically NACKed on behalf of the contract holder.
150 For \fBct_dev_tmpl_get_noneg()\fR, the variable pointed to by \fInonegp\fR is
151 set to 1 if the "noneg" term is set or to 0 otherwise. The
152 \fBct_dev_tmpl_clear_noneg()\fR term clears the nonnegotiable term from a
157 Upon successful completion, these functions return 0. Otherwise, they return a
158 non-zero error value.
162 The \fBct_dev_tmpl_set_aset()\fR function will fail if:
169 A template file descriptor or A-set is invalid
174 The \fBct_dev_tmpl_set_minor()\fR function will fail if:
181 One or more arguments is invalid.
190 The minor named by minor path does not exist.
195 The \fBct_dev_tmpl_set_noneg()\fR function will fail if:
202 A process lacks sufficient privilege to NACK a device state change.
207 The \fBct_dev_tmpl_get_aset()\fR and \fBct_dev_tmpl_get_minor()\fR functions
215 One or more arguments is invalid.
224 The requested term is not set.
229 The \fBct_dev_tmpl_get_noneg()\fR function will fail if:
236 One or more arguments is invalid.
241 The \fBct_dev_tmpl_get_minor()\fR function will fail if:
248 The supplied buffer is too small.
254 See \fBattributes\fR(5) for descriptions of the following attributes:
262 ATTRIBUTE TYPE ATTRIBUTE VALUE
264 Interface Stability Committed
272 \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBdevices\fR(4),
273 \fBattributes\fR(5), \fBlfcompile\fR(5)