'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. .TH ct_dev_tmpl_set_aset 3CONTRACT "9 Aug 2007" "SunOS 5.11" "Contract Management Library Functions" .SH NAME ct_dev_tmpl_set_aset, ct_dev_tmpl_get_aset, ct_dev_tmpl_set_minor, ct_dev_tmpl_get_minor, ct_dev_tmpl_set_noneg, ct_dev_tmpl_clear_noneg, ct_dev_tmpl_get_noneg \- device contract template functions .SH SYNOPSIS .LP .nf cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-D_LARGEFILE64_SOURCE\fR \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ] #include #include int ct_dev_tmpl_set_aset(int fd, uint_t aset); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_get_aset\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fIasetp\fR); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_set_minor\fR(\fBint\fR \fIfd\fR, \fBchar *\fR\fIminor\fR); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_get_minor\fR(\fBint\fR \fIfd\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t *\fR\fIbuflenp\fR); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_set_noneg\fR(\fBint\fR \fIfd\fR); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_clear_noneg\fR(\fBint\fR \fIfd\fR); .fi .LP .nf \fBint\fR \fBct_dev_tmpl_get_noneg\fR(\fBint\fR \fIfd\fR, \fBuint_t *\fR\fInonegp\fR); .fi .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIaset\fR\fR .ad .RS 11n .rt a bitset of one or more of device states .RE .sp .ne 2 .mk .na \fB\fIasetp\fR\fR .ad .RS 11n .rt a pointer to a variable into which the current A-set is to be returned .RE .sp .ne 2 .mk .na \fB\fIbuf\fR\fR .ad .RS 11n .rt a buffer into which the minor path is to be returned .RE .sp .ne 2 .mk .na \fB\fIbuflenp\fR\fR .ad .RS 11n .rt a pointer to variable of type \fBsize_t\fR in which the size of the buffer \fIbuf\fR is passed in. If the buffer is too small the size of the buffer needed for a successful call is passed back to the caller. .RE .sp .ne 2 .mk .na \fB\fIfd\fR\fR .ad .RS 11n .rt a file descriptor from an open of the device contract template file in the contract filesystem (ctfs) .RE .sp .ne 2 .mk .na \fB\fIminor\fR\fR .ad .RS 11n .rt the \fBdevfs\fR path (the \fB/devices\fR path without the "\fB/devices\fR" prefix) of a minor which is to be the subject of a contract .RE .sp .ne 2 .mk .na \fB\fInonegp\fR\fR .ad .RS 11n .rt a pointer to a \fIuint_t\fR variable for receiving the current setting of the "nonnegotiable" term in the template .RE .SH DESCRIPTION .sp .LP These functions read and write device contract terms and operate on device contract template file descriptors obtained from the \fBcontract\fR(4) filesystem (ctfs). .sp .LP The \fBct_dev_tmpl_set_aset()\fR and \fBct_dev_tmpl_get_aset()\fR functions write and read the "acceptable states" set (or A-set for short). This is the set of device states guaranteed by the contract. Any departure from these states will result in the breaking of the contract and a delivery of a critical contract event to the contract holder. The A-set value is a bitset of one or more of the following device states: \fBCT_DEV_EV_ONLINE\fR, \fBCT_DEV_EV_DEGRADED\fR, and \fBCT_DEV_EV_OFFLINE\fR. .sp .LP The \fBct_dev_tmpl_set_minor()\fR and \fBct_dev_tmpl_get_minor()\fR functions write and read the minor term (the device resource that is to be the subject of the contract.) The value is a \fBdevfs\fR path to a device minor node (minus the "\fB/devices\fR" prefix). For the \fBct_dev_tmpl_get_minor()\fR function, a buffer at least \fBPATH_MAX\fR in size must be passed in. If the buffer is smaller than \fBPATH_MAX\fR, then the minimum size of the buffer required (\fBPATH_MAX\fR) for this function is passed back to the caller via the \fIbuflenp\fR argument. .sp .LP The \fBct_dev_tmpl_set_noneg()\fR and \fBct_dev_tmpl_get_noneg()\fR functions write and read the nonnegotiable term. If this term is set, synchronous negotiation events are automatically NACKed on behalf of the contract holder. For \fBct_dev_tmpl_get_noneg()\fR, the variable pointed to by \fInonegp\fR is set to 1 if the "noneg" term is set or to 0 otherwise. The \fBct_dev_tmpl_clear_noneg()\fR term clears the nonnegotiable term from a template. .SH RETURN VALUES .sp .LP Upon successful completion, these functions return 0. Otherwise, they return a non-zero error value. .SH ERRORS .sp .LP The \fBct_dev_tmpl_set_aset()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt A template file descriptor or A-set is invalid .RE .sp .LP The \fBct_dev_tmpl_set_minor()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt One or more arguments is invalid. .RE .sp .ne 2 .mk .na \fB\fBENXIO\fR\fR .ad .RS 10n .rt The minor named by minor path does not exist. .RE .sp .LP The \fBct_dev_tmpl_set_noneg()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 9n .rt A process lacks sufficient privilege to NACK a device state change. .RE .sp .LP The \fBct_dev_tmpl_get_aset()\fR and \fBct_dev_tmpl_get_minor()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt One or more arguments is invalid. .RE .sp .ne 2 .mk .na \fB\fBENOENT\fR\fR .ad .RS 10n .rt The requested term is not set. .RE .sp .LP The \fBct_dev_tmpl_get_noneg()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt One or more arguments is invalid. .RE .sp .LP The \fBct_dev_tmpl_get_minor()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEOVEFLOW\fR\fR .ad .RS 12n .rt The supplied buffer is too small. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBdevices\fR(4), \fBattributes\fR(5), \fBlfcompile\fR(5)