disk.h revision 7e7bd3dccbfe8f79e25e5c1554b5bc3a9aaca321
/*
libparted - a library for manipulating disk partitions
Copyright (C) 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \addtogroup PedDisk
* @{
*/
/** \file disk.h */
#ifndef PED_DISK_H_INCLUDED
#define PED_DISK_H_INCLUDED
/**
* Partition types
*/
enum _PedPartitionType {
PED_PARTITION_NORMAL = 0x00,
PED_PARTITION_LOGICAL = 0x01,
PED_PARTITION_EXTENDED = 0x02,
PED_PARTITION_FREESPACE = 0x04,
PED_PARTITION_METADATA = 0x08,
PED_PARTITION_PROTECTED = 0x10
};
/**
* Partition flags.
*/
enum _PedPartitionFlag {
};
enum _PedDiskTypeFeature {
};
struct _PedDisk;
struct _PedPartition;
struct _PedDiskOps;
struct _PedDiskType;
struct _PedDiskArchOps;
typedef enum _PedPartitionType PedPartitionType;
typedef enum _PedPartitionFlag PedPartitionFlag;
typedef enum _PedDiskTypeFeature PedDiskTypeFeature;
typedef struct _PedPartition PedPartition;
typedef const struct _PedDiskOps PedDiskOps;
typedef struct _PedDiskType PedDiskType;
typedef const struct _PedDiskArchOps PedDiskArchOps;
/** @} */
/**
* \addtogroup PedPartition
*
* @{
*/
/** \file disk.h */
/**
* PedPartition structure represents a partition.
*/
struct _PedPartition {
/**< the partition table of the partition */
/**< the partition number: In Linux, this is the
same as the minor number. No assumption
should be made about "num" and "type"
- different disk labels have different rules. */
int num;
PED_PARTITION_LOGICAL, PED_PARTITION_EXTENDED,
PED_PARTITION_METADATA
and PED_PARTITION_FREESPACE.
Both the first two, and the last two are
mutually exclusive.
An extended partition is a primary
partition that may contain logical partitions.
There is at most one extended partition on
a disk.
A logical partition is like a primary
partition, except it's inside an extended
partition. Internally, pseudo partitions are
allocated to represent free space, or disk
label meta-data. These have the
PED_PARTITION_FREESPACE or
PED_PARTITION_METADATA bit set. */
/**< The type of file system on the partition. NULL if unknown. */
const PedFileSystemType* fs_type;
/**< Only used for an extended partition. The list of logical
partitions (and free space and metadata within the extended
partition). */
void* disk_specific;
};
/** @} */
/**
* \addtogroup PedDisk
* @{
*/
/**
* Represents a disk label (partition table).
*/
struct _PedDisk {
partition table lies */
const int* block_sizes; /**< block sizes supported
by this label */
ped_disk_next_partition() */
void* disk_specific;
/* office use only ;-) */
int needs_clobber; /**< clobber before write? */
int update_mode; /**< mode without free/metadata
partitions, for easier
update */
};
struct _PedDiskOps {
/* disk label operations */
/** \todo add label guessing op here */
/* partition operations */
PedPartition* (*partition_new) (
const PedFileSystemType* fs_type,
const PedFileSystemType* fs_type);
int (*partition_set_flag) (
int state);
int (*partition_get_flag) (
const PedPartition* part,
int (*partition_is_flag_available) (
const PedPartition* part,
const PedConstraint* constraint);
/* other */
};
struct _PedDiskType {
const char* name; /**< the name of the partition table type.
\todo not very intuitive name */
PedDiskOps* const ops;
};
/**
* Architecture-specific operations. i.e. communication with kernel (or
* whatever) about changes, etc.
*/
struct _PedDiskArchOps {
};
const PedDiskType* exclude);
const PedDiskType* disk_type);
/** @} */
/**
* \addtogroup PedPartition
*
* @{
*/
const PedFileSystemType* fs_type,
int state);
const PedFileSystemType* fs_type);
/** @} */
/**
* \addtogroup PedDisk
* @{
*/
const PedConstraint* constraint);
const PedConstraint* constraint,
const PedConstraint* constraint);
const PedPartition* part);
/* internal functions */
/** @} */
/**
* \addtogroup PedPartition
*
* @{
*/
const PedFileSystemType* fs_type,
extern int _ped_partition_attempt_align (
#endif /* PED_DISK_H_INCLUDED */
/** @} */