CT_DEV_STATUS_GET_DEV_STATE(3CONTRACT) | Contract Management Library Functions | CT_DEV_STATUS_GET_DEV_STATE(3CONTRACT) |
ct_dev_status_get_dev_state, ct_dev_status_get_aset, ct_dev_status_get_minor, ct_dev_status_get_noneg - read contract status information from a status object
cc [ flag... ] file... -D_LARGEFILE64_SOURCE -lcontract [ library... ] #include <libcontract.h> #include <sys/contract/device.h> int ct_dev_status_get_dev_state(ct_stathdl_t stathdl,
uint_t *statep);
int ct_dev_status_get_aset(ct_stathdl_t stathdl,
uint_t *asetp);
int ct_dev_status_get_minor(ct_stathdl_t stathdl, char *buf,
size_t *buflenp);
int ct_dev_status_get_noneg(ct_stathdl_t stathdl,
uint_t *nonegp);
asetp
buf
buflenp
nonegp
stathdl
statep
These functions read contract status information from a status object stathdl returned by ct_status_read(). The detail level in the call to ct_status_read() needs to be at least CTD_FIXED for the following calls to be successful. The one exception is ct_dev_status_get_minor(), which requires a detail level of CTD_ALL.
The ct_dev_status_get_dev_state() function returns the current state of the device which is the subject of the contract. This can be one of the following:
CT_DEV_EV_ONLINE
CT_DEV_EV_DEGRADED
CT_DEV_EV_OFFLINE
The ct_dev_status_get_aset() function returns the A-set of the contract. This can be the bitset of one or more of the following states: CT_DEV_EV_ONLINE, CT_DEV_EV_DEGRADED, or CT_DEV_EV_OFFLINE.
The ct_dev_status_get_minor() function reads the devfs path of the minor participating in the contract. The devfs path returned does not include the /devices prefix. If the buffer passed in by the caller is too small (< PATH_MAX), the minimum size of the buffer required ( PATH_MAX) is returned to the caller via the buflenp argument.
The ct_dev_status_get_noneg() function returns the "noneg" setting for the contract. A value of 1 is returned in the nonegp argument if NONEG is set, else 0 is returned.
Upon successful completion, these functions return 0. Otherwise, they return a non-zero error value.
The ct_dev_status_get_minor() function will fail if:
EOVERFLOW
The ct_dev_status_get_dev_state(), ct_dev_status_get_aset(), ct_dev_status_get_minor() and ct_dev_status_get_noneg() functions will fail if:
EINVAL
ENOENT
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Committed |
MT-Level | Safe |
ct_status_free(3CONTRACT), ct_status_read(3CONTRACT), libcontract(3LIB), contract(5), devices(5), attributes(7), lfcompile(7)
August 9, 2007 | OmniOS |