Topology information

Topology information — block device topology information.

Synopsis

typedef             blkid_topology;
int                 blkid_probe_enable_topology         (blkid_probe pr,
                                                         int enable);

blkid_topology      blkid_probe_get_topology            (blkid_probe pr);
unsigned long       blkid_topology_get_alignment_offset (blkid_topology tp);
unsigned long       blkid_topology_get_logical_sector_size
                                                        (blkid_topology tp);
unsigned long       blkid_topology_get_minimum_io_size  (blkid_topology tp);
unsigned long       blkid_topology_get_optimal_io_size  (blkid_topology tp);
unsigned long       blkid_topology_get_physical_sector_size
                                                        (blkid_topology tp);

Description

The topology chain provides details about Linux block devices, for more information see:

Linux kernel Documentation/ABI/testing/sysfs-block

NAME=value (tags) interface is enabled by blkid_probe_enable_topology(), and provides:

LOGICAL_SECTOR_SIZE: this is the smallest unit the storage device can address. It is typically 512 bytes.

PHYSICAL_SECTOR_SIZE: this is the smallest unit a physical storage device can write atomically. It is usually the same as the logical sector size but may be bigger.

MINIMUM_IO_SIZE: minimum size which is the device's preferred unit of I/O. For RAID arrays it is often the stripe chunk size.

OPTIMAL_IO_SIZE: usually the stripe width for RAID or zero. For RAID arrays it is usually the stripe width or the internal track size.

ALIGNMENT_OFFSET: indicates how many bytes the beginning of the device is offset from the disk's natural alignment.

The NAME=value tags are not defined when the corresponding topology value is zero. The MINIMUM_IO_SIZE should be always defined if kernel provides topology information.

Binary interface:

blkid_probe_get_topology()

blkid_topology_get_'VALUENAME'()

Details

blkid_topology

typedef struct blkid_struct_topology *blkid_topology;

device topology information


blkid_probe_enable_topology ()

int                 blkid_probe_enable_topology         (blkid_probe pr,
                                                         int enable);

Enables/disables the topology probing for non-binary interface.

pr :

probe

enable :

TRUE/FALSE

Returns :

0 on success, or -1 in case of error.

blkid_probe_get_topology ()

blkid_topology      blkid_probe_get_topology            (blkid_probe pr);

This is a binary interface for topology values. See also blkid_topology_* functions.

This function is independent on blkid_do_[safe,full]probe() and blkid_probe_enable_topology() calls.

WARNING: the returned object will be overwritten by the next blkid_probe_get_topology() call for the same pr. If you want to use more blkid_topopogy objects in the same time you have to create more blkid_probe handlers (see blkid_new_probe()).

TODO: add blkid_ref() and blkid_unref() to allows to use blkid_topology independently on libblkid probing stuff.

pr :

probe

Returns :

blkid_topopogy, or NULL in case of error.

blkid_topology_get_alignment_offset ()

unsigned long       blkid_topology_get_alignment_offset (blkid_topology tp);

tp :

topology

Returns :

alignment offset in bytes or 0.

blkid_topology_get_logical_sector_size ()

unsigned long       blkid_topology_get_logical_sector_size
                                                        (blkid_topology tp);

tp :

topology

Returns :

logical sector size (BLKSSZGET ioctl) in bytes or 0.

blkid_topology_get_minimum_io_size ()

unsigned long       blkid_topology_get_minimum_io_size  (blkid_topology tp);

tp :

topology

Returns :

minimum io size in bytes or 0.

blkid_topology_get_optimal_io_size ()

unsigned long       blkid_topology_get_optimal_io_size  (blkid_topology tp);

tp :

topology

Returns :

optimal io size in bytes or 0.

blkid_topology_get_physical_sector_size ()

unsigned long       blkid_topology_get_physical_sector_size
                                                        (blkid_topology tp);

tp :

topology

Returns :

logical sector size (BLKSSZGET ioctl) in bytes or 0.