Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

prtvtoc(1M)

setvtoc(1M)

ioctl(2)





   format(1M)                                                       format(1M)


   NAME
         format - format a disk

   SYNOPSIS
         /sbin/format [-fprsw] [-d datafile] /dev/rdsk/c?d?s?

   DESCRIPTION
         The format command formats a disk device while also creating a block
         which describes the physical layout of the disk (the pdsector).
         format exec's a lower-level format program relating to the device
         driver for that particular device, passing on all the arguments
         given.  The lower-level format program lives in
         /usr/lib/disk_formats/bus/controller_type/format. The
         bus/controller_type part of the pathname is generated by issuing a
         B_GETTYPE ioctl.

         Each low-level format program can have one or more datafiles
         associated with it (in the same directory), holding details of the
         fields of the pdsector or formatting parameters for a given disk
         type.

         The /dev/rdsk/c?d?s?  file must be the character special file of the
         device to be formatted.

   OPTIONS
         The following options are recommended to apply to the lower-level
         format program:

         -f    read the pdsector, format the device, and write a pdsector to
               the disk

         -p    print out the data file name associated with the disk that is
               going to be opened and then exit.  This is useful for debugging
               purposes when adding a new disk to a given bus/controller_type

         -r    display the current contents of the pdsector

         -s    set the pdsector in the device driver - that is, the pdsector
               is not written

         -w    set the pdsector in the device driver and also write the
               pdsector to the disk

         -d datafile
               override default data file and use the named datafile instead

         The data file contains one specification line for each individual
         parameter to be set. Each line is delimited by a new line character
         (\n). If the first character of a line is a hash character (#), the
         line is treated as a comment. An example of an entry in a datafile
         would be:


   7/91                                                                 Page 1









   format(1M)                                                       format(1M)


           bytes_per_sector = 512

         Parsing of the datafile is up to the implementor of the low-level
         format program; however, a parsing routine called get_disk_info() is
         provided:

           #include "gf_defs.h"

           get_disk_info(char *datafile, struct disk_format_desc *disk_des)

         The arguments are:

         datafile
               the name of the datafile file

         disk_des
               a pointer to an array of structures containing a list of which
               fields are to be read from the datafile

         The disk_format_desc structure has the following elements:

         char *df_field_name
               the name of the field to be updated - for example,
               bytes_per_sector

         int df_format
               field type - HEX, DECIMAL, OCTAL or STRING

         union df_ident df_ident
               holds either an integer value or a pointer to a string for the
               field name

         int df_status
               a status value which is set to VAL_STAT(1) if the parsing
               routine managed to fill in the value correctly.  If the value
               to be used is expected to be in the data file, df_status should
               be initialized to INVAL_STAT(0).

         An example declaration of the parsing structures would be:

           struct disk_format_desc ddata_des[] = {
                 "bytes_per_sector", DECIMAL, 0, INVAL_STAT,
                 ""
           };

         After a format has been issued, it will necessary to run setvtoc in
         order for the disk to be populated with a VTOC (volume table of
         contents) defining partitions of the disk, etc.





   Page 2                                                                 7/91









   format(1M)                                                       format(1M)


   SEE ALSO
         prtvtoc(1M), setvtoc(1M), ioctl(2)

   NOTES
         In /usr/lib/disk_formats there is source for an example format
         program that can be used when designing a new format program for a
         particular device (if the implementor so wishes). The header file
         gf_defs.h is also located there.













































   7/91                                                                 Page 3





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