ldm

ldm

Functions

Properties

char * guid Read
char * name Read

Types and Values

enum LDMError
#define LDM_TYPE
struct LDM
struct LDMDiskGroup
enum LDMVolumeType
struct LDMVolume
struct LDMPartition
struct LDMDisk
  LDMPrivate

Object Hierarchy

    GEnum
    ├── LDMError
    ╰── LDMVolumeType
    GObject
    ├── LDM
    ╰── LDMDiskGroup

Includes

#include <ldm.h>

Description

Functions

ldm_error_quark ()

GQuark
ldm_error_quark (void);

LDM_CAST()

#define             LDM_CAST(obj)

LDM_CLASS()

#define             LDM_CLASS(klass)

IS_LDM()

#define             IS_LDM(obj)

IS_LDM_CLASS()

#define             IS_LDM_CLASS(klass)

LDM_GET_CLASS()

#define             LDM_GET_CLASS(obj)

ldm_get_type ()

GType
ldm_get_type (void);

ldm_new ()

LDM *
ldm_new (void);

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

Returns

a new LDM object.

[transfer full]


ldm_add ()

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

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

Parameters

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 .

Parameters

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_get_disk_groups ()

GArray *
ldm_get_disk_groups (LDM *o);

Get an array of discovered disk groups.

Parameters

o

An LDM object

 

Returns

An array of disk groups.

[element-type LDMDiskGroup][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.

Parameters

o

An LDMDiskGroup

 

Returns

An array of volumes.

[element-type LDMVolume][transfer container]


ldm_disk_group_get_partitions ()

GArray *
ldm_disk_group_get_partitions (LDMDiskGroup *o);

Get an array of all partitions in a disk group.

Parameters

o

An LDMPartition

 

Returns

An array of partitions.

[element-type LDMPartition][transfer container]


ldm_disk_group_get_disks ()

GArray *
ldm_disk_group_get_disks (LDMDiskGroup *o);

Get an array of all disks in a disk group.

Parameters

o

An LDMDiskGroup

 

Returns

An array of disks.

[element-type LDMDisk][transfer container]


ldm_disk_group_get_name ()

gchar *
ldm_disk_group_get_name (const LDMDiskGroup *o);

Get the Windows-assigned name of a disk group.

Parameters

o

An LDMDiskGroup

 

Returns

The name.

[transfer full]


ldm_disk_group_get_guid ()

gchar *
ldm_disk_group_get_guid (const LDMDiskGroup *o);

Get the Windows-assigned GUID of a disk group.

Parameters

o

An LDMDiskGroup

 

Returns

The string representation of the GUID.

[transfer full]


ldm_volume_get_partitions ()

GArray *
ldm_volume_get_partitions (LDMVolume *o);

Get an array of all partitions in a volume.

Parameters

o

An LDMVolume

 

Returns

An array of partitions.

[element-type LDMPartition][transfer container]


ldm_volume_get_name ()

gchar *
ldm_volume_get_name (const LDMVolume *o);

Get the Windows-assigned name of a volume.

Parameters

o

An LDMVolume

 

Returns

The name.

[transfer full]


ldm_volume_get_guid ()

gchar *
ldm_volume_get_guid (const LDMVolume *o);

Get the Windows-assigned GUID of a volume.

Parameters

o

An LDMVolume

 

Returns

The string representation of the GUID.

[transfer full]


ldm_volume_get_voltype ()

LDMVolumeType
ldm_volume_get_voltype (const LDMVolume *o);

Get the volume type. This can be:

Parameters

o

An LDMVolume

 

Returns

The volume type


ldm_volume_get_size ()

guint64
ldm_volume_get_size (const LDMVolume *o);

Get the volume size in sectors.

Parameters

o

An LDMVolume

 

Returns

The volume size in sectors


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.

Parameters

o

An LDMVolume

 

Returns

The partition type


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

Parameters

o

An LDMVolume

 

Returns

The mounting hint.

[transfer full]


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.

Parameters

o

An LDMVolume

 

Returns

The chunk size in sectors


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. Note that returned name is unmangled. Device mapper will mangle actual device name if it contains invalid characters.

Parameters

o

An LDMVolume

 

Returns

The device mapper name.

[transfer full]


ldm_volume_dm_get_device ()

gchar *
ldm_volume_dm_get_device (const LDMVolume * const o,
                          GError **err);

Get the host device mapper device which was created for this volume (e.g. /dev/mapper/ldm_vol_Red-nzv8x6obywgDg0_Volume3). It is dynamic runtime property and it will be NULL if device mapper device is absent.

Parameters

o

An LDMVolume

 

err

A GError to receive any generated errors

 

Returns

The host device mapper device if present, or NULL otherwise.

[transfer full]


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.

Parameters

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_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.

Parameters

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_override_uuid ()

void
ldm_volume_override_uuid (LDMVolume * const o,
                          const uuid_t uuid_override);

Set the UUID used for device mapper. If no override is set, the volume's GUID will be used.

Parameters

o

An LDMVolume

 

uuid_override

User specified UUID for device mapper

 

ldm_partition_get_disk ()

LDMDisk *
ldm_partition_get_disk (LDMPartition *o);

Get the LDMDisk underlying a partition.

Parameters

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.

Parameters

o

An LDMPartition

 

Returns

The name.

[transfer full]


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.

Parameters

o

An LDMPartition

 

Returns

The start sector


ldm_partition_get_size ()

guint64
ldm_partition_get_size (const LDMPartition *o);

Get the size of a partition in sectors.

Parameters

o

An LDMPartition

 

Returns

The size, in sectors


ldm_partition_dm_get_device ()

gchar *
ldm_partition_dm_get_device (const LDMPartition * const o,
                             GError **err);

Get the host device mapper device which was created for this partition (e.g. /dev/mapper/ldm_part_Red-nzv8x6obywgDg0_Disk1-01). It is dynamic runtime property and it will be NULL if device mapper device is absent.

Parameters

o

An LDMPartition

 

err

A GError to receive any generated errors

 

Returns

The host device mapper device if present, or NULL otherwise.

[transfer full]


ldm_disk_get_name ()

gchar *
ldm_disk_get_name (const LDMDisk *o);

Get the Windows-assigned name of a disk.

Parameters

o

An LDMDisk

 

Returns

The name.

[transfer full]


ldm_disk_get_guid ()

gchar *
ldm_disk_get_guid (const LDMDisk *o);

Get the Windows-assigned GUID of a disk.

Parameters

o

An LDMDisk

 

Returns

The string representation of the GUID.

[transfer full]


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.

Parameters

o

An LDMDisk

 

Returns

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


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.

Parameters

o

An LDMDisk

 

Returns

The start sector


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.

Parameters

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.

Parameters

o

An LDMDisk

 

Returns

The start sector


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.

Parameters

o

An LDMDisk

 

Returns

The size in sectors

Types and Values

enum LDMError

Members

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

 

LDM_TYPE

#define LDM_TYPE            (ldm_get_type())

struct LDM

struct LDM;

An LDM metadata scanner


struct LDMDiskGroup

struct LDMDiskGroup;

An LDM Disk Group


enum LDMVolumeType

Members

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

 

struct LDMVolume

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

An LDM Volume.

Members

GObject parent;

The parent GObject

 

LDMVolumePrivate *priv;

Private data

 

struct LDMPartition

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

An LDM Parition.

Members

GObject parent;

The parent GObject

 

LDMPartitionPrivate *priv;

Private data

 

struct LDMDisk

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

An LDM Disk.

Members

GObject parent;

The parent GObject

 

LDMDiskPrivate *priv;

Private data

 

LDMPrivate

typedef struct _LDMPrivate LDMPrivate;

Property Details

The “guid” property

  “guid”                     char *

A string representation of the disk group's GUID.

Owner: LDMDiskGroup

Flags: Read

Default value: NULL


The “name” property

  “name”                     char *

The name of the disk group.

Owner: LDMDiskGroup

Flags: Read

Default value: NULL