summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2016-03-10 16:51:02 +0000
committerBryn M. Reeves <bmr@redhat.com>2016-07-05 19:29:49 +0100
commitea2fb03750f0cb413d4fd9e2b6819df2278528a3 (patch)
treef28ef29778ad43bbc8b3bc3fc4d7afa82f18eac0
parentf883bca41b425d8eed1cbace2b9cdc67331f4e57 (diff)
downloadlvm2-ea2fb03750f0cb413d4fd9e2b6819df2278528a3.tar.gz
libdm: rename dm_stats name, devno and uuid members
The device-mapper name, device numbers and uuid stored in the dm_stats handle are used only to bind the handle to a specific device in order to issue ioctls. Rename them to "bind_*" to reflect this usage in preparation for caching the device-mapper name of the bound device in the dm_stats handle. This will be used to allow optional aliases to be set for dmstats groups.
-rw-r--r--libdm/libdm-stats.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 3d5375593..58f89514e 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -76,10 +76,10 @@ struct dm_stats_region {
struct dm_stats {
/* device binding */
- int major; /* device major that this dm_stats object is bound to */
- int minor; /* device minor that this dm_stats object is bound to */
- char *name; /* device-mapper device name */
- char *uuid; /* device-mapper UUID */
+ int bind_major; /* device major that this dm_stats object is bound to */
+ int bind_minor; /* device minor that this dm_stats object is bound to */
+ char *bind_name; /* device-mapper device name */
+ char *bind_uuid; /* device-mapper UUID */
char *program_id; /* default program_id for this handle */
struct dm_pool *mem; /* memory pool for region and counter tables */
struct dm_pool *hist_mem; /* separate pool for histogram tables */
@@ -162,10 +162,10 @@ struct dm_stats *dm_stats_create(const char *program_id)
goto bad;
}
- dms->major = -1;
- dms->minor = -1;
- dms->name = NULL;
- dms->uuid = NULL;
+ dms->bind_major = -1;
+ dms->bind_minor = -1;
+ dms->bind_name = NULL;
+ dms->bind_uuid = NULL;
/* by default all regions use msec precision */
dms->timescale = NSEC_PER_MSEC;
@@ -242,19 +242,19 @@ static void _stats_regions_destroy(struct dm_stats *dms)
static int _set_stats_device(struct dm_stats *dms, struct dm_task *dmt)
{
- if (dms->name)
- return dm_task_set_name(dmt, dms->name);
- if (dms->uuid)
- return dm_task_set_uuid(dmt, dms->uuid);
- if (dms->major > 0)
- return dm_task_set_major(dmt, dms->major)
- && dm_task_set_minor(dmt, dms->minor);
+ if (dms->bind_name)
+ return dm_task_set_name(dmt, dms->bind_name);
+ if (dms->bind_uuid)
+ return dm_task_set_uuid(dmt, dms->bind_uuid);
+ if (dms->bind_major > 0)
+ return dm_task_set_major(dmt, dms->bind_major)
+ && dm_task_set_minor(dmt, dms->bind_minor);
return_0;
}
static int _stats_bound(struct dm_stats *dms)
{
- if (dms->major > 0 || dms->name || dms->uuid)
+ if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid)
return 1;
/* %p format specifier expects a void pointer. */
log_debug("Stats handle at %p is not bound.", (void *) dms);
@@ -263,13 +263,13 @@ static int _stats_bound(struct dm_stats *dms)
static void _stats_clear_binding(struct dm_stats *dms)
{
- if (dms->name)
- dm_pool_free(dms->mem, dms->name);
- if (dms->uuid)
- dm_pool_free(dms->mem, dms->uuid);
+ if (dms->bind_name)
+ dm_pool_free(dms->mem, dms->bind_name);
+ if (dms->bind_uuid)
+ dm_pool_free(dms->mem, dms->bind_uuid);
- dms->name = dms->uuid = NULL;
- dms->major = dms->minor = -1;
+ dms->bind_name = dms->bind_uuid = NULL;
+ dms->bind_major = dms->bind_minor = -1;
}
int dm_stats_bind_devno(struct dm_stats *dms, int major, int minor)
@@ -277,8 +277,8 @@ int dm_stats_bind_devno(struct dm_stats *dms, int major, int minor)
_stats_clear_binding(dms);
_stats_regions_destroy(dms);
- dms->major = major;
- dms->minor = minor;
+ dms->bind_major = major;
+ dms->bind_minor = minor;
return 1;
}
@@ -288,7 +288,7 @@ int dm_stats_bind_name(struct dm_stats *dms, const char *name)
_stats_clear_binding(dms);
_stats_regions_destroy(dms);
- if (!(dms->name = dm_pool_strdup(dms->mem, name)))
+ if (!(dms->bind_name = dm_pool_strdup(dms->mem, name)))
return_0;
return 1;
@@ -299,7 +299,7 @@ int dm_stats_bind_uuid(struct dm_stats *dms, const char *uuid)
_stats_clear_binding(dms);
_stats_regions_destroy(dms);
- if (!(dms->uuid = dm_pool_strdup(dms->mem, uuid)))
+ if (!(dms->bind_uuid = dm_pool_strdup(dms->mem, uuid)))
return_0;
return 1;