mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add function that returns the library version.
This commit is contained in:
parent
ad837a06e5
commit
444b7d2360
@ -66,6 +66,7 @@ struct dm_info {
|
|||||||
unsigned int target_count;
|
unsigned int target_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int dm_get_library_version(char *version, size_t size);
|
||||||
int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size);
|
int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size);
|
||||||
int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi);
|
int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi);
|
||||||
|
|
||||||
|
@ -58,6 +58,12 @@ void _build_dev_path(char *buffer, size_t len, const char *dev_name)
|
|||||||
snprintf(buffer, len, "%s/%s", _dm_dir, dev_name);
|
snprintf(buffer, len, "%s/%s", _dm_dir, dev_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dm_get_library_version(char *version, size_t size)
|
||||||
|
{
|
||||||
|
strncpy(version, DM_LIB_VERSION, size);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
struct dm_task *dm_task_create(int type)
|
struct dm_task *dm_task_create(int type)
|
||||||
{
|
{
|
||||||
struct dm_task *dmt = malloc(sizeof(*dmt));
|
struct dm_task *dmt = malloc(sizeof(*dmt));
|
||||||
|
@ -14,3 +14,5 @@ extern struct target *create_target(uint64_t start,
|
|||||||
int add_dev_node(const char *dev_name, dev_t dev);
|
int add_dev_node(const char *dev_name, dev_t dev);
|
||||||
int rm_dev_node(const char *dev_name);
|
int rm_dev_node(const char *dev_name);
|
||||||
|
|
||||||
|
#define DM_LIB_VERSION @DM_LIB_VERSION@
|
||||||
|
|
@ -162,6 +162,9 @@ static int _version(int argc, char **argv)
|
|||||||
struct dm_task *dmt;
|
struct dm_task *dmt;
|
||||||
char version[80];
|
char version[80];
|
||||||
|
|
||||||
|
if (dm_get_library_version(version, sizeof(version)))
|
||||||
|
printf("Library version: %s\n", version);
|
||||||
|
|
||||||
if (!(dmt = dm_task_create(DM_DEVICE_VERSION)))
|
if (!(dmt = dm_task_create(DM_DEVICE_VERSION)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user