ldm

ldm

Synopsis

#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);

Object Hierarchy

  GObject
   +----LDM
  GObject
   +----LDMDiskGroup
  GEnum
   +----LDMError
  GEnum
   +----LDMVolumeType

Properties

  "guid"                     gchar*                : Read
  "name"                     gchar*                : Read

Description

Details

IS_LDM()

#define             IS_LDM(obj)

IS_LDM_CLASS()

#define             IS_LDM_CLASS(klass)

struct LDM

struct LDM;

An LDM metadata scanner


struct LDMDisk

struct LDMDisk {
    GObject parent;
    LDMDiskPrivate *priv;
};

An LDM Disk.

GObject parent;

The parent GObject

LDMDiskPrivate *priv;

Private data

struct LDMDiskGroup

struct LDMDiskGroup;

An LDM Disk Group


enum LDMError

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;

LDM_ERROR_INTERNAL

An internal error

LDM_ERROR_IO

There was an IO error accessing a device

LDM_ERROR_NOT_LDM

The device is not part of an LDM disk group

LDM_ERROR_INVALID

The LDM metadata is corrupt

LDM_ERROR_INCONSISTENT

Detected two disks from the same disk group with inconsistent metadata

LDM_ERROR_NOTSUPPORTED

Unsupported LDM metadata

LDM_ERROR_MISSING_DISK

A disk is missing from a disk group

LDM_ERROR_EXTERNAL

An error reported by an external library

struct LDMPartition

struct LDMPartition {
    GObject parent;
    LDMPartitionPrivate *priv;
};

An LDM Parition.

GObject parent;

The parent GObject

LDMPartitionPrivate *priv;

Private data

LDMPrivate

typedef struct _LDMPrivate LDMPrivate;

struct LDMVolume

struct LDMVolume {
    GObject parent;
    LDMVolumePrivate *priv;
};

An LDM Volume.

GObject parent;

The parent GObject

LDMVolumePrivate *priv;

Private data

enum LDMVolumeType

typedef enum {
    LDM_VOLUME_TYPE_SIMPLE,
    LDM_VOLUME_TYPE_SPANNED,
    LDM_VOLUME_TYPE_STRIPED,
    LDM_VOLUME_TYPE_MIRRORED,
    LDM_VOLUME_TYPE_RAID5
} LDMVolumeType;

LDM_VOLUME_TYPE_SIMPLE

A simple volume

LDM_VOLUME_TYPE_SPANNED

A spanned volume

LDM_VOLUME_TYPE_STRIPED

A striped volume

LDM_VOLUME_TYPE_MIRRORED

A mirrored volume

LDM_VOLUME_TYPE_RAID5

A raid5 volume

LDM_CAST()

#define             LDM_CAST(obj)

LDM_CLASS()

#define             LDM_CLASS(klass)

LDM_GET_CLASS()

#define             LDM_GET_CLASS(obj)

LDM_TYPE

#define LDM_TYPE            (ldm_get_type())

ldm_add ()

gboolean            ldm_add                             (LDM *o,
                                                         const gchar *path,
                                                         GError **err);

Scan device path and add its metadata to LDM object o.

o :

An LDM object

path :

The path of the device

err :

A GError to receive any generated errors

Returns :

true on success, false on error

ldm_add_fd ()

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.

o :

An LDM object

fd :

A file descriptor for reading from the device

secsize :

The size of a sector on the device

path :

The path of the device (for messages)

err :

A GError to receive any generated errors

Returns :

true on success, false on error

ldm_disk_get_data_size ()

guint64             ldm_disk_get_data_size              (const LDMDisk *o);

Get the size, in sectors, of the data portion of a disk.

o :

An LDMDisk

Returns :

The size in sectors

ldm_disk_get_data_start ()

guint64             ldm_disk_get_data_start             (const LDMDisk *o);

Get the start sector of the data portion of a disk.

o :

An LDMDisk

Returns :

The start sector

ldm_disk_get_device ()

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.

o :

An LDMDisk

Returns :

The name of the host device, or NULL if the disk is missing

ldm_disk_get_guid ()

gchar *             ldm_disk_get_guid                   (const LDMDisk *o);

Get the Windows-assigned GUID of a disk.

o :

An LDMDisk

Returns :

The string representation of the GUID. [transfer full]

ldm_disk_get_metadata_size ()

guint64             ldm_disk_get_metadata_size          (const LDMDisk *o);

Get the size, in sectors, of the metadata portion of a disk.

o :

An LDMDisk

Returns :

The size in sectors

ldm_disk_get_metadata_start ()

guint64             ldm_disk_get_metadata_start         (const LDMDisk *o);

Get the start sector of the metadata portion of a disk.

o :

An LDMDisk

Returns :

The start sector

ldm_disk_get_name ()

gchar *             ldm_disk_get_name                   (const LDMDisk *o);

Get the Windows-assigned name of a disk.

o :

An LDMDisk

Returns :

The name. [transfer full]

ldm_disk_group_get_disks ()

GArray *            ldm_disk_group_get_disks            (LDMDiskGroup *o);

Get an array of all disks in a disk group.

o :

An LDMDiskGroup

Returns :

An array of disks. [element-type LDMDisk][transfer container]

ldm_disk_group_get_guid ()

gchar *             ldm_disk_group_get_guid             (const LDMDiskGroup *o);

Get the Windows-assigned GUID of a disk group.

o :

An LDMDiskGroup

Returns :

The string representation of the GUID. [transfer full]

ldm_disk_group_get_name ()

gchar *             ldm_disk_group_get_name             (const LDMDiskGroup *o);

Get the Windows-assigned name of a disk group.

o :

An LDMDiskGroup

Returns :

The name. [transfer full]

ldm_disk_group_get_partitions ()

GArray *            ldm_disk_group_get_partitions       (LDMDiskGroup *o);

Get an array of all partitions in a disk group.

o :

An LDMPartition

Returns :

An array of partitions. [element-type LDMPartition][transfer container]

ldm_disk_group_get_volumes ()

GArray *            ldm_disk_group_get_volumes          (LDMDiskGroup *o);

Get an array of all volumes in a disk group.

o :

An LDMDiskGroup

Returns :

An array of volumes. [element-type LDMVolume][transfer container]

ldm_error_quark ()

GQuark              ldm_error_quark                     (void);

ldm_get_disk_groups ()

GArray *            ldm_get_disk_groups                 (LDM *o);

Get an array of discovered disk groups.

o :

An LDM object

Returns :

An array of disk groups. [element-type LDMDiskGroup][transfer container]

ldm_get_type ()

GType               ldm_get_type                        (void);

ldm_new ()

LDM *               ldm_new                             ();

Instantiate a new LDM object. LDM scans devices and stores detected metadata.

Returns :

a new LDM object. [transfer full]

ldm_partition_get_disk ()

LDMDisk *           ldm_partition_get_disk              (LDMPartition *o);

Get the LDMDisk underlying a partition.

o :

An LDMPartition

Returns :

The underlying disk. [transfer full]

ldm_partition_get_name ()

gchar *             ldm_partition_get_name              (const LDMPartition *o);

Get the Windows-assigned name of a partition.

o :

An LDMPartition

Returns :

The name. [transfer full]

ldm_partition_get_size ()

guint64             ldm_partition_get_size              (const LDMPartition *o);

Get the size of a partition in sectors.

o :

An LDMPartition

Returns :

The size, in sectors

ldm_partition_get_start ()

guint64             ldm_partition_get_start             (const LDMPartition *o);

Get the start sector of a disk, measured from the start of the underlying disk.

o :

An LDMPartition

Returns :

The start sector

ldm_volume_dm_create ()

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.

o :

An LDMVolume

created :

The name of the created device, if any. [out]

err :

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.

ldm_volume_dm_get_name ()

GString *           ldm_volume_dm_get_name              (const LDMVolume *o);

Get the name of the device mapper device which will be created for this volume.

o :

An LDMVolume

Returns :

The device mapper name. [transfer full]

ldm_volume_dm_remove ()

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.

o :

An LDMVolume

removed :

The name of the removed device, if any. [out]

err :

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.

ldm_volume_get_chunk_size ()

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.

o :

An LDMVolume

Returns :

The chunk size in sectors

ldm_volume_get_hint ()

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:'.

o :

An LDMVolume

Returns :

The mounting hint. [transfer full]

ldm_volume_get_name ()

gchar *             ldm_volume_get_name                 (const LDMVolume *o);

Get the Windows-assigned name of a volume.

o :

An LDMVolume

Returns :

The name. [transfer full]

ldm_volume_get_part_type ()

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.

o :

An LDMVolume

Returns :

The partition type

ldm_volume_get_partitions ()

GArray *            ldm_volume_get_partitions           (LDMVolume *o);

Get an array of all partitions in a volume.

o :

An LDMVolume

Returns :

An array of partitions. [element-type LDMPartition][transfer container]

ldm_volume_get_size ()

guint64             ldm_volume_get_size                 (const LDMVolume *o);

Get the volume size in sectors.

o :

An LDMVolume

Returns :

The volume size in sectors

ldm_volume_get_voltype ()

LDMVolumeType       ldm_volume_get_voltype              (const LDMVolume *o);

Get the volume type. This can be:

o :

An LDMVolume

Returns :

The volume type

Property Details

The "guid" property

  "guid"                     gchar*                : Read

A string representation of the disk group's GUID.

Default value: NULL


The "name" property

  "name"                     gchar*                : Read

The name of the disk group.

Default value: NULL