home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 8 / IOPROG_8.ISO / install / fips / source / primpart.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-25  |  2.3 KB  |  84 lines

  1. /*
  2.  
  3.     FIPS - the First nondestructive Interactive Partition Splitting program
  4.  
  5.  
  6.  
  7.     Module hdstruct.h
  8.  
  9.  
  10.  
  11.     RCS - Header:
  12.  
  13.     $Id$
  14.  
  15.  
  16.  
  17.     Copyright (C) 1993 Arno Schaefer
  18.  
  19.  
  20.  
  21.     This program is free software; you can redistribute it and/or modify
  22.  
  23.     it under the terms of the GNU General Public License as published by
  24.  
  25.     the Free Software Foundation; either version 2 of the License, or
  26.  
  27.     (at your option) any later version.
  28.  
  29.  
  30.  
  31.     This program is distributed in the hope that it will be useful,
  32.  
  33.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  34.  
  35.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  36.  
  37.     GNU General Public License for more details.
  38.  
  39.  
  40.  
  41.     You should have received a copy of the GNU General Public License
  42.  
  43.     along with this program; if not, write to the Free Software
  44.  
  45.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  46.  
  47.  
  48.  
  49.  
  50.  
  51.     Report problems and direct all questions to:
  52.  
  53.  
  54.  
  55.     schaefer@rbg.informatik.th-darmstadt.de
  56.  
  57. */
  58.  
  59.  
  60.  
  61. /* ----------------------------------------------------------------------- */
  62.  
  63. /* Partition Class, derived from logical_drive and raw_partition           */
  64.  
  65. /* Represents one primary DOS partition. Read_sector() and write_sector()  */
  66.  
  67. /* are instances of the virtual functions in the logical_drive class       */
  68.  
  69. /* ----------------------------------------------------------------------- */
  70.  
  71.  
  72.  
  73. #ifndef PRIMPART_H
  74.  
  75. #define PRIMPART_H
  76.  
  77.  
  78.  
  79. #include "types.h"
  80.  
  81. #include "disk_io.h"
  82.  
  83. #include "logdr_st.h"
  84.  
  85. #include "hdstruct.h"
  86.  
  87.  
  88.  
  89. class partition:public logical_drive
  90.  
  91. {
  92.  
  93. public:
  94.  
  95.     int number;
  96.  
  97.     physical_drive *drive;
  98.  
  99.     partition_info *partition_info;
  100.  
  101.  
  102.  
  103.     int read_sector (dword number, sector *sector)
  104.  
  105.     {
  106.  
  107.         return (drive->read_sector
  108.  
  109.         (
  110.  
  111.             sector,
  112.  
  113.             partition_info->start_sector_abs
  114.  
  115.             + number
  116.  
  117.         ));
  118.  
  119.     }
  120.  
  121.     int write_sector (dword number, sector *sector)
  122.  
  123.     {
  124.  
  125.         return (drive->write_sector
  126.  
  127.         (
  128.  
  129.             sector,
  130.  
  131.             partition_info->start_sector_abs
  132.  
  133.             + number
  134.  
  135.         ));
  136.  
  137.     }
  138.  
  139.  
  140.  
  141.     partition (class harddrive *drive, int number)
  142.  
  143.     {
  144.  
  145.         partition::number = number;
  146.  
  147.         partition::drive = drive;
  148.  
  149.         partition_info =
  150.  
  151.             &(drive->partition_table().partition_info[number]);
  152.  
  153.  
  154.  
  155.         boot_sector = new class boot_sector (this);
  156.  
  157.     }
  158.  
  159.     ~partition (void) { delete boot_sector; }
  160.  
  161. };
  162.  
  163.  
  164.  
  165. #endif
  166.  
  167.