Copyright (c) 1997, 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]
#include <sys/sesio.h>
The ses device driver provides the following ioctls as a means to access SCSI enclosure services devices.
The ses driver supports the following ioctls:
SES_IOCTL_GETSTATE
This ioctl obtains enclosure state in the ses_ioctl structure.
SES_IOCTL_SETSTATE
This ioctl is used to set parameters on the enclosure services device. The ses_ioctl structure is used to pass information into the driver.
EIO
The ses driver was unable to obtain data from the enclosure services device or the data transfer could not be completed.
ENOTTY
The ses driver does not support the requested ioctl function.
ENXIO
The enclosure services device does not exist.
EFAULT
The user specified a bad data length.
The ses_ioctl structure has the following fields:
uint32_t; /* Size of buffer that follows */ uint8_t page_code: /* Page to be read/written */ uint8_t reserved[3]; /* Reserved; Set to 0 */ unit8t buffer[1]; /* Size arbitrary, user specifies */
Example 1 Using the SES_IOCTL_GETSTATE ioctl
The following example uses the SES_IOCTL_GETSTATE ioctl to recover 20 bytes of page 4 from a previously opened device.
char abuf[30]; struct ses_ioctl *sesp; int status; sesp = (ses_ioctl *)abuf; sesp->size = 20; sesp->page_code = 4; status = ioctl(fd, SES_IOCTL_GETSTATE, abuf);
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Architecture | SPARC |
ses(7D), ioctl(9E)