1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-24 14:50:34 +03:00

Use log_error macro consistently throughout in place of log_err.

This commit is contained in:
Alasdair Kergon 2009-07-15 20:02:46 +00:00
parent 99a5d8a9c4
commit b8f47d5f69
24 changed files with 82 additions and 78 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.50 -
================================
Use log_error macro consistently throughout in place of log_err.
Version 2.02.49 - 15th July 2009
================================

View File

@ -950,7 +950,7 @@ static int get_all_cluster_nodes()
}
else {
DEBUGLOG("Cannot resolve host name %s\n", nodename);
log_err("Cannot resolve host name %s\n", nodename);
log_error("Cannot resolve host name %s\n", nodename);
}
}
free(nodename);

View File

@ -999,8 +999,8 @@ static int _init_backup(struct cmd_context *cmd)
if (dm_snprintf
(default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir,
DEFAULT_ARCHIVE_SUBDIR) == -1) {
log_err("Couldn't create default archive path '%s/%s'.",
cmd->system_dir, DEFAULT_ARCHIVE_SUBDIR);
log_error("Couldn't create default archive path '%s/%s'.",
cmd->system_dir, DEFAULT_ARCHIVE_SUBDIR);
return 0;
}
@ -1021,8 +1021,8 @@ static int _init_backup(struct cmd_context *cmd)
if (dm_snprintf
(default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir,
DEFAULT_BACKUP_SUBDIR) == -1) {
log_err("Couldn't create default backup path '%s/%s'.",
cmd->system_dir, DEFAULT_BACKUP_SUBDIR);
log_error("Couldn't create default backup path '%s/%s'.",
cmd->system_dir, DEFAULT_BACKUP_SUBDIR);
return 0;
}

View File

@ -298,19 +298,19 @@ static int _insert_dev(const char *path, dev_t d)
return_0;
if (!(btree_insert(_cache.devices, (uint32_t) d, dev))) {
log_err("Couldn't insert device into binary tree.");
log_error("Couldn't insert device into binary tree.");
_free(dev);
return 0;
}
}
if (!loopfile && !_add_alias(dev, path)) {
log_err("Couldn't add alias to dev cache.");
log_error("Couldn't add alias to dev cache.");
return 0;
}
if (!dm_hash_insert(_cache.names, path, dev)) {
log_err("Couldn't add name to hash in dev cache.");
log_error("Couldn't add name to hash in dev cache.");
return 0;
}
@ -541,7 +541,7 @@ int dev_cache_init(struct cmd_context *cmd)
}
if (!(_cache.devices = btree_create(_cache.mem))) {
log_err("Couldn't create binary tree for dev-cache.");
log_error("Couldn't create binary tree for dev-cache.");
goto bad;
}
@ -561,7 +561,7 @@ int dev_cache_init(struct cmd_context *cmd)
static void _check_closed(struct device *dev)
{
if (dev->fd >= 0)
log_err("Device '%s' has been left open.", dev_name(dev));
log_error("Device '%s' has been left open.", dev_name(dev));
}
static void _check_for_open_devices(void)

View File

@ -625,7 +625,7 @@ static int _write_pvd(struct disk_list *data)
happy (idea from AED) */
buf = dm_malloc(size);
if (!buf) {
log_err("Couldn't allocate temporary PV buffer.");
log_error("Couldn't allocate temporary PV buffer.");
return 0;
}

View File

@ -579,15 +579,15 @@ int import_snapshots(struct dm_pool *mem __attribute((unused)), struct volume_gr
lvnum = lvd->lv_number;
if (lvnum >= MAX_LV) {
log_err("Logical volume number "
"out of bounds.");
log_error("Logical volume number "
"out of bounds.");
return 0;
}
if (!lvs[lvnum] &&
!(lvs[lvnum] = find_lv(vg, (char *)lvd->lv_name))) {
log_err("Couldn't find logical volume '%s'.",
lvd->lv_name);
log_error("Couldn't find logical volume '%s'.",
lvd->lv_name);
return 0;
}
}
@ -606,8 +606,8 @@ int import_snapshots(struct dm_pool *mem __attribute((unused)), struct volume_gr
lvnum = lvd->lv_number;
cow = lvs[lvnum];
if (!(org = lvs[lvd->lv_snapshot_minor])) {
log_err("Couldn't find origin logical volume "
"for snapshot '%s'.", lvd->lv_name);
log_error("Couldn't find origin logical volume "
"for snapshot '%s'.", lvd->lv_name);
return 0;
}
@ -619,7 +619,7 @@ int import_snapshots(struct dm_pool *mem __attribute((unused)), struct volume_gr
if (!vg_add_snapshot(org, cow, NULL,
org->le_count,
lvd->lv_chunk_size)) {
log_err("Couldn't add snapshot.");
log_error("Couldn't add snapshot.");
return 0;
}
}

View File

@ -50,8 +50,8 @@ static struct dm_hash_table *_create_lv_maps(struct dm_pool *mem,
struct lv_map *lvm;
if (!maps) {
log_err("Unable to create hash table for holding "
"extent maps.");
log_error("Unable to create hash table for holding "
"extent maps.");
return NULL;
}
@ -89,8 +89,8 @@ static int _fill_lv_array(struct lv_map **lvs,
dm_list_iterate_items(ll, &dl->lvds) {
if (!(lvm = dm_hash_lookup(maps, strrchr((char *)ll->lvd.lv_name, '/')
+ 1))) {
log_err("Physical volume (%s) contains an "
"unknown logical volume (%s).",
log_error("Physical volume (%s) contains an "
"unknown logical volume (%s).",
dev_name(dl->dev), ll->lvd.lv_name);
return 0;
}
@ -144,14 +144,14 @@ static int _fill_maps(struct dm_hash_table *maps, struct volume_group *vg,
le = e[i].le_num;
if (le >= lvm->lv->le_count) {
log_err("logical extent number "
"out of bounds");
log_error("logical extent number "
"out of bounds");
return 0;
}
if (lvm->map[le].pv) {
log_err("logical extent (%u) "
"already mapped.", le);
log_error("logical extent (%u) "
"already mapped.", le);
return 0;
}
@ -170,8 +170,8 @@ static int _check_single_map(struct lv_map *lvm)
for (i = 0; i < lvm->lv->le_count; i++) {
if (!lvm->map[i].pv) {
log_err("Logical volume (%s) contains an incomplete "
"mapping table.", lvm->lv->name);
log_error("Logical volume (%s) contains an incomplete "
"mapping table.", lvm->lv->name);
return 0;
}
}
@ -346,12 +346,12 @@ int import_extents(struct cmd_context *cmd, struct volume_group *vg,
return_0;
if (!(maps = _create_lv_maps(scratch, vg))) {
log_err("Couldn't allocate logical volume maps.");
log_error("Couldn't allocate logical volume maps.");
goto out;
}
if (!_fill_maps(maps, vg, pvds)) {
log_err("Couldn't fill logical volume maps.");
log_error("Couldn't fill logical volume maps.");
goto out;
}
@ -359,7 +359,7 @@ int import_extents(struct cmd_context *cmd, struct volume_group *vg,
goto_out;
if (!_build_all_segments(cmd, maps)) {
log_err("Couldn't build extent segments.");
log_error("Couldn't build extent segments.");
goto out;
}
r = 1;

View File

@ -26,8 +26,8 @@
static void _not_supported(const char *op)
{
log_err("The '%s' operation is not supported for the lvm1 labeller.",
op);
log_error("The '%s' operation is not supported for the lvm1 labeller.",
op);
}
static int _lvm1_can_handle(struct labeller *l __attribute((unused)), void *buf, uint64_t sector)
@ -119,7 +119,7 @@ struct labeller *lvm1_labeller_create(struct format_type *fmt)
struct labeller *l;
if (!(l = dm_malloc(sizeof(*l)))) {
log_err("Couldn't allocate labeller object.");
log_error("Couldn't allocate labeller object.");
return NULL;
}

View File

@ -139,7 +139,7 @@ static struct dm_list *_scan_archive(struct dm_pool *mem,
/* Sort fails beyond 5-digit indexes */
if ((count = scandir(dir, &dirent, NULL, alphasort)) < 0) {
log_err("Couldn't scan the archive directory (%s).", dir);
log_error("Couldn't scan the archive directory (%s).", dir);
return 0;
}
@ -164,7 +164,7 @@ static struct dm_list *_scan_archive(struct dm_pool *mem,
* Create a new archive_file.
*/
if (!(af = dm_pool_alloc(mem, sizeof(*af)))) {
log_err("Couldn't create new archive file.");
log_error("Couldn't create new archive file.");
results = NULL;
goto out;
}
@ -238,12 +238,12 @@ int archive_vg(struct volume_group *vg,
*/
if (!create_temp_name(dir, temp_file, sizeof(temp_file), &fd,
&vg->cmd->rand_seed)) {
log_err("Couldn't create temporary archive name.");
log_error("Couldn't create temporary archive name.");
return 0;
}
if (!(fp = fdopen(fd, "w"))) {
log_err("Couldn't create FILE object for archive.");
log_error("Couldn't create FILE object for archive.");
if (close(fd))
log_sys_error("close", temp_file);
return 0;
@ -356,7 +356,7 @@ int archive_list_file(struct cmd_context *cmd, const char *file)
af.path = (char *)file;
if (!path_exists(af.path)) {
log_err("Archive file %s not found.", af.path);
log_error("Archive file %s not found.", af.path);
return 0;
}

View File

@ -250,7 +250,7 @@ int backup_remove(struct cmd_context *cmd, const char *vg_name)
if (dm_snprintf(path, sizeof(path), "%s/%s",
cmd->backup_params->dir, vg_name) < 0) {
log_err("Failed to generate backup filename (for removal).");
log_error("Failed to generate backup filename (for removal).");
return 0;
}
@ -364,7 +364,7 @@ int backup_restore(struct cmd_context *cmd, const char *vg_name)
if (dm_snprintf(path, sizeof(path), "%s/%s",
cmd->backup_params->dir, vg_name) < 0) {
log_err("Failed to generate backup filename (for restore).");
log_error("Failed to generate backup filename (for restore).");
return 0;
}

View File

@ -82,7 +82,7 @@ static struct flag *_get_flags(int type)
return _lv_flags;
}
log_err("Unknown flag set requested.");
log_error("Unknown flag set requested.");
return NULL;
}
@ -149,7 +149,7 @@ int read_flags(uint32_t *status, int type, struct config_value *cv)
while (cv) {
if (cv->type != CFG_STRING) {
log_err("Status value is not a string.");
log_error("Status value is not a string.");
return 0;
}
@ -169,7 +169,7 @@ int read_flags(uint32_t *status, int type, struct config_value *cv)
*/
s |= PARTIAL_VG;
} else if (!flags[f].description && (type & STATUS_FLAG)) {
log_err("Unknown status flag '%s'.", cv->v.str);
log_error("Unknown status flag '%s'.", cv->v.str);
return 0;
}

View File

@ -799,8 +799,8 @@ static struct volume_group *_vg_read_file_name(struct format_instance *fid,
*/
if (vgname && strcmp(vgname, vg->name)) {
dm_pool_free(fid->fmt->cmd->mem, vg);
log_err("'%s' does not contain volume group '%s'.",
read_path, vgname);
log_error("'%s' does not contain volume group '%s'.",
read_path, vgname);
return NULL;
} else
log_debug("Read volume group %s from %s", vg->name, read_path);
@ -858,7 +858,7 @@ static int _vg_write_file(struct format_instance *fid __attribute((unused)),
if (!create_temp_name(temp_dir, temp_file, sizeof(temp_file), &fd,
&vg->cmd->rand_seed)) {
log_err("Couldn't create temporary text file name.");
log_error("Couldn't create temporary text file name.");
return 0;
}
@ -1860,7 +1860,7 @@ void *create_text_context(struct cmd_context *cmd, const char *path,
bad:
dm_pool_free(cmd->mem, tc);
log_err("Couldn't allocate text format context object.");
log_error("Couldn't allocate text format context object.");
return NULL;
}
@ -1936,9 +1936,10 @@ static int _get_config_disk_area(struct cmd_context *cmd,
char buffer[64] __attribute((aligned(8)));
if (!id_write_format(&id, buffer, sizeof(buffer)))
log_err("Couldn't find device.");
log_error("Couldn't find device.");
else
log_err("Couldn't find device with uuid '%s'.", buffer);
log_error("Couldn't find device with uuid '%s'.",
buffer);
return 0;
}

View File

@ -343,7 +343,7 @@ struct labeller *text_labeller_create(const struct format_type *fmt)
struct labeller *l;
if (!(l = dm_malloc(sizeof(*l)))) {
log_err("Couldn't allocate labeller object.");
log_error("Couldn't allocate labeller object.");
return NULL;
}

View File

@ -304,7 +304,7 @@ int label_write(struct device *dev, struct label *label)
int r = 1;
if (!label->labeller->ops->write) {
log_err("Label handler does not support label writes");
log_error("Label handler does not support label writes");
return 0;
}

View File

@ -1237,7 +1237,7 @@ static int _allocate(struct alloc_handle *ah,
/* Allocate an array of pv_areas to hold the largest space on each PV */
if (!(areas = dm_malloc(sizeof(*areas) * areas_size))) {
log_err("Couldn't allocate areas array.");
log_error("Couldn't allocate areas array.");
return 0;
}
@ -1375,8 +1375,8 @@ int lv_add_segment(struct alloc_handle *ah,
return_0;
if ((segtype->flags & SEG_CAN_SPLIT) && !lv_merge_segments(lv)) {
log_err("Couldn't merge segments after extending "
"logical volume.");
log_error("Couldn't merge segments after extending "
"logical volume.");
return 0;
}

View File

@ -636,7 +636,8 @@ vg_t *vg_create(struct cmd_context *cmd, const char *vg_name)
goto_bad;
if (!id_create(&vg->id)) {
log_err("Couldn't create uuid for volume group '%s'.", vg_name);
log_error("Couldn't create uuid for volume group '%s'.",
vg_name);
goto bad;
}

View File

@ -94,7 +94,7 @@ int vg_add_snapshot(struct logical_volume *origin,
* Is the cow device already being used ?
*/
if (lv_is_cow(cow)) {
log_err("'%s' is already in use as a snapshot.", cow->name);
log_error("'%s' is already in use as a snapshot.", cow->name);
return 0;
}

View File

@ -53,8 +53,8 @@ int create_temp_name(const char *dir, char *buffer, size_t len, int *fd,
if (dm_snprintf(buffer, len, "%s/.lvm_%s_%d_%d",
dir, hostname, pid, num) == -1) {
log_err("Not enough space to build temporary file "
"string.");
log_error("Not enough space to build temporary file "
"string.");
return 0;
}

View File

@ -139,7 +139,7 @@ int id_valid(struct id *id)
for (i = 0; i < ID_LEN; i++)
if (!_inverse_c[id->uuid[i]]) {
log_err("UUID contains invalid character");
log_error("UUID contains invalid character");
return 0;
}
@ -163,7 +163,7 @@ int id_write_format(const struct id *id, char *buffer, size_t size)
/* split into groups separated by dashes */
if (size < (32 + 6 + 1)) {
log_err("Couldn't write uuid, buffer too small.");
log_error("Couldn't write uuid, buffer too small.");
return 0;
}
@ -191,7 +191,7 @@ int id_read_format(struct id *id, const char *buffer)
}
if (out >= ID_LEN) {
log_err("Too many characters to be uuid.");
log_error("Too many characters to be uuid.");
return 0;
}
@ -199,7 +199,8 @@ int id_read_format(struct id *id, const char *buffer)
}
if (out != ID_LEN) {
log_err("Couldn't read uuid, incorrect number of characters.");
log_error("Couldn't read uuid: incorrect number of "
"characters.");
return 0;
}

View File

@ -149,12 +149,12 @@ static struct block *_new_block(size_t s, unsigned alignment)
assert(alignment == DEFAULT_ALIGNMENT);
if (!b) {
log_err("Out of memory");
log_error("Out of memory");
return NULL;
}
if (!(b->data = dm_malloc(s))) {
log_err("Out of memory");
log_error("Out of memory");
dm_free(b);
return NULL;
}
@ -237,7 +237,7 @@ int dm_pool_grow_object(struct dm_pool *p, const void *extra, size_t delta)
new_size = delta;
if (!(new = _new_block(new_size, DEFAULT_ALIGNMENT))) {
log_err("Couldn't extend object.");
log_error("Couldn't extend object.");
return 0;
}

View File

@ -68,16 +68,16 @@ static int _lvcreate_name_params(struct lvcreate_params *lp,
if (lp->snapshot && !arg_count(cmd, virtualsize_ARG)) {
if (!argc) {
log_err("Please specify a logical volume to act as "
"the snapshot origin.");
log_error("Please specify a logical volume to act as "
"the snapshot origin.");
return 0;
}
lp->origin = argv[0];
(*pargv)++, (*pargc)--;
if (!(lp->vg_name = extract_vgname(cmd, lp->origin))) {
log_err("The origin name should include the "
"volume group.");
log_error("The origin name should include the "
"volume group.");
return 0;
}
@ -92,7 +92,7 @@ static int _lvcreate_name_params(struct lvcreate_params *lp,
*/
if (!argc) {
if (!(lp->vg_name = extract_vgname(cmd, lp->lv_name))) {
log_err("Please provide a volume group name");
log_error("Please provide a volume group name");
return 0;
}

View File

@ -955,7 +955,7 @@ static const char *_copy_command_line(struct cmd_context *cmd, int argc, char **
return dm_pool_end_object(cmd->mem);
bad:
log_err("Couldn't copy command line.");
log_error("Couldn't copy command line.");
dm_pool_abandon_object(cmd->mem);
return NULL;
}

View File

@ -1001,7 +1001,7 @@ static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
if (allocatable_only &&
(pvl->pv->pe_count == pvl->pv->pe_alloc_count)) {
log_err("No free extents on physical volume \"%s\"", pvname);
log_error("No free extents on physical volume \"%s\"", pvname);
return 1;
}
@ -1013,7 +1013,7 @@ static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
if (!new_pvl) {
if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
log_err("Unable to allocate physical volume list.");
log_error("Unable to allocate physical volume list.");
return 0;
}
@ -1087,8 +1087,8 @@ struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int
}
if (!(pvl = find_pv_in_vg(vg, pvname))) {
log_err("Physical Volume \"%s\" not found in "
"Volume Group \"%s\"", pvname, vg->name);
log_error("Physical Volume \"%s\" not found in "
"Volume Group \"%s\"", pvname, vg->name);
return NULL;
}
if (!_create_pv_entry(mem, pvl, colon, allocatable_only, r))

View File

@ -26,7 +26,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
} else if (!(arg_count(cmd, list_ARG) && arg_count(cmd, file_ARG))) {
log_err("Please specify a *single* volume group to restore.");
log_error("Please specify a *single* volume group to restore.");
return ECMD_FAILED;
}
@ -60,7 +60,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
backup_restore(cmd, vg_name))) {
unlock_vg(cmd, vg_name);
unlock_vg(cmd, VG_ORPHANS);
log_err("Restore failed.");
log_error("Restore failed.");
return ECMD_FAILED;
}