mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: indent changes
Some code indention. Use dm_strncpy() for simplier code. TODO: we could possibly use %32s for printing pvid... so maybe adding extra FMT_PVID....
This commit is contained in:
parent
fba54ae55e
commit
2d6ef123a6
36
lib/cache/lvmetad.c
vendored
36
lib/cache/lvmetad.c
vendored
@ -105,6 +105,7 @@ void lvmetad_disconnect(void)
|
||||
{
|
||||
if (_lvmetad_connected)
|
||||
daemon_close(_lvmetad);
|
||||
|
||||
_lvmetad_connected = 0;
|
||||
}
|
||||
|
||||
@ -165,14 +166,17 @@ int lvmetad_socket_present(void)
|
||||
int lvmetad_active(void)
|
||||
{
|
||||
lvmetad_connect_or_warn();
|
||||
|
||||
return _lvmetad_connected;
|
||||
}
|
||||
|
||||
void lvmetad_set_active(struct cmd_context *cmd, int active)
|
||||
{
|
||||
_lvmetad_use = active;
|
||||
|
||||
if (!active && lvmetad_active())
|
||||
lvmetad_disconnect();
|
||||
|
||||
if (cmd && !refresh_filters(cmd))
|
||||
stack;
|
||||
}
|
||||
@ -282,6 +286,7 @@ static int _token_update(void)
|
||||
}
|
||||
|
||||
daemon_reply_destroy(repl);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -490,6 +495,7 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
|
||||
static int _pv_update_struct_pv(struct physical_volume *pv, struct format_instance *fid)
|
||||
{
|
||||
struct lvmcache_info *info;
|
||||
|
||||
if ((info = lvmcache_info_from_pvid((const char *)&pv->id, 0))) {
|
||||
pv->label_sector = lvmcache_get_label(info)->sector;
|
||||
pv->dev = lvmcache_device(info);
|
||||
@ -500,6 +506,7 @@ static int _pv_update_struct_pv(struct physical_volume *pv, struct format_instan
|
||||
pv->fid = fid;
|
||||
} else
|
||||
pv->status |= MISSING_PV; /* probably missing */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -680,9 +687,12 @@ struct _fixup_baton {
|
||||
|
||||
static int _fixup_ignored(struct metadata_area *mda, void *baton) {
|
||||
struct _fixup_baton *b = baton;
|
||||
|
||||
if (b->i == b->find)
|
||||
mda_set_ignored(mda, b->ignore);
|
||||
|
||||
b->i ++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -829,6 +839,7 @@ out_success:
|
||||
|
||||
out:
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -903,6 +914,7 @@ int lvmetad_get_vgnameids(struct cmd_context *cmd, struct dm_list *vgnameids)
|
||||
}
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -938,6 +950,7 @@ int lvmetad_vg_list_to_lvmcache(struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1005,13 +1018,15 @@ static int _extract_ba(struct disk_locn *ba, void *baton)
|
||||
static int _extract_mdas(struct lvmcache_info *info, struct dm_config_tree *cft,
|
||||
struct dm_config_node *pre_sib)
|
||||
{
|
||||
struct _extract_dl_baton baton = { .i = 0, .cft = cft, .pre_sib = NULL };
|
||||
struct _extract_dl_baton baton = { .cft = cft };
|
||||
|
||||
if (!lvmcache_foreach_mda(info, &_extract_mda, &baton))
|
||||
return 0;
|
||||
|
||||
baton.i = 0;
|
||||
if (!lvmcache_foreach_da(info, &_extract_da, &baton))
|
||||
return 0;
|
||||
|
||||
baton.i = 0;
|
||||
if (!lvmcache_foreach_ba(info, &_extract_ba, &baton))
|
||||
return 0;
|
||||
@ -1417,6 +1432,7 @@ bad:
|
||||
/* FIXME kill lvmetad automatically if we can */
|
||||
log_error("Update of lvmetad failed. This is a serious problem.\n"
|
||||
"It is strongly recommended that you restart lvmetad immediately.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1536,6 +1552,7 @@ static int _lvmetad_get_pv_cache_list(struct cmd_context *cmd, struct dm_list *p
|
||||
return 1;
|
||||
|
||||
log_debug_lvmetad("Asking lvmetad for complete list of known PVs");
|
||||
|
||||
reply = _lvmetad_send("pv_list", NULL);
|
||||
if (!_lvmetad_handle_reply(reply, "list PVs", "", NULL)) {
|
||||
log_error("lvmetad message failed.");
|
||||
@ -1632,10 +1649,8 @@ static void _update_changed_pvs_in_udev(struct cmd_context *cmd,
|
||||
continue;
|
||||
|
||||
if (!id_equal(&before->pvid, &after->pvid)) {
|
||||
memset(id_before, 0, sizeof(id_before));
|
||||
memset(id_after, 0, sizeof(id_after));
|
||||
strncpy(&id_before[0], (char *) &before->pvid, sizeof(id_before) - 1);
|
||||
strncpy(&id_after[0], (char *) &after->pvid, sizeof(id_after) - 1);
|
||||
dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
|
||||
dm_strncpy(id_after, (char *) &after->pvid, sizeof(id_after));
|
||||
|
||||
log_debug_devs("device %d:%d changed pvid from %s to %s",
|
||||
(int)MAJOR(before->devt), (int)MINOR(before->devt),
|
||||
@ -1661,8 +1676,7 @@ static void _update_changed_pvs_in_udev(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
memset(id_before, 0, sizeof(id_before));
|
||||
strncpy(&id_before[0], (char *) &before->pvid, sizeof(id_before) - 1);
|
||||
dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
|
||||
|
||||
log_debug_devs("device %d:%d pvid %s vg %s is gone",
|
||||
(int)MAJOR(before->devt), (int)MINOR(before->devt),
|
||||
@ -1754,10 +1768,8 @@ void lvmetad_validate_global_cache(struct cmd_context *cmd, int force)
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
if (!global_invalid) {
|
||||
/* cache is valid */
|
||||
return;
|
||||
}
|
||||
if (!global_invalid)
|
||||
return; /* cache is valid */
|
||||
|
||||
do_scan:
|
||||
/*
|
||||
@ -1839,6 +1851,6 @@ int lvmetad_vg_is_foreign(struct cmd_context *cmd, const char *vgname, const cha
|
||||
ret = !is_system_id_allowed(cmd, system_id);
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user