home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1035 / fdisk.c < prev    next >
C/C++ Source or Header  |  1990-12-28  |  2KB  |  98 lines

  1. /***************************************************************
  2.  *    Fdisk Prototype
  3.  ***************************************************************
  4.  *
  5.  *    Revision Control Information
  6.  *
  7.  *    By:        $Author: root $
  8.  *            $Revision: 1.2 $
  9.  *    Last modified:    $Date: 87/09/16 02:12:16 $
  10.  *    $Source: /u/src/microport/newfdisk/test/RCS/fdisk.c,v $
  11.  *
  12.  *    Release state:    $State: Exp $
  13.  *
  14.  ***************************************************************
  15.  *
  16.  * Modification Log
  17.  * ----------------
  18.  * $Log:    fdisk.c,v $
  19.  * Revision 1.2  87/09/16  02:12:16  root
  20.  * maintenance update
  21.  * 
  22.  * Revision 1.1  88/04/07  23:10:47  root
  23.  * Initial revision
  24.  * 
  25.  * 
  26.  ***************************************************************
  27.  *
  28.  *    Get Master Boot Block which contains
  29.  *        * possable disk geometry info
  30.  *          Partition structure
  31.  *          MBB signature
  32.  *
  33.  *    If MBB not valid:    (Newly formatted disk)
  34.  *          Get disk geometry from user
  35.  *          Get partition table info from user
  36.  *          Get Slice Table from user
  37.  *          initialize MBB with contents of /etc/master.bblock
  38.  *          initialize PBB
  39.  *          initialize PER
  40.  *          initialize BTT
  41.  *          initialize SLICE TABLE
  42.  *          Recalibrate drive
  43.  *
  44.  *    else (MBB is valid)
  45.  *          get PBB
  46.  *          get PER
  47.  *          get BTT
  48.  *          get SLICE TABLE
  49.  *          get disk geometry from PER/PBB/MBB/cmos
  50.  *
  51.  *    Allow user to modify:
  52.  *        Drive type:            invalidates MBB,PBB,PER
  53.  *        Partition table from MBB:    if act part changes,
  54.  *                         PER&BTT need to be redone
  55.  *        BTT:                nothing invalidated.
  56.  *        PER:?
  57.  *        SLICE TABLE:            need to mkfs the thing...
  58.  ***************************************************************
  59.  */
  60. #ifndef lint
  61.     static char rcsid[] =
  62.     "$Header: fdisk.c,v 1.2 87/09/16 02:12:16 root Exp $";
  63. #endif
  64.  
  65. #include <fcntl.h>
  66. #include <errno.h>
  67. #include <sys/param.h>
  68. #include <sys/types.h>
  69. #include <malloc.h>
  70. #include "cmos.h"        /* cmos layout */
  71. #include "mbb.h"        /* master boot block */
  72. #include "pbb.h"        /* partition boot block */
  73. #include "btt.h"        /* bad track table */
  74. #include "per.h"        /* partition end record */
  75.  
  76. #include "fdisk.h"
  77.  
  78. cmos_t cmos;    /* CMOS contents */
  79. mbb_t mbb;    /* Master Boot Block */
  80. pbb_t pbb;    /* Partition Boot Block */
  81. btt_t btt;    /* Bad Track Table */
  82. per_t per;    /* Partition End Record */
  83.  
  84. main() {
  85.  
  86.     int cc;
  87.  
  88.     cc  = openunit( 0 );
  89.     cc |= get_cmos( &cmos );
  90.     cc |= get_mbb( 0, &mbb );
  91.     cc |= get_pbb( 0, &mbb, &pbb );
  92.     cc |= get_per( 0, &mbb, &per );
  93.     cc |= get_btt( 0, &mbb, &btt );
  94.     cc |= closeunit( 0 );
  95.  
  96. }
  97.  
  98.