1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: drop log_suppress(2) usage

No longer need to use  log_suppress(2) instance so dropped.
This commit is contained in:
Zdenek Kabelac 2015-12-03 17:51:43 +01:00
parent f40b3ba1e9
commit e7978c5ab6
3 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.137 - Version 2.02.137 -
===================================== =====================================
Dropped internal usage of log_suppress(2).
Cleaned logging code for buffer size usage. Cleaned logging code for buffer size usage.
Added internal id_read_format_try() function to check and read valid UUID. Added internal id_read_format_try() function to check and read valid UUID.
Use dm_get_status_mirror() instead of individual parsers. Use dm_get_status_mirror() instead of individual parsers.

View File

@ -1019,14 +1019,13 @@ static struct volume_group *_read_vg(struct format_instance *fid,
static void _read_desc(struct dm_pool *mem, static void _read_desc(struct dm_pool *mem,
const struct dm_config_tree *cft, time_t *when, char **desc) const struct dm_config_tree *cft, time_t *when, char **desc)
{ {
const char *d; const char *str;
unsigned int u = 0u; unsigned int u = 0u;
int old_suppress;
old_suppress = log_suppress(1); if (!dm_config_get_str(cft->root, "description", &str))
d = dm_config_find_str_allow_empty(cft->root, "description", ""); str = "";
log_suppress(old_suppress);
*desc = dm_pool_strdup(mem, d); *desc = dm_pool_strdup(mem, str);
(void) dm_config_get_uint32(cft->root, "creation_time", &u); (void) dm_config_get_uint32(cft->root, "creation_time", &u);
*when = u; *when = u;
@ -1043,12 +1042,12 @@ static int _read_vgname(const struct format_type *fmt, const struct dm_config_tr
const struct dm_config_node *vgn; const struct dm_config_node *vgn;
struct dm_pool *mem = fmt->cmd->mem; struct dm_pool *mem = fmt->cmd->mem;
const char *str; const char *str;
int old_suppress;
old_suppress = log_suppress(2); if (!dm_config_get_str(cft->root, "creation_host", &str))
vgsummary->creation_host = str = "";
dm_pool_strdup(mem, dm_config_find_str_allow_empty(cft->root, "creation_host", ""));
log_suppress(old_suppress); if (!(vgsummary->creation_host = dm_pool_strdup(mem, str)))
return_0;
/* skip any top-level values */ /* skip any top-level values */
for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) ; for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) ;
@ -1074,11 +1073,13 @@ static int _read_vgname(const struct format_type *fmt, const struct dm_config_tr
return 0; return 0;
} }
if (dm_config_get_str(vgn, "system_id", &str)) if (dm_config_get_str(vgn, "system_id", &str) &&
vgsummary->system_id = dm_pool_strdup(mem, str); (!(vgsummary->system_id = dm_pool_strdup(mem, str))))
return_0;
if (dm_config_get_str(vgn, "lock_type", &str)) if (dm_config_get_str(vgn, "lock_type", &str) &&
vgsummary->lock_type = dm_pool_strdup(mem, str); (!(vgsummary->lock_type = dm_pool_strdup(mem, str))))
return_0;
return 1; return 1;
} }

View File

@ -299,9 +299,6 @@ void print_log(int level, const char *file, int line, int dm_errno_or_class,
level = _LOG_FATAL; level = _LOG_FATAL;
} }
if (_log_suppress == 2)
return;
if (level <= _LOG_ERR) if (level <= _LOG_ERR)
init_error_message_produced(1); init_error_message_produced(1);