| libldm Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | ||||
#include <ldm.h> #define IS_LDM (obj) #define IS_LDM_CLASS (klass) struct LDM; struct LDMDisk; struct LDMDiskGroup; enum LDMError; struct LDMPartition; LDMPrivate; struct LDMVolume; enum LDMVolumeType; #define LDM_CAST (obj) #define LDM_CLASS (klass) #define LDM_GET_CLASS (obj) #define LDM_TYPE gboolean ldm_add (LDM *o,const gchar *path,GError **err); gboolean ldm_add_fd (LDM *o,int fd,guint secsize,const gchar *path,GError **err); guint64 ldm_disk_get_data_size (const LDMDisk *o); guint64 ldm_disk_get_data_start (const LDMDisk *o); gchar * ldm_disk_get_device (const LDMDisk *o); gchar * ldm_disk_get_guid (const LDMDisk *o); guint64 ldm_disk_get_metadata_size (const LDMDisk *o); guint64 ldm_disk_get_metadata_start (const LDMDisk *o); gchar * ldm_disk_get_name (const LDMDisk *o); GArray * ldm_disk_group_get_disks (LDMDiskGroup *o); gchar * ldm_disk_group_get_guid (const LDMDiskGroup *o); gchar * ldm_disk_group_get_name (const LDMDiskGroup *o); GArray * ldm_disk_group_get_partitions (LDMDiskGroup *o); GArray * ldm_disk_group_get_volumes (LDMDiskGroup *o); GQuark ldm_error_quark (void); GArray * ldm_get_disk_groups (LDM *o); GType ldm_get_type (void); LDM * ldm_new (); LDMDisk * ldm_partition_get_disk (LDMPartition *o); gchar * ldm_partition_get_name (const LDMPartition *o); guint64 ldm_partition_get_size (const LDMPartition *o); guint64 ldm_partition_get_start (const LDMPartition *o); gboolean ldm_volume_dm_create (const LDMVolume *o,GString **created,GError **err); GString * ldm_volume_dm_get_name (const LDMVolume *o); gboolean ldm_volume_dm_remove (const LDMVolume *o,GString **removed,GError **err); guint64 ldm_volume_get_chunk_size (const LDMVolume *o); gchar * ldm_volume_get_hint (const LDMVolume *o); gchar * ldm_volume_get_name (const LDMVolume *o); guint8 ldm_volume_get_part_type (const LDMVolume *o); GArray * ldm_volume_get_partitions (LDMVolume *o); guint64 ldm_volume_get_size (const LDMVolume *o); LDMVolumeType ldm_volume_get_voltype (const LDMVolume *o);
GObject +----LDM
GObject +----LDMDiskGroup
GEnum +----LDMError
GEnum +----LDMVolumeType
typedef enum {
LDM_ERROR_INTERNAL,
LDM_ERROR_IO,
LDM_ERROR_NOT_LDM,
LDM_ERROR_INVALID,
LDM_ERROR_INCONSISTENT,
LDM_ERROR_NOTSUPPORTED,
LDM_ERROR_MISSING_DISK,
LDM_ERROR_EXTERNAL
} LDMError;
| An internal error | |
| There was an IO error accessing a device | |
| The device is not part of an LDM disk group | |
| The LDM metadata is corrupt | |
| Detected two disks from the same disk group with inconsistent metadata | |
| Unsupported LDM metadata | |
| A disk is missing from a disk group | |
| An error reported by an external library |
struct LDMPartition {
GObject parent;
LDMPartitionPrivate *priv;
};
An LDM Parition.
typedef enum {
LDM_VOLUME_TYPE_SIMPLE,
LDM_VOLUME_TYPE_SPANNED,
LDM_VOLUME_TYPE_STRIPED,
LDM_VOLUME_TYPE_MIRRORED,
LDM_VOLUME_TYPE_RAID5
} LDMVolumeType;
gboolean ldm_add (LDM *o,const gchar *path,GError **err);
Scan device path and add its metadata to LDM object o.
|
An LDM object |
|
The path of the device |
|
A GError to receive any generated errors |
Returns : |
true on success, false on error |
gboolean ldm_add_fd (LDM *o,int fd,guint secsize,const gchar *path,GError **err);
Scan a device which has been previously opened for reading and add its
metadata to LDM object o.
|
An LDM object |
|
A file descriptor for reading from the device |
|
The size of a sector on the device |
|
The path of the device (for messages) |
|
A GError to receive any generated errors |
Returns : |
true on success, false on error |
guint64 ldm_disk_get_data_size (const LDMDisk *o);
Get the size, in sectors, of the data portion of a disk.
|
An LDMDisk |
Returns : |
The size in sectors |
guint64 ldm_disk_get_data_start (const LDMDisk *o);
Get the start sector of the data portion of a disk.
|
An LDMDisk |
Returns : |
The start sector |
gchar * ldm_disk_get_device (const LDMDisk *o);
Get the name of the host device (e.g. /dev/sda) of a disk. This will be NULL if the disk has been identified from metadata on another disk, but has not been discovered during scanning.
|
An LDMDisk |
Returns : |
The name of the host device, or NULL if the disk is missing |
gchar * ldm_disk_get_guid (const LDMDisk *o);
Get the Windows-assigned GUID of a disk.
|
An LDMDisk |
Returns : |
The string representation of the GUID. [transfer full] |
guint64 ldm_disk_get_metadata_size (const LDMDisk *o);
Get the size, in sectors, of the metadata portion of a disk.
|
An LDMDisk |
Returns : |
The size in sectors |
guint64 ldm_disk_get_metadata_start (const LDMDisk *o);
Get the start sector of the metadata portion of a disk.
|
An LDMDisk |
Returns : |
The start sector |
gchar * ldm_disk_get_name (const LDMDisk *o);
Get the Windows-assigned name of a disk.
|
An LDMDisk |
Returns : |
The name. [transfer full] |
GArray * ldm_disk_group_get_disks (LDMDiskGroup *o);
Get an array of all disks in a disk group.
|
An LDMDiskGroup |
Returns : |
An array of disks. [element-type LDMDisk][transfer container] |
gchar * ldm_disk_group_get_guid (const LDMDiskGroup *o);
Get the Windows-assigned GUID of a disk group.
|
An LDMDiskGroup |
Returns : |
The string representation of the GUID. [transfer full] |
gchar * ldm_disk_group_get_name (const LDMDiskGroup *o);
Get the Windows-assigned name of a disk group.
|
An LDMDiskGroup |
Returns : |
The name. [transfer full] |
GArray * ldm_disk_group_get_partitions (LDMDiskGroup *o);
Get an array of all partitions in a disk group.
|
An LDMPartition |
Returns : |
An array of partitions. [element-type LDMPartition][transfer container] |
GArray * ldm_disk_group_get_volumes (LDMDiskGroup *o);
Get an array of all volumes in a disk group.
|
An LDMDiskGroup |
Returns : |
An array of volumes. [element-type LDMVolume][transfer container] |
GArray * ldm_get_disk_groups (LDM *o);
Get an array of discovered disk groups.
|
An LDM object |
Returns : |
An array of disk groups. [element-type LDMDiskGroup][transfer container] |
LDM * ldm_new ();
Instantiate a new LDM object. LDM scans devices and stores detected metadata.
Returns : |
a new LDM object. [transfer full] |
LDMDisk * ldm_partition_get_disk (LDMPartition *o);
Get the LDMDisk underlying a partition.
|
An LDMPartition |
Returns : |
The underlying disk. [transfer full] |
gchar * ldm_partition_get_name (const LDMPartition *o);
Get the Windows-assigned name of a partition.
|
An LDMPartition |
Returns : |
The name. [transfer full] |
guint64 ldm_partition_get_size (const LDMPartition *o);
Get the size of a partition in sectors.
|
An LDMPartition |
Returns : |
The size, in sectors |
guint64 ldm_partition_get_start (const LDMPartition *o);
Get the start sector of a disk, measured from the start of the underlying disk.
|
An LDMPartition |
Returns : |
The start sector |
gboolean ldm_volume_dm_create (const LDMVolume *o,GString **created,GError **err);
Create a device mapper device for a volume. If this function is called for
volume whose device already exists it will still return success. However,
created will not be set.
|
An LDMVolume |
|
The name of the created device, if any. [out] |
|
A GError to receive any generated errors |
Returns : |
True if, following the call, the device exists. False if it doesn't.
created will only be set if the call actually created the device. |
GString * ldm_volume_dm_get_name (const LDMVolume *o);
Get the name of the device mapper device which will be created for this volume.
|
An LDMVolume |
Returns : |
The device mapper name. [transfer full] |
gboolean ldm_volume_dm_remove (const LDMVolume *o,GString **removed,GError **err);
Remove a device mapper device for a volume. If this function is called for a
volume whose device does not already exist, it will still return success.
However, removed will not be set.
|
An LDMVolume |
|
The name of the removed device, if any. [out] |
|
A GError to receive any generated errors |
Returns : |
True if, following the call, the device does not exist. False if it
does. removed will only be set if the call actually removed the
device. |
guint64 ldm_volume_get_chunk_size (const LDMVolume *o);
Get the chunk size, in sectors, used by striped and raid5 volumes. For other volume types it will be 0.
|
An LDMVolume |
Returns : |
The chunk size in sectors |
gchar * ldm_volume_get_hint (const LDMVolume *o);
Get the volume mounting hint. This value specifies how Windows expects the volume to be mounted. For a volume with an assigned drive letter, it might be 'E:'.
|
An LDMVolume |
Returns : |
The mounting hint. [transfer full] |
gchar * ldm_volume_get_name (const LDMVolume *o);
Get the Windows-assigned name of a volume.
|
An LDMVolume |
Returns : |
The name. [transfer full] |
guint8 ldm_volume_get_part_type (const LDMVolume *o);
Get the 'partition type' of the volume. This is the same 8-bit value that is used to describe partition types on an MBR disk. It is 0x07 for NTFS volumes.
|
An LDMVolume |
Returns : |
The partition type |
GArray * ldm_volume_get_partitions (LDMVolume *o);
Get an array of all partitions in a volume.
|
An LDMVolume |
Returns : |
An array of partitions. [element-type LDMPartition][transfer container] |
guint64 ldm_volume_get_size (const LDMVolume *o);
Get the volume size in sectors.
|
An LDMVolume |
Returns : |
The volume size in sectors |
LDMVolumeType ldm_volume_get_voltype (const LDMVolume *o);
Get the volume type. This can be:
|
An LDMVolume |
Returns : |
The volume type |