Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought





   disk(7)                                                             disk(7)


   NAME
         disk - physical disk structures and I/O controls

   SYNOPSIS
         #include <sys/vtoc.h>
         #include <sys/extbus.h>

   DESCRIPTION
         System V release 4 supports a general administration interface for
         disks.  The interface is most often used by the utilities
          format (1M),
          setvtoc (1M) and
          prtvtoc.

         The disk-specific information is stored on the disk in several data
         structures that are manipulated using the I/O controls.

         The ioctls to the disk are issued in the following manner:

               ioctl(fd, command, io_arg);
               int fd;
               int command;
               struct io_arg *io_arg;

         The io_arg structure is provided as an interface structure which
         contains a pointer to and the size of the structure the user wishes
         to manipulate. For example, if the user wished to read the physical
         disk description sector (pdsector), the following would have to be
         set up before issuing the ioctl:

               struct pdsector pd;
               struct io_arg io_arg;

               io_arg.sectst = 0;
               io_arg.memaddr = (unsigned long) &pd;
               io_arg.datasz = sizeof(struct pdsector);
               io_arg.retval = 0;

         The ioctl can then be issued. It is always advisable to test the
         value returned in io_arg.retval as this also holds a return value. An
         ioctl to read the pdsector would for example be issued in the
         following way:

               if ((ioctl(fd, V_PDREAD, &io_arg) < 0) || (io_arg.retval))

         If any of the conditions were met then the ioctl would have failed.

         The ioctls to manipulate a given disk are (most of the ioctls require
         super-user privileges) :




   7/91                                                                 Page 1









   disk(7)                                                             disk(7)


         V_PREAD
               This command does a physical read of a specific block on the
               disk. When issued the io_arg.sectst is set to the sector number
               where the read should begin.

         V_PWRITE
               This command does a physical write of a specific block on the
               disk. When issued the io_arg.sectst is set to the sector number
               where the write should begin.

         V_PDREAD
               Read the physical description area (pdsector).

         V_PDWRITE
               Write a new physical description area (pdsector) to the disk.

         V_GETSSZ
               Get the sector size of media.

         V_RVTOC
               Read the volume table of contents (VTOC - partition table)

         V_WVTOC
               Write the volume table of contents to the disk.

         V_DRVTYPE
               Return information about the disk drive, ie model and serial
               number (see struct disk_details defined in vtoc.h).

         V_BADMEDIA
               Write media error information to the disk.

         V_SPARE
               Maps spare blocks on the disk to bad blocks.

         V_PDSET
               Set the physical description area (pdsector) in core only.

         V_FORMAT
               Issue a format command to the disk.

         V_PDSYNC
               Write the incore physical description area (pdsector) to the
               disk.

         V_SCSI
               Perform an individual SCSI command ie a mode sense. This
               command is only relevant to disks on a SCSI bus.





   Page 2                                                                 7/91









   disk(7)                                                             disk(7)


         Another important ioctl that does not take a third argument of struct
         io_arg *io_arg is:

         B_GETTYPE
               This ioctl takes an argument of struct bus_type *bus_type and
               is used to determine the controller/bus on the machine (see
               extbus.h).

         Most disk device drivers will only support a subset of these ioctls,
         because some overlap or are not required for a particular hardware
         implementation.

         The error codes returned in io_arg.retval are :  V_BADREAD and
         V_BADWRITE

   SEE ALSO
         format (1M), setvtoc (1M), prtvtoc (1M).




































   7/91                                                                 Page 3





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