lvm_queryvgs Subroutine

Purpose

Queries volume groups and returns information to online volume groups.

Library

Logical Volume Manager Library (liblvm.a)

Syntax

#include <lvm.h>

int lvm_queryvgs ( QueryVGS,  Kmid)
struct queryvgs **QueryVGS;
mid_t Kmid;

Description

Note: The lvm_queryvgs subroutine uses the sysconfig system call, which requires root user authority, to query and update kernel data structures describing a volume group. You must have root user authority to use the lvm_queryvgs subroutine.

The lvm_queryvgs subroutine returns the volume group IDs and major numbers for all volume groups in the system that are online.

The caller passes the address of a pointer to a queryvgs structure, and the Logical Volume Manager (LVM) allocates enough space for the structure and returns the address of the structure in the pointer passed in by the user. The caller also passes in a Kmid parameter, which identifies the entry point of the logical device driver module:

struct queryvgs {
       long num_vgs;
       struct {
       long major_num  
       struct unique_id vg_id;
       } vgs  [LVM_MAXVGS];  
 }
Field Description
num_vgs Contains the number of online volume groups on the system. The vgs is an array of the volume group IDs and major numbers of all online volume groups in the system.

Parameters

Item Description
QueryVGS Points to the queryvgs structure.
Kmid Identifies the address of the entry point of the logical volume device driver module.

Return Values

The lvm_queryvgs subroutine returns a value of 0 upon successful completion.

Error Codes

If the lvm_queryvgs subroutine fails, it returns one of the following error codes:

Item Description
LVM_ALLOCERR The routine cannot allocate enough space for the complete buffer.
LVM_INVALID_PARAM An invalid parameter was passed into the routine.
LVM_INVCONFIG An error occurred while attempting to configure this volume group into the kernel. This error will normally result if the module ID is invalid, if the major number given is already in use, or if the volume group device could not be opened.