2004-09-19 14:24:53 -06:00
|
|
|
/* Copyright (C) 2004 Bart
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* READ THIS!!
|
2004-10-02 13:30:20 -06:00
|
|
|
* Partition isn't really a partition. It's more like a geometry, a continuous part of the disk.
|
|
|
|
* I use it to represent partitions as well as unallocated spaces
|
2004-09-19 14:24:53 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PARTITION
|
|
|
|
#define PARTITION
|
|
|
|
|
2004-10-06 09:32:40 -06:00
|
|
|
#include "../include/Utils.h"
|
2004-09-20 09:46:21 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
2005-12-07 04:21:27 -07:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
enum PartitionType {
|
2005-12-07 04:21:27 -07:00
|
|
|
TYPE_PRIMARY = 0,
|
|
|
|
TYPE_LOGICAL = 1,
|
|
|
|
TYPE_EXTENDED = 2,
|
|
|
|
TYPE_UNALLOCATED = 3
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
|
2004-09-25 08:12:07 -06:00
|
|
|
enum PartitionStatus {
|
|
|
|
STAT_REAL = 1,
|
|
|
|
STAT_NEW = 2,
|
|
|
|
STAT_COPY = 3
|
|
|
|
};
|
|
|
|
|
2004-10-06 09:32:40 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
class Partition
|
|
|
|
{
|
|
|
|
public:
|
2005-12-23 17:06:05 -07:00
|
|
|
Partition() ;
|
|
|
|
~Partition() ;
|
2004-10-11 04:23:24 -06:00
|
|
|
|
2005-12-23 17:06:05 -07:00
|
|
|
void Reset() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//simple Set-functions. only for convenience, since most members are public
|
2005-12-07 15:44:40 -07:00
|
|
|
void Set( const Glib::ustring & device_path,
|
|
|
|
const Glib::ustring & partition,
|
2005-12-23 17:06:05 -07:00
|
|
|
int partition_number,
|
|
|
|
PartitionType type,
|
|
|
|
FILESYSTEM filesystem,
|
|
|
|
Sector sector_start,
|
|
|
|
Sector sector_end,
|
|
|
|
bool inside_extended,
|
|
|
|
bool busy ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-11-21 14:49:38 -07:00
|
|
|
void Set_Unused( Sector sectors_unused ) ;
|
2004-10-11 04:23:24 -06:00
|
|
|
|
2005-12-07 15:44:40 -07:00
|
|
|
void Set_Unallocated( const Glib::ustring & device_path, Sector sector_start, Sector sector_end, bool inside_extended );
|
2004-10-11 04:23:24 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
//update partition number (used when a logical partition is deleted)
|
|
|
|
void Update_Number( int new_number );
|
|
|
|
|
2005-12-23 17:06:05 -07:00
|
|
|
long Get_Length_MB() const ;
|
|
|
|
long Get_Used_MB() const ;
|
|
|
|
long Get_Unused_MB() const ;
|
2006-01-04 11:54:46 -07:00
|
|
|
Sector get_length() const ;
|
2005-12-22 15:20:55 -07:00
|
|
|
|
2005-12-23 17:06:05 -07:00
|
|
|
bool operator==( const Partition & partition ) const ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//some public members
|
|
|
|
Glib::ustring partition;//the symbolic path (e.g. /dev/hda1 )
|
2005-12-07 15:44:40 -07:00
|
|
|
Glib::ustring device_path ;
|
2004-09-19 14:24:53 -06:00
|
|
|
int partition_number;
|
|
|
|
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
|
2004-09-25 08:12:07 -06:00
|
|
|
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..
|
2005-12-07 04:21:27 -07:00
|
|
|
FILESYSTEM filesystem ;
|
2004-09-19 14:24:53 -06:00
|
|
|
Sector sector_start;
|
|
|
|
Sector sector_end;
|
|
|
|
Sector sectors_used;
|
|
|
|
Sector sectors_unused;
|
|
|
|
Gdk::Color color;
|
2005-12-23 17:06:05 -07:00
|
|
|
bool inside_extended;
|
2004-09-19 14:24:53 -06:00
|
|
|
bool busy;
|
|
|
|
Glib::ustring error;
|
|
|
|
Glib::ustring flags;
|
2005-12-08 10:03:29 -07:00
|
|
|
Glib::ustring mountpoint ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-11-06 04:55:03 -07:00
|
|
|
std::vector<Partition> logicals ;
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}//GParted
|
|
|
|
#endif //PARTITION
|