The library provides functions to list the objects in a system, get and set object properties (such as names, UUIDs, and sizes), as well as create/remove objects and perform more complex operations and transformations. Each object instance is represented by a handle, and handles are passed to and from the functions to perform the operations.
A central object in the library is the Volume Group, represented by the VG handle, vg_t. Performing an operation on a PV or LV object first requires obtaining a VG handle. Once the vg_t has been obtained, it can be used to enumerate the pv_t and lv_t objects within that vg_t. Attributes of these objects can then be queried or changed.
An application first opening a VG read-only, then later wanting to change a property of an object must first close the VG and re-open with write permission. Currently liblvm provides no mechanism to determine whether the VG has changed on-disk in between these operations - this is the application's responsiblity. One way the application can ensure the VG has not changed is to save the "vg_seqno" field after opening the VG with READ permission. If the application later needs to modify the VG, it can close the VG and re-open with WRITE permission. It should then check whether the original "vg_seqno" obtained with READ permission matches the new one obtained with WRITE permission.