Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

devstr(1M)

ioctl(2)

dvh(4)



DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



NAME
     dkio - general disk ioctl interface

DESCRIPTION
     The interface for the ioctls to the disk drivers is:

          int ioctl (fildes, request, arg)

     Refer to ioctl(2) for more details.

     Unless otherwise specified, arg is a pointer to a structure
     of the form:


          struct io_arg {
                    int retval;
                    unsigned long sectest;
                    unsigned long memaddr;
                    unsigned long datasz;
          }

     The contents of this structure is dependent upon the value
     of the request.  Refer to <sys/dkio.h> and <sys/gen_ioctl.h>
     for the values of these requests.

     The interface will be describle according to each type of
     request.

   GIOCPRSTR
     arg points to the structure


          struct gioctl{
               union {
                    char strings[IDENT_LEN];
                    struct {
                         int retval;
                         int page_code;
                         int datasz;
                         int memaddr;
                    } modes;
               } gioc_info;
          }

     Returns controller and device info in an ascii string in the
     strings field.  This call is used by the devstr(1M) command
     which prints out the identification string returned by the
     device during system initialization.

   GIOCGETVAL
     It uses the same structure as was used for GIOCPRSTR.




                         Printed 1/28/91                   Page 1





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



          gioctl.gioc_info.modes.page_code = mode sense page code

          gioctl.gioc_info.modes.datasz = mode sense data size

          gioctl.gioc_info.modes.memaddr = mode sense page data
          address.

     This request gets the current SCSI modes.

     Superuser permission will be required.  If
     gioctl.gioc_info.modes.datasz is zero, the driver will
     return [EIO], and gioctl.gioc_info.modes.retval will be set
     to [GIOC_BADSIZE].

     The driver will issue a SCSI mode sense command for the
     desired pages and copyout the results to the page data
     address.  If the copyout fails, the driver will return [EIO]
     and set gioctl.gioc_info.modes.retval to [GIOC_OPERR].

   GIOCSETVAL
          gioctl.gioc_info.modes.page_code = mode sense page code

          gioctl.gioc_info.modes.datasz = mode sense data size

          gioctl.gioc_info.modes.memaddr = mode sense page data
          address.

     This request sets the current SCSI modes.  It uses the same
     gioctl structure as was used for GIOCPRSTR.

     Superuser permission will be required.  If
     gioctl.gioc_info.modes.datasz is less than or equal to
     sizeof(SCSI_MODE_SENSE), the driver will return [EIO], and
     gioctl.gioc_info.modes.retval will be set to [GIOC_BADSIZE].

     Only page codes PD_ERROR, PD_DISREC, and PD_CACHE are
     allowed.  The mode select header block descriptor length
     must be 8, and the mode select page descriptor page code
     must match gioctl.gioc_info.modes.page_code. Otherwise,
     [EIO] will be returned and gioctl.gioc_info.modes.retval
     will be set to [GIOC_EINVAL].

     The driver will copyin the page data and issue a SCSI mode
     select command for the desired page.  If copyin fails, the
     driver will return [EIO] and set
     gioctl.gioc_info.modes.retval to [GIOC_EFAULT].  If the SCSI
     mode select fails, the driver will return [EIO] and set
     gioctl.gioc_info.modes.retval to [GIOC_OPERR].

   DIOCFMTMAP
          io_arg.memaddr = pointer to struct fmt_map_info




 Page 2                  Printed 1/28/91





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



          io_arg.datsz = sizeof(struct fmt_map_info)

     The structure fmt_map_info is defined in <sys/dkio.h>

     Super-user permission will be required.

     If io_arg.datasz != sizeof( struct fmt_map_info), the driver
     will return [EIO] and io_arg.retval will be set to
     [DIOC_BADSIZE].

     If the device is busy, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_DISKBUSY].

     If there is an error during the copyin of the fmt_map_info
     structure, the driver will return [EIO] and io_arg.retval
     will be set to [DIOC_EFAULT].

     The field fmi_action in the fmt_map_info structure describes
     the desired format action.  If it isn't support for that
     particular device type, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_EINVAL].  SCSI disks sup-
     port FMI_FORMAT_TRACK, which formats the entire disk, and
     FMI_MAP_TRACK, which performs the "reassign blocks" command.
     SMD disks support FMI_FORMAT_TRACK, FMI_MAP_TRACK, and
     FMI_SLIP_SECTOR actions.

     If the operation fails, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_OPERR].

   DIOCVFYSEC
          io_arg.sectst = starting logical sector number

          io_arg.datasz = number of sectors

     If io_arg.datasz is 0, the driver will io_arg.retval will be
     set to [DIOC_BADSIZE].

     If the operation fails, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_OPERR].

   DIOCGETCTLR
          io_arg.memaddr = pointer to struct ctlr_info

          io_arg.datasz = sizeof( struct ctlr_info)

     The structure ctlr_info is defined in <sys/dkio.h>

     If io_arg.datasz != sizeof(struct ctlr_info), the driver
     will return [EIO] and io_arg.retval will be set to
     [DIOC_BADSIZE].





                         Printed 1/28/91                   Page 3





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



     The driver will fill in the struct ctlr_info and copyout the
     results to io_arg.memaddr. If copyout fails, the driver will
     return [EIO] and io_arg.retval will be set to [DIOC_EFAULT].

   DIOCGETVH
          io_arg.memaddr = pointer to struct volume_header

          io_arg.datasz = sizeof(struct volume_header)

     Refer to dvh(4) for details regarding the volume header.

     If io_arg.datasz does not equal sizeof(struct
     volume_header), the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_BADSIZE].

     This function will return the driver's idea of the volume
     header.  It will not be re-read from the device.  To do so,
     use the read(2) function.

     If the copyout of the volume header to io_arg.memaddr fails,
     the driver will return [EIO] and set io_arg.retval to
     [DIOC_EFAULT].

   DIOCSETVH,  DIOCINITVH or DIOCRECONFIG
          io_arg.memaddr = pointer to struct volume_header

          io_arg.datasz = sizeof(struct volume_header)

     Refer to dvh(4) for details regarding the volume header.

     If io_arg.datasz does not equal sizeof(struct
     volume_header), the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_BADSIZE].

     Superuser permission is required.

     This function will change the current contents of the volume
     header.  Only DIOCRECONFIG will re-write the volume header
     to the device and reconfigure the drive (if necessary).

     The driver will copyin from io_arg.memaddr to a per unit
     struct volume_header. If the copyin fails, the driver will
     return [EIO] and io_arg.retval will be set to [DIOC_EFAULT].

     If the volume header at io_arg.memaddr is invalid, the
     driver will return [EIO] and io_arg.retval will be set to
     [DIOC_NOVOLHDR].

   DIOCRDCAP
          io_arg.memaddr = pointer to
               struct {
                             int maxblock;



 Page 4                  Printed 1/28/91





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



                       int blocksize;
                      } readcap;

          io_arg.datasz = sizeof(struct readcap)

     If io_arg.datasz does not equal sizeof(struct readcap), the
     driver will return [EIO] and io_arg.retval will be set to
     [DIOC_BADSIZE].

     The driver will copyout the readcap structure that was read
     in during system initialization to io_arg.memaddr If the
     copyout fails, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_EFAULT].

   DIOCNOECC
          io_arg.sectst = flag

     The following bits are define for flag


          Bit 0   1       Turn off drive ECC and driver retries
                  0       Turn on drive ECC and retries
          Bit 1   1       Turn off driver retries
                  0       Turn on driver retries

     If unable to perform the operation, the driver will return
     [EIO] and io_arg.retval will be set to [DIOC_OPERR].

   DIOCRDEFECTS
          io_arg.memaddr = pointer to the defect structure.  (The
          actual structure is drive dependent).

          io_arg.datasz = sizeof the defect structure

          io_arg.sectst = flag

     The defect structure is compose of a defect header and an
     array of defect entries.  These individual structurs are
     define in <sys/dkio.h> For SCSI devices, flag will determine
     which defect list will be returned.  The following bits are
     defined for flag.


          0   Header defects
          1   Growth defects
          2   Primary defects
          3   All defects

     If io_arg.datasz is zero, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_BADSIZE].





                         Printed 1/28/91                   Page 5





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



     If flag is invalid, the driver will return [EIO] and
     io_arg.retval will be set to [DIOC_EINVAL].

     If the defects cannot be read, the driver will return [EIO]
     and io_arg.retval will be set to [DIOC_OPERR].

     The driver will copyout the defect structure to
     io_arg.memaddr. read(2) If the copyout of the volume header
     to io_arg.memaddr fails, the driver will return [EIO] and
     set io_arg.retval to [DIOC_EFAULT].

   DIOCSOFTCNT
          io_arg.sectst = flag

          io_arg.datasz = new value

          The value of the number of soft errors for the speci-
          fied drive is returned in io_arg.retval. If flag is
          non-zero, then the soft error count is reset to
          io_arg.datasz.

   DIOCSEEK
          io_arg.sectst = logical block to which to seek.

          This is only supported for SCSI drives.

     If the operation fails, the driver will return [EIO] and set
     io_arg.retval to [DIOC_OPERR].

   DIOCDISKCACHE
          io_arg.sectst = flag

     flag != 0    enable disk caching
     flag = 0     disable disk caching

     This is only supported for SCSI drives.

     This ioctl enables or disables disk on-board caching for the
     drive/controller.

     If the operation fails, the driver will return [EIO] and set
     io_arg.retval to [DIOC_OPERR].

   DIOCDISKGEOM
          io_arg.memaddr = pointer to struct geometry_info

          io_arg.datasz = sizeof( struct geometry_info)

     struct geometry_info is defined in <sys/dkio.h>

     This is only supported for SCSI drives.




 Page 6                  Printed 1/28/91





DKIO(7-SysV)        RISC/os Reference Manual         DKIO(7-SysV)



     If io_arg.datasz != sizeof(struct geometry_info), the driver
     will return [EIO] and io_arg.retval will be set to
     [DIOC_BADSIZE].

     The driver will fill in the structure from the data it read
     from the disk during system initialization.  The driver will
     copyout the data to io_arg.memaddr. If the copyout fails,
     the driver will return [EIO] and set io_arg.retval to
     [DIOC_EFAULT].

SEE ALSO
     devstr(1M).
     ioctl(2), dvh(4) in the Programmer's Reference Manual.










































                         Printed 1/28/91                   Page 7



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026