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 October 23, 2017
  18 .Dt SESIO 7I
  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
  26 The
  27 .Nm ses
  28 device driver provides the following ioctls as a means to access
  29 SCSI enclosure services devices.
  30 .Sh IOCTLS
  31 The
  32 .Nm ses
  33 driver supports the following ioctls:
  34 .Bl -tag -width SES_IOCTL_GETSTATE
  35 .It Dv SES_IOCTL_GETSTATE
  36 This ioctl obtains enclosure state in the
  37 .Vt ses_ioctl
  38 structure.
  39 .It Dv SES_IOCTL_SETSTATE
  40 This ioctl is used to set parameters on the enclosure services device.
  41 The
  42 .Vt ses_ioctl
  43 structure is used to pass information into the driver.
  44 .El
  45 .Sh EXAMPLES
  46 .Bl -tag -width "Example 1"
  47 .It Sy "Example 1"
  48 Using the
  49 .Dv SES_IOCTL_GETSTATE
  50 ioctl
  51 .El
  52 .Pp
  53 The following example uses the
  54 .Dv SES_IOCTL_GETSTATE
  55 ioctl to recover 20 bytes of page 4 from a previously opened device.
  56 .Bd -literal -offset 2n
  57 char   abuf[30];
  58 struct ses_ioctl *sesp;
  59 int    status;
  60 
  61 sesp = (ses_ioctl *)abuf;
  62 sesp->size = 20;
  63 sesp->page_code = 4;
  64 status = ioctl(fd, SES_IOCTL_GETSTATE, abuf);
  65 .Ed
  66 .Sh ERRORS
  67 .Bl -tag -width ENOTTY
  68 .It Er EIO
  69 The
  70 .Nm ses
  71 driver was unable to obtain data from the enclosure services
  72 device or the  data transfer could not be completed.
  73 .It Er ENOTTY
  74 The
  75 .Nm ses
  76 driver does not support the requested ioctl function.
  77 .It Er ENXIO
  78 The enclosure services device does not exist.
  79 .It Er EFAULT
  80 The user specified a bad data length.
  81 .El
  82 .Sh STRUCTURES
  83 The
  84 .Vt ses_ioctl
  85 structure has the following fields:
  86 .Bd -literal -offset 2n
  87 uint32_t page_size;      /* Size of buffer that follows */
  88 uint8_t  page_code:      /* Page to be read/written */
  89 uint8_t  reserved[3];    /* Reserved; Set to 0 */
  90 .Ed
  91 .Sh ARCHITECTURE
  92 SPARC
  93 .Sh SEE ALSO
  94 .Xr ses 7D ,
  95 .Xr ioctl 9E