1
0
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:
Alasdair Kergon 2002-01-17 14:13:25 +00:00
parent ad837a06e5
commit 444b7d2360
4 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,7 @@ struct dm_info {
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_info(struct dm_task *dmt, struct dm_info *dmi);

View File

@ -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);
}
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 *dmt = malloc(sizeof(*dmt));

View File

@ -14,3 +14,5 @@ extern struct target *create_target(uint64_t start,
int add_dev_node(const char *dev_name, dev_t dev);
int rm_dev_node(const char *dev_name);
#define DM_LIB_VERSION @DM_LIB_VERSION@

View File

@ -162,6 +162,9 @@ static int _version(int argc, char **argv)
struct dm_task *dmt;
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)))
return 0;