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;