xref: /illumos-gate/usr/src/man/man4i/sesio.4i (revision dd72704bd9e794056c558153663c739e2012d721)
1.\"  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
2.\"  Copyright (c) 2017, Joyent, Inc.
3.\" The contents of this file are subject to the terms of the
4.\" Common Development and Distribution License (the "License").
5.\" You may not use this file except in compliance with the License.
6.\"
7.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8.\" or http://www.opensolaris.org/os/licensing.
9.\" See the License for the specific language governing permissions
10.\" and limitations under the License.
11.\"
12.\" When distributing Covered Code, include this CDDL HEADER in each
13.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14.\" If applicable, add the following below this CDDL HEADER, with the
15.\" fields enclosed by brackets "[]" replaced with your own identifying
16.\" information: Portions Copyright [yyyy] [name of copyright owner]
17.Dd March 13, 2022
18.Dt SESIO 4I
19.Os
20.Sh NAME
21.Nm sesio
22.Nd enclosure services device driver interface
23.Sh SYNOPSIS
24.In sys/scsi/targets/sesio.h
25.Sh DESCRIPTION
26The
27.Nm ses
28device driver provides the following ioctls as a means to access
29SCSI enclosure services devices.
30.Sh IOCTLS
31The
32.Nm ses
33driver supports the following ioctls:
34.Bl -tag -width SES_IOCTL_GETSTATE
35.It Dv SES_IOCTL_GETSTATE
36This ioctl obtains enclosure state in the
37.Vt ses_ioctl
38structure.
39.It Dv SES_IOCTL_SETSTATE
40This ioctl is used to set parameters on the enclosure services device.
41The
42.Vt ses_ioctl
43structure is used to pass information into the driver.
44.El
45.Sh EXAMPLES
46.Bl -tag -width "Example 1"
47.It Sy "Example 1"
48Using the
49.Dv SES_IOCTL_GETSTATE
50ioctl
51.El
52.Pp
53The following example uses the
54.Dv SES_IOCTL_GETSTATE
55ioctl to recover 20 bytes of page 4 from a previously opened device.
56.Bd -literal -offset 2n
57char   abuf[30];
58struct ses_ioctl *sesp;
59int    status;
60
61sesp = (ses_ioctl *)abuf;
62sesp->size = 20;
63sesp->page_code = 4;
64status = ioctl(fd, SES_IOCTL_GETSTATE, abuf);
65.Ed
66.Sh ERRORS
67.Bl -tag -width ENOTTY
68.It Er EIO
69The
70.Nm ses
71driver was unable to obtain data from the enclosure services
72device or the  data transfer could not be completed.
73.It Er ENOTTY
74The
75.Nm ses
76driver does not support the requested ioctl function.
77.It Er ENXIO
78The enclosure services device does not exist.
79.It Er EFAULT
80The user specified a bad data length.
81.El
82.Sh STRUCTURES
83The
84.Vt ses_ioctl
85structure has the following fields:
86.Bd -literal -offset 2n
87uint32_t page_size;      /* Size of buffer that follows */
88uint8_t  page_code:      /* Page to be read/written */
89uint8_t  reserved[3];    /* Reserved; Set to 0 */
90.Ed
91.Sh ARCHITECTURE
92SPARC
93X86
94.Sh SEE ALSO
95.Xr ioctl 2 ,
96.Xr ses 4D
97