mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-29 15:22:30 +03:00
tidy: Add missing underscores to statics.
This commit is contained in:
parent
327d9d59be
commit
f1cc5b12fd
lib
cache
commands
device
locking
metadata
mm
report
libdaemon
libdm
tools
6
lib/cache/lvmetad.c
vendored
6
lib/cache/lvmetad.c
vendored
@ -39,7 +39,7 @@ static int64_t _lvmetad_update_timeout;
|
|||||||
|
|
||||||
static int _found_lvm1_metadata = 0;
|
static int _found_lvm1_metadata = 0;
|
||||||
|
|
||||||
static struct volume_group *lvmetad_pvscan_vg(struct cmd_context *cmd, struct volume_group *vg);
|
static struct volume_group *_lvmetad_pvscan_vg(struct cmd_context *cmd, struct volume_group *vg);
|
||||||
|
|
||||||
static uint64_t _monotonic_seconds(void)
|
static uint64_t _monotonic_seconds(void)
|
||||||
{
|
{
|
||||||
@ -1090,7 +1090,7 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
|||||||
* invalidated the cached vg.
|
* invalidated the cached vg.
|
||||||
*/
|
*/
|
||||||
if (rescan) {
|
if (rescan) {
|
||||||
if (!(vg2 = lvmetad_pvscan_vg(cmd, vg))) {
|
if (!(vg2 = _lvmetad_pvscan_vg(cmd, vg))) {
|
||||||
log_debug_lvmetad("VG %s from lvmetad not found during rescan.", vgname);
|
log_debug_lvmetad("VG %s from lvmetad not found during rescan.", vgname);
|
||||||
fid = NULL;
|
fid = NULL;
|
||||||
release_vg(vg);
|
release_vg(vg);
|
||||||
@ -1787,7 +1787,7 @@ static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
|
|||||||
* the VG, and that PV may have been reused for another VG.
|
* the VG, and that PV may have been reused for another VG.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct volume_group *lvmetad_pvscan_vg(struct cmd_context *cmd, struct volume_group *vg)
|
static struct volume_group *_lvmetad_pvscan_vg(struct cmd_context *cmd, struct volume_group *vg)
|
||||||
{
|
{
|
||||||
char pvid_s[ID_LEN + 1] __attribute__((aligned(8)));
|
char pvid_s[ID_LEN + 1] __attribute__((aligned(8)));
|
||||||
char uuid[64] __attribute__((aligned(8)));
|
char uuid[64] __attribute__((aligned(8)));
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const size_t linebuffer_size = 4096;
|
static const size_t _linebuffer_size = 4096;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the input string, removing invalid characters.
|
* Copy the input string, removing invalid characters.
|
||||||
@ -1873,7 +1873,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
|||||||
/* Set in/out stream buffering before glibc */
|
/* Set in/out stream buffering before glibc */
|
||||||
if (set_buffering) {
|
if (set_buffering) {
|
||||||
/* Allocate 2 buffers */
|
/* Allocate 2 buffers */
|
||||||
if (!(cmd->linebuffer = dm_malloc(2 * linebuffer_size))) {
|
if (!(cmd->linebuffer = dm_malloc(2 * _linebuffer_size))) {
|
||||||
log_error("Failed to allocate line buffer.");
|
log_error("Failed to allocate line buffer.");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1884,7 +1884,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
|||||||
(flags & O_ACCMODE) != O_WRONLY) {
|
(flags & O_ACCMODE) != O_WRONLY) {
|
||||||
if (!reopen_standard_stream(&stdin, "r"))
|
if (!reopen_standard_stream(&stdin, "r"))
|
||||||
goto_out;
|
goto_out;
|
||||||
if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
|
if (setvbuf(stdin, cmd->linebuffer, _IOLBF, _linebuffer_size)) {
|
||||||
log_sys_error("setvbuf", "");
|
log_sys_error("setvbuf", "");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1895,8 +1895,8 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
|||||||
(flags & O_ACCMODE) != O_RDONLY) {
|
(flags & O_ACCMODE) != O_RDONLY) {
|
||||||
if (!reopen_standard_stream(&stdout, "w"))
|
if (!reopen_standard_stream(&stdout, "w"))
|
||||||
goto_out;
|
goto_out;
|
||||||
if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
|
if (setvbuf(stdout, cmd->linebuffer + _linebuffer_size,
|
||||||
_IOLBF, linebuffer_size)) {
|
_IOLBF, _linebuffer_size)) {
|
||||||
log_sys_error("setvbuf", "");
|
log_sys_error("setvbuf", "");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -261,8 +261,7 @@ out:
|
|||||||
/*
|
/*
|
||||||
* Retrieve chunk size from md device using sysfs.
|
* Retrieve chunk size from md device using sysfs.
|
||||||
*/
|
*/
|
||||||
static unsigned long dev_md_chunk_size(struct dev_types *dt,
|
static unsigned long _dev_md_chunk_size(struct dev_types *dt, struct device *dev)
|
||||||
struct device *dev)
|
|
||||||
{
|
{
|
||||||
const char *attribute = "chunk_size";
|
const char *attribute = "chunk_size";
|
||||||
unsigned long chunk_size_bytes = 0UL;
|
unsigned long chunk_size_bytes = 0UL;
|
||||||
@ -280,7 +279,7 @@ static unsigned long dev_md_chunk_size(struct dev_types *dt,
|
|||||||
/*
|
/*
|
||||||
* Retrieve level from md device using sysfs.
|
* Retrieve level from md device using sysfs.
|
||||||
*/
|
*/
|
||||||
static int dev_md_level(struct dev_types *dt, struct device *dev)
|
static int _dev_md_level(struct dev_types *dt, struct device *dev)
|
||||||
{
|
{
|
||||||
char level_string[MD_MAX_SYSFS_SIZE];
|
char level_string[MD_MAX_SYSFS_SIZE];
|
||||||
const char *attribute = "level";
|
const char *attribute = "level";
|
||||||
@ -303,7 +302,7 @@ static int dev_md_level(struct dev_types *dt, struct device *dev)
|
|||||||
/*
|
/*
|
||||||
* Retrieve raid_disks from md device using sysfs.
|
* Retrieve raid_disks from md device using sysfs.
|
||||||
*/
|
*/
|
||||||
static int dev_md_raid_disks(struct dev_types *dt, struct device *dev)
|
static int _dev_md_raid_disks(struct dev_types *dt, struct device *dev)
|
||||||
{
|
{
|
||||||
const char *attribute = "raid_disks";
|
const char *attribute = "raid_disks";
|
||||||
int raid_disks = 0;
|
int raid_disks = 0;
|
||||||
@ -327,15 +326,15 @@ unsigned long dev_md_stripe_width(struct dev_types *dt, struct device *dev)
|
|||||||
unsigned long stripe_width_sectors = 0UL;
|
unsigned long stripe_width_sectors = 0UL;
|
||||||
int level, raid_disks, data_disks;
|
int level, raid_disks, data_disks;
|
||||||
|
|
||||||
chunk_size_sectors = dev_md_chunk_size(dt, dev);
|
chunk_size_sectors = _dev_md_chunk_size(dt, dev);
|
||||||
if (!chunk_size_sectors)
|
if (!chunk_size_sectors)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
level = dev_md_level(dt, dev);
|
level = _dev_md_level(dt, dev);
|
||||||
if (level < 0)
|
if (level < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
raid_disks = dev_md_raid_disks(dt, dev);
|
raid_disks = _dev_md_raid_disks(dt, dev);
|
||||||
if (!raid_disks)
|
if (!raid_disks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
#define MAX_PAGESIZE (64 * 1024)
|
#define MAX_PAGESIZE (64 * 1024)
|
||||||
#define SIGNATURE_SIZE 10
|
#define SIGNATURE_SIZE 10
|
||||||
|
|
||||||
static int
|
static int _swap_detect_signature(const char *buf)
|
||||||
_swap_detect_signature(const char *buf)
|
|
||||||
{
|
{
|
||||||
if (memcmp(buf, "SWAP-SPACE", 10) == 0 ||
|
if (memcmp(buf, "SWAP-SPACE", 10) == 0 ||
|
||||||
memcmp(buf, "SWAPSPACE2", 10) == 0)
|
memcmp(buf, "SWAPSPACE2", 10) == 0)
|
||||||
|
@ -515,7 +515,7 @@ static int _lock_resource(struct cmd_context *cmd, const char *resource,
|
|||||||
return _lock_for_cluster(cmd, clvmd_cmd, flags, lockname);
|
return _lock_for_cluster(cmd, clvmd_cmd, flags, lockname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_lock_type(const char *response)
|
static int _decode_lock_type(const char *response)
|
||||||
{
|
{
|
||||||
if (!response)
|
if (!response)
|
||||||
return LCK_NULL;
|
return LCK_NULL;
|
||||||
@ -566,8 +566,8 @@ int query_resource(const char *resource, const char *node, int *mode)
|
|||||||
* If two nodes report different locks,
|
* If two nodes report different locks,
|
||||||
* something is broken - just return more important mode.
|
* something is broken - just return more important mode.
|
||||||
*/
|
*/
|
||||||
if (decode_lock_type(response[i].response) > *mode)
|
if (_decode_lock_type(response[i].response) > *mode)
|
||||||
*mode = decode_lock_type(response[i].response);
|
*mode = _decode_lock_type(response[i].response);
|
||||||
|
|
||||||
log_debug_locking("Lock held for %s, node %s : %s", resource,
|
log_debug_locking("Lock held for %s, node %s : %s", resource,
|
||||||
response[i].node, response[i].response);
|
response[i].node, response[i].response);
|
||||||
|
@ -4719,7 +4719,7 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
|
static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
|
||||||
{
|
{
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
struct lv_segment *seg_mirr;
|
struct lv_segment *seg_mirr;
|
||||||
@ -5165,7 +5165,7 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
|
|||||||
seg_physical_extents = seg->area_len * seg->area_count; /* FIXME Also metadata, cow etc. */
|
seg_physical_extents = seg->area_len * seg->area_count; /* FIXME Also metadata, cow etc. */
|
||||||
|
|
||||||
/* Check for underlying stripe sizes */
|
/* Check for underlying stripe sizes */
|
||||||
seg_stripes = lvseg_get_stripes(seg, &seg_stripesize);
|
seg_stripes = _lvseg_get_stripes(seg, &seg_stripesize);
|
||||||
|
|
||||||
if (seg_is_mirrored(seg))
|
if (seg_is_mirrored(seg))
|
||||||
seg_mirrors = lv_mirror_count(seg->lv);
|
seg_mirrors = lv_mirror_count(seg->lv);
|
||||||
|
@ -177,8 +177,8 @@ void del_pvl_from_vgs(struct volume_group *vg, struct pv_list *pvl)
|
|||||||
* 1 - success
|
* 1 - success
|
||||||
* FIXME: remove pv_name - obtain safely from pv
|
* FIXME: remove pv_name - obtain safely from pv
|
||||||
*/
|
*/
|
||||||
static int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
||||||
struct physical_volume *pv, int new_pv)
|
struct physical_volume *pv, int new_pv)
|
||||||
{
|
{
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
struct format_instance *fid = vg->fid;
|
struct format_instance *fid = vg->fid;
|
||||||
@ -720,9 +720,9 @@ static int _check_pv_dev_sizes(struct volume_group *vg)
|
|||||||
* - max_phys_block_size: largest physical block size found amongst PVs in a VG
|
* - max_phys_block_size: largest physical block size found amongst PVs in a VG
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
|
static int _vg_extend_single_pv(struct volume_group *vg, char *pv_name,
|
||||||
struct pvcreate_params *pp,
|
struct pvcreate_params *pp,
|
||||||
unsigned int *max_phys_block_size)
|
unsigned int *max_phys_block_size)
|
||||||
{
|
{
|
||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
struct pv_to_write *pvw;
|
struct pv_to_write *pvw;
|
||||||
@ -746,7 +746,7 @@ static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
|
|||||||
max_phys_block_size)))
|
max_phys_block_size)))
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
|
||||||
if (!add_pv_to_vg(vg, pv_name, pv, new_pv))
|
if (!_add_pv_to_vg(vg, pv_name, pv, new_pv))
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
|
||||||
if ((pv->fmt->features & FMT_PV_FLAGS) ||
|
if ((pv->fmt->features & FMT_PV_FLAGS) ||
|
||||||
@ -774,7 +774,7 @@ bad:
|
|||||||
* source file. All the following and more are only used by liblvm:
|
* source file. All the following and more are only used by liblvm:
|
||||||
*
|
*
|
||||||
* . vg_extend()
|
* . vg_extend()
|
||||||
* . vg_extend_single_pv()
|
* . _vg_extend_single_pv()
|
||||||
* . pvcreate_vol()
|
* . pvcreate_vol()
|
||||||
* . _pvcreate_check()
|
* . _pvcreate_check()
|
||||||
* . _pvcreate_write()
|
* . _pvcreate_write()
|
||||||
@ -813,7 +813,7 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dm_unescape_colons_and_at_signs(pv_name, NULL, NULL);
|
dm_unescape_colons_and_at_signs(pv_name, NULL, NULL);
|
||||||
if (!vg_extend_single_pv(vg, pv_name, pp, &max_phys_block_size)) {
|
if (!_vg_extend_single_pv(vg, pv_name, pp, &max_phys_block_size)) {
|
||||||
log_error("Unable to add physical volume '%s' to "
|
log_error("Unable to add physical volume '%s' to "
|
||||||
"volume group '%s'.", pv_name, vg->name);
|
"volume group '%s'.", pv_name, vg->name);
|
||||||
dm_free(pv_name);
|
dm_free(pv_name);
|
||||||
@ -849,7 +849,7 @@ int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!add_pv_to_vg(vg, pv_dev_name(pvl->pv), pvl->pv, 0)) {
|
if (!_add_pv_to_vg(vg, pv_dev_name(pvl->pv), pvl->pv, 0)) {
|
||||||
log_error("PV %s cannot be added to VG %s.",
|
log_error("PV %s cannot be added to VG %s.",
|
||||||
pv_dev_name(pvl->pv), vg->name);
|
pv_dev_name(pvl->pv), vg->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -84,8 +84,8 @@ int peg_dup(struct dm_pool *mem, struct dm_list *peg_new, struct dm_list *peg_ol
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find segment at a given physical extent in a PV */
|
/* Find segment at a given physical extent in a PV */
|
||||||
static struct pv_segment *find_peg_by_pe(const struct physical_volume *pv,
|
static struct pv_segment *_find_peg_by_pe(const struct physical_volume *pv,
|
||||||
uint32_t pe)
|
uint32_t pe)
|
||||||
{
|
{
|
||||||
struct pv_segment *pvseg;
|
struct pv_segment *pvseg;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ int pv_split_segment(struct dm_pool *mem,
|
|||||||
if (pe == pv->pe_count)
|
if (pe == pv->pe_count)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!(pvseg = find_peg_by_pe(pv, pe))) {
|
if (!(pvseg = _find_peg_by_pe(pv, pe))) {
|
||||||
log_error("Segment with extent %" PRIu32 " in PV %s not found",
|
log_error("Segment with extent %" PRIu32 " in PV %s not found",
|
||||||
pe, pv_dev_name(pv));
|
pe, pv_dev_name(pv));
|
||||||
return 0;
|
return 0;
|
||||||
@ -158,7 +158,7 @@ out:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pv_segment null_pv_segment = {
|
static struct pv_segment _null_pv_segment = {
|
||||||
.pv = NULL,
|
.pv = NULL,
|
||||||
.pe = 0,
|
.pe = 0,
|
||||||
};
|
};
|
||||||
@ -172,7 +172,7 @@ struct pv_segment *assign_peg_to_lvseg(struct physical_volume *pv,
|
|||||||
|
|
||||||
/* Missing format1 PV */
|
/* Missing format1 PV */
|
||||||
if (!pv)
|
if (!pv)
|
||||||
return &null_pv_segment;
|
return &_null_pv_segment;
|
||||||
|
|
||||||
if (!pv_split_segment(seg->lv->vg->vgmem, pv, pe, &peg) ||
|
if (!pv_split_segment(seg->lv->vg->vgmem, pv, pe, &peg) ||
|
||||||
!pv_split_segment(seg->lv->vg->vgmem, pv, pe + area_len, NULL))
|
!pv_split_segment(seg->lv->vg->vgmem, pv, pe + area_len, NULL))
|
||||||
@ -556,9 +556,7 @@ static int _extend_pv(struct physical_volume *pv, struct volume_group *vg,
|
|||||||
* Resize a PV in a VG, adding or removing segments as needed.
|
* Resize a PV in a VG, adding or removing segments as needed.
|
||||||
* New size must fit within pv->size.
|
* New size must fit within pv->size.
|
||||||
*/
|
*/
|
||||||
static int pv_resize(struct physical_volume *pv,
|
static int _pv_resize(struct physical_volume *pv, struct volume_group *vg, uint64_t size)
|
||||||
struct volume_group *vg,
|
|
||||||
uint64_t size)
|
|
||||||
{
|
{
|
||||||
uint32_t old_pe_count, new_pe_count = 0;
|
uint32_t old_pe_count, new_pe_count = 0;
|
||||||
|
|
||||||
@ -674,7 +672,7 @@ int pv_resize_single(struct cmd_context *cmd,
|
|||||||
log_verbose("Resizing volume \"%s\" to %" PRIu64 " sectors.",
|
log_verbose("Resizing volume \"%s\" to %" PRIu64 " sectors.",
|
||||||
pv_name, size);
|
pv_name, size);
|
||||||
|
|
||||||
if (!pv_resize(pv, vg, size))
|
if (!_pv_resize(pv, vg, size))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
log_verbose("Updating physical volume \"%s\"", pv_name);
|
log_verbose("Updating physical volume \"%s\"", pv_name);
|
||||||
@ -712,8 +710,8 @@ out:
|
|||||||
* Decide whether it is "safe" to wipe the labels on this device.
|
* Decide whether it is "safe" to wipe the labels on this device.
|
||||||
* 0 indicates we may not.
|
* 0 indicates we may not.
|
||||||
*/
|
*/
|
||||||
static int pvremove_check(struct cmd_context *cmd, const char *name,
|
static int _pvremove_check(struct cmd_context *cmd, const char *name,
|
||||||
unsigned force_count, unsigned prompt, struct dm_list *pvslist)
|
unsigned force_count, unsigned prompt, struct dm_list *pvslist)
|
||||||
{
|
{
|
||||||
static const char really_wipe_msg[] = "Really WIPE LABELS from physical volume";
|
static const char really_wipe_msg[] = "Really WIPE LABELS from physical volume";
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
@ -804,7 +802,7 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
|
|||||||
struct lvmcache_info *info;
|
struct lvmcache_info *info;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (!pvremove_check(cmd, pv_name, force_count, prompt, pvslist))
|
if (!_pvremove_check(cmd, pv_name, force_count, prompt, pvslist))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
|
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
|
||||||
|
@ -1321,7 +1321,7 @@ static int _cmp_level(const struct segment_type *t1, const struct segment_type *
|
|||||||
*
|
*
|
||||||
* Return 1 if same, else != 1
|
* Return 1 if same, else != 1
|
||||||
*/
|
*/
|
||||||
static int is_same_level(const struct segment_type *t1, const struct segment_type *t2)
|
static int _is_same_level(const struct segment_type *t1, const struct segment_type *t2)
|
||||||
{
|
{
|
||||||
return _cmp_level(t1, t2);
|
return _cmp_level(t1, t2);
|
||||||
}
|
}
|
||||||
@ -2331,7 +2331,7 @@ static int _raid_reshape(struct logical_volume *lv,
|
|||||||
if (!seg_is_reshapable_raid(seg))
|
if (!seg_is_reshapable_raid(seg))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!is_same_level(seg->segtype, new_segtype))
|
if (!_is_same_level(seg->segtype, new_segtype))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(old_image_count = seg->area_count))
|
if (!(old_image_count = seg->area_count))
|
||||||
@ -2510,7 +2510,7 @@ static int _reshape_requested(const struct logical_volume *lv, const struct segm
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Switching raid levels is a takeover, no reshape */
|
/* Switching raid levels is a takeover, no reshape */
|
||||||
if (!is_same_level(seg->segtype, segtype))
|
if (!_is_same_level(seg->segtype, segtype))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Possible takeover in case #data_copies == #stripes */
|
/* Possible takeover in case #data_copies == #stripes */
|
||||||
@ -6042,7 +6042,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
|
|||||||
const struct segment_type *segtype_sav = *segtype;
|
const struct segment_type *segtype_sav = *segtype;
|
||||||
|
|
||||||
/* Bail out if same RAID level is requested. */
|
/* Bail out if same RAID level is requested. */
|
||||||
if (is_same_level(seg_from->segtype, *segtype))
|
if (_is_same_level(seg_from->segtype, *segtype))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
log_debug("Checking LV %s requested %s segment type for convenience",
|
log_debug("Checking LV %s requested %s segment type for convenience",
|
||||||
@ -6296,7 +6296,7 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
|
|||||||
if (r &&
|
if (r &&
|
||||||
!yes &&
|
!yes &&
|
||||||
strcmp((*segtype_to)->name, SEG_TYPE_NAME_MIRROR) && /* "mirror" is prompted for later */
|
strcmp((*segtype_to)->name, SEG_TYPE_NAME_MIRROR) && /* "mirror" is prompted for later */
|
||||||
!is_same_level(seg_from->segtype, *segtype_to)) { /* Prompt here for takeover */
|
!_is_same_level(seg_from->segtype, *segtype_to)) { /* Prompt here for takeover */
|
||||||
const char *basic_fmt = "Are you sure you want to convert %s LV %s";
|
const char *basic_fmt = "Are you sure you want to convert %s LV %s";
|
||||||
const char *type_fmt = " to %s type";
|
const char *type_fmt = " to %s type";
|
||||||
const char *question_fmt = "? [y/n]: ";
|
const char *question_fmt = "? [y/n]: ";
|
||||||
|
@ -396,7 +396,7 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
static const unsigned char INSTRUCTION_HLT = 0x94;
|
static const unsigned char _instruction_hlt = 0x94;
|
||||||
static char _mmap_orig;
|
static char _mmap_orig;
|
||||||
static unsigned char *_mmap_addr;
|
static unsigned char *_mmap_addr;
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
@ -429,8 +429,8 @@ static int _disable_mmap(void)
|
|||||||
}
|
}
|
||||||
_mmap_orig = *_mmap_addr;
|
_mmap_orig = *_mmap_addr;
|
||||||
}
|
}
|
||||||
log_debug_mem("Remapping mmap entry %02x to %02x.", _mmap_orig, INSTRUCTION_HLT);
|
log_debug_mem("Remapping mmap entry %02x to %02x.", _mmap_orig, _instruction_hlt);
|
||||||
*_mmap_addr = INSTRUCTION_HLT;
|
*_mmap_addr = _instruction_hlt;
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
if (!_mmap64_addr) {
|
if (!_mmap64_addr) {
|
||||||
|
@ -38,8 +38,7 @@ struct lvm_report_object {
|
|||||||
struct label *label;
|
struct label *label;
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t log_seqnum = 1;
|
static uint32_t _log_seqnum = 1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enum for field_num index to use in per-field reserved value definition.
|
* Enum for field_num index to use in per-field reserved value definition.
|
||||||
@ -1091,10 +1090,10 @@ static void *_lv_time_handler_get_dynamic_value(struct dm_report *rh,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lv_time_handler(struct dm_report *rh, struct dm_pool *mem,
|
static int _lv_time_handler(struct dm_report *rh, struct dm_pool *mem,
|
||||||
uint32_t field_num,
|
uint32_t field_num,
|
||||||
dm_report_reserved_action_t action,
|
dm_report_reserved_action_t action,
|
||||||
const void *data_in, const void **data_out)
|
const void *data_in, const void **data_out)
|
||||||
{
|
{
|
||||||
*data_out = NULL;
|
*data_out = NULL;
|
||||||
if (!data_in)
|
if (!data_in)
|
||||||
@ -4128,7 +4127,7 @@ int report_cmdlog(void *handle, const char *type, const char *context,
|
|||||||
const char *object_group_id, const char *msg,
|
const char *object_group_id, const char *msg,
|
||||||
int current_errno, int ret_code)
|
int current_errno, int ret_code)
|
||||||
{
|
{
|
||||||
struct cmd_log_item log_item = {log_seqnum++, type, context, object_type_name,
|
struct cmd_log_item log_item = {_log_seqnum++, type, context, object_type_name,
|
||||||
object_name ? : "", object_id ? : "",
|
object_name ? : "", object_id ? : "",
|
||||||
object_group ? : "", object_group_id ? : "",
|
object_group ? : "", object_group_id ? : "",
|
||||||
msg ? : "", current_errno, ret_code};
|
msg ? : "", current_errno, ret_code};
|
||||||
@ -4141,7 +4140,7 @@ int report_cmdlog(void *handle, const char *type, const char *context,
|
|||||||
|
|
||||||
void report_reset_cmdlog_seqnum(void)
|
void report_reset_cmdlog_seqnum(void)
|
||||||
{
|
{
|
||||||
log_seqnum = 1;
|
_log_seqnum = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int report_current_object_cmdlog(const char *type, const char *msg, int32_t ret_code)
|
int report_current_object_cmdlog(const char *type, const char *msg, int32_t ret_code)
|
||||||
|
@ -90,8 +90,8 @@ FIELD_RESERVED_VALUE(NOFLAG, lv_read_ahead, lv_read_ahead_auto, "", &_siz_max, "
|
|||||||
FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_error, "", "error", "error", "error when full", "error if no space")
|
FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_error, "", "error", "error", "error when full", "error if no space")
|
||||||
FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_queue, "", "queue", "queue", "queue when full", "queue if no space")
|
FIELD_RESERVED_VALUE(NAMED, lv_when_full, lv_when_full_queue, "", "queue", "queue", "queue when full", "queue if no space")
|
||||||
FIELD_RESERVED_VALUE(NOFLAG, lv_when_full, lv_when_full_undef, "", "", "", "undefined")
|
FIELD_RESERVED_VALUE(NOFLAG, lv_when_full, lv_when_full_undef, "", "", "", "undefined")
|
||||||
FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time, lv_time_fuzzy, "", lv_time_handler, NULL)
|
FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time, lv_time_fuzzy, "", _lv_time_handler, NULL)
|
||||||
FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time_removed, lv_time_removed_fuzzy, "", lv_time_handler, NULL)
|
FIELD_RESERVED_VALUE(NAMED | RANGE | FUZZY | DYNAMIC, lv_time_removed, lv_time_removed_fuzzy, "", _lv_time_handler, NULL)
|
||||||
|
|
||||||
/* Reserved values for SEG fields */
|
/* Reserved values for SEG fields */
|
||||||
FIELD_RESERVED_VALUE(NOFLAG, cache_policy, cache_policy_undef, "", "", "", "undefined")
|
FIELD_RESERVED_VALUE(NOFLAG, cache_policy, cache_policy_undef, "", "", "", "undefined")
|
||||||
|
@ -304,7 +304,7 @@ struct dm_config_node *config_make_nodes(struct dm_config_tree *cft,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test if the doubles are close enough to be considered equal */
|
/* Test if the doubles are close enough to be considered equal */
|
||||||
static int close_enough(double d1, double d2)
|
static int _close_enough(double d1, double d2)
|
||||||
{
|
{
|
||||||
return fabs(d1 - d2) < DBL_EPSILON;
|
return fabs(d1 - d2) < DBL_EPSILON;
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ int compare_value(struct dm_config_value *a, struct dm_config_value *b)
|
|||||||
|
|
||||||
switch (a->type) {
|
switch (a->type) {
|
||||||
case DM_CFG_STRING: r = strcmp(a->v.str, b->v.str); break;
|
case DM_CFG_STRING: r = strcmp(a->v.str, b->v.str); break;
|
||||||
case DM_CFG_FLOAT: r = close_enough(a->v.f, b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
|
case DM_CFG_FLOAT: r = _close_enough(a->v.f, b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
|
||||||
case DM_CFG_INT: r = (a->v.i == b->v.i) ? 0 : (a->v.i > b->v.i) ? 1 : -1; break;
|
case DM_CFG_INT: r = (a->v.i == b->v.i) ? 0 : (a->v.i > b->v.i) ? 1 : -1; break;
|
||||||
case DM_CFG_EMPTY_ARRAY: return 0;
|
case DM_CFG_EMPTY_ARRAY: return 0;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ struct backend {
|
|||||||
void (*log)(log_state *s, void **state, int type, const char *message);
|
void (*log)(log_state *s, void **state, int type, const char *message);
|
||||||
};
|
};
|
||||||
|
|
||||||
static void log_syslog(log_state *s, void **state, int type, const char *message)
|
static void _log_syslog(log_state *s, void **state, int type, const char *message)
|
||||||
{
|
{
|
||||||
int prio;
|
int prio;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ static void log_syslog(log_state *s, void **state, int type, const char *message
|
|||||||
syslog(prio, "%s", message);
|
syslog(prio, "%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_stderr(log_state *s, void **state, int type, const char *message)
|
static void _log_stderr(log_state *s, void **state, int type, const char *message)
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ static void log_stderr(log_state *s, void **state, int type, const char *message
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct backend backend[] = {
|
struct backend backend[] = {
|
||||||
{ DAEMON_LOG_OUTLET_SYSLOG, log_syslog },
|
{ DAEMON_LOG_OUTLET_SYSLOG, _log_syslog },
|
||||||
{ DAEMON_LOG_OUTLET_STDERR, log_stderr },
|
{ DAEMON_LOG_OUTLET_STDERR, _log_stderr },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ fail:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_connect(daemon_state s)
|
static int _handle_connect(daemon_state s)
|
||||||
{
|
{
|
||||||
thread_state *ts;
|
thread_state *ts;
|
||||||
struct sockaddr_un sockaddr;
|
struct sockaddr_un sockaddr;
|
||||||
@ -651,7 +651,7 @@ void daemon_start(daemon_state s)
|
|||||||
perror("select error");
|
perror("select error");
|
||||||
if (FD_ISSET(s.socket_fd, &in)) {
|
if (FD_ISSET(s.socket_fd, &in)) {
|
||||||
timeout_count = 0;
|
timeout_count = 0;
|
||||||
handle_connect(s);
|
_handle_connect(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
_reap(s, 0);
|
_reap(s, 0);
|
||||||
|
@ -594,7 +594,7 @@ int dm_cookie_supported(void)
|
|||||||
_dm_version_minor >= 15);
|
_dm_version_minor >= 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dm_inactive_supported(void)
|
static int _dm_inactive_supported(void)
|
||||||
{
|
{
|
||||||
int inactive_supported = 0;
|
int inactive_supported = 0;
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
|||||||
dmi->flags |= DM_SECURE_DATA_FLAG;
|
dmi->flags |= DM_SECURE_DATA_FLAG;
|
||||||
}
|
}
|
||||||
if (dmt->query_inactive_table) {
|
if (dmt->query_inactive_table) {
|
||||||
if (!dm_inactive_supported())
|
if (!_dm_inactive_supported())
|
||||||
log_warn("WARNING: Inactive table query unsupported "
|
log_warn("WARNING: Inactive table query unsupported "
|
||||||
"by kernel. It will use live table.");
|
"by kernel. It will use live table.");
|
||||||
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
|
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
|
||||||
|
@ -72,7 +72,7 @@ static struct dm_config_node *_create_node(struct dm_pool *mem);
|
|||||||
static char *_dup_tok(struct parser *p);
|
static char *_dup_tok(struct parser *p);
|
||||||
static char *_dup_token(struct dm_pool *mem, const char *b, const char *e);
|
static char *_dup_token(struct dm_pool *mem, const char *b, const char *e);
|
||||||
|
|
||||||
static const int sep = '/';
|
static const int _sep = '/';
|
||||||
|
|
||||||
#define MAX_INDENT 32
|
#define MAX_INDENT 32
|
||||||
|
|
||||||
@ -530,11 +530,11 @@ static struct dm_config_node *_find_or_make_node(struct dm_pool *mem,
|
|||||||
|
|
||||||
while (cn || mem) {
|
while (cn || mem) {
|
||||||
/* trim any leading slashes */
|
/* trim any leading slashes */
|
||||||
while (*path && (*path == sep))
|
while (*path && (*path == _sep))
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
/* find the end of this segment */
|
/* find the end of this segment */
|
||||||
for (e = path; *e && (*e != sep); e++) ;
|
for (e = path; *e && (*e != _sep); e++) ;
|
||||||
|
|
||||||
/* hunt for the node */
|
/* hunt for the node */
|
||||||
cn_found = NULL;
|
cn_found = NULL;
|
||||||
|
@ -269,16 +269,16 @@ static struct chunk *_new_chunk(struct dm_pool *p, size_t s)
|
|||||||
p->spare_chunk = 0;
|
p->spare_chunk = 0;
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_ENFORCE_POOL_LOCKING
|
#ifdef DEBUG_ENFORCE_POOL_LOCKING
|
||||||
if (!pagesize) {
|
if (!_pagesize) {
|
||||||
pagesize = getpagesize(); /* lvm_pagesize(); */
|
_pagesize = getpagesize(); /* lvm_pagesize(); */
|
||||||
pagesize_mask = pagesize - 1;
|
_pagesize_mask = _pagesize - 1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Allocate page aligned size so malloc could work.
|
* Allocate page aligned size so malloc could work.
|
||||||
* Otherwise page fault would happen from pool unrelated
|
* Otherwise page fault would happen from pool unrelated
|
||||||
* memory writes of internal malloc pointers.
|
* memory writes of internal malloc pointers.
|
||||||
*/
|
*/
|
||||||
# define aligned_malloc(s) (posix_memalign((void**)&c, pagesize, \
|
# define aligned_malloc(s) (posix_memalign((void**)&c, _pagesize, \
|
||||||
ALIGN_ON_PAGE(s)) == 0)
|
ALIGN_ON_PAGE(s)) == 0)
|
||||||
#else
|
#else
|
||||||
# define aligned_malloc(s) (c = dm_malloc(s))
|
# define aligned_malloc(s) (c = dm_malloc(s))
|
||||||
|
@ -35,9 +35,9 @@ void dm_pools_check_leaks(void);
|
|||||||
* - Only pool-fast is properly handled for now.
|
* - Only pool-fast is properly handled for now.
|
||||||
* - Checksum is slower compared to mprotect.
|
* - Checksum is slower compared to mprotect.
|
||||||
*/
|
*/
|
||||||
static size_t pagesize = 0;
|
static size_t _pagesize = 0;
|
||||||
static size_t pagesize_mask = 0;
|
static size_t _pagesize_mask = 0;
|
||||||
#define ALIGN_ON_PAGE(size) (((size) + (pagesize_mask)) & ~(pagesize_mask))
|
#define ALIGN_ON_PAGE(size) (((size) + (_pagesize_mask)) & ~(_pagesize_mask))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_POOL
|
#ifdef DEBUG_POOL
|
||||||
|
397
tools/command.c
397
tools/command.c
File diff suppressed because it is too large
Load Diff
@ -4625,8 +4625,8 @@ FIELD_F(STATS_META, STR, "ObjType", 7, dm_stats_object_type, "obj_type", "Type o
|
|||||||
#undef NUM
|
#undef NUM
|
||||||
#undef SIZ
|
#undef SIZ
|
||||||
|
|
||||||
static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid";
|
static const char *_default_report_options = "name,major,minor,attr,open,segments,events,uuid";
|
||||||
static const char *splitname_report_options = "vg_name,lv_name,lv_layer";
|
static const char *_splitname_report_options = "vg_name,lv_name,lv_layer";
|
||||||
|
|
||||||
/* Stats counters & derived metrics. */
|
/* Stats counters & derived metrics. */
|
||||||
#define RD_COUNTERS "read_count,reads_merged_count,read_sector_count,read_time,read_ticks"
|
#define RD_COUNTERS "read_count,reads_merged_count,read_sector_count,read_time,read_ticks"
|
||||||
@ -4661,7 +4661,7 @@ static const char *_stats_hist_relative_options = STATS_HIST ",hist_percent_boun
|
|||||||
|
|
||||||
static int _report_init(const struct command *cmd, const char *subcommand)
|
static int _report_init(const struct command *cmd, const char *subcommand)
|
||||||
{
|
{
|
||||||
char *options = (char *) default_report_options;
|
char *options = (char *) _default_report_options;
|
||||||
char *opt_fields = NULL; /* optional fields from command line */
|
char *opt_fields = NULL; /* optional fields from command line */
|
||||||
const char *keys = "";
|
const char *keys = "";
|
||||||
const char *separator = " ";
|
const char *separator = " ";
|
||||||
@ -4673,7 +4673,7 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (cmd && !strcmp(cmd->name, "splitname")) {
|
if (cmd && !strcmp(cmd->name, "splitname")) {
|
||||||
options = (char *) splitname_report_options;
|
options = (char *) _splitname_report_options;
|
||||||
_report_type |= DR_NAME;
|
_report_type |= DR_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6490,7 +6490,7 @@ static int _process_tree_options(const char *options)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *parse_loop_device_name(const char *dev, const char *dev_dir)
|
static char *_parse_loop_device_name(const char *dev, const char *dev_dir)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
@ -6657,7 +6657,7 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(device_name = parse_loop_device_name((*argvp)[0], dev_dir))) {
|
if (!(device_name = _parse_loop_device_name((*argvp)[0], dev_dir))) {
|
||||||
fprintf(stderr, "%s: Could not parse loop_device %s\n",
|
fprintf(stderr, "%s: Could not parse loop_device %s\n",
|
||||||
base, (*argvp)[0]);
|
base, (*argvp)[0]);
|
||||||
_usage(stderr);
|
_usage(stderr);
|
||||||
|
@ -241,7 +241,7 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
|
static int _detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
|
||||||
{
|
{
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
uint32_t num_meta_lvs;
|
uint32_t num_meta_lvs;
|
||||||
@ -274,7 +274,7 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int attach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
|
static int _attach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
|
||||||
{
|
{
|
||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
lv->status &= ~LV_NOTSYNCED;
|
lv->status &= ~LV_NOTSYNCED;
|
||||||
|
|
||||||
/* Separate mirror log or metadata devices so we can clear them */
|
/* Separate mirror log or metadata devices so we can clear them */
|
||||||
if (!detach_metadata_devices(seg, &device_list)) {
|
if (!_detach_metadata_devices(seg, &device_list)) {
|
||||||
log_error("Failed to clear %s %s for %s.",
|
log_error("Failed to clear %s %s for %s.",
|
||||||
lvseg_name(seg), seg_is_raid(seg) ?
|
lvseg_name(seg), seg_is_raid(seg) ?
|
||||||
"metadata area" : "mirror log", display_lvname(lv));
|
"metadata area" : "mirror log", display_lvname(lv));
|
||||||
@ -458,7 +458,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Put metadata sub-LVs back in place */
|
/* Put metadata sub-LVs back in place */
|
||||||
if (!attach_metadata_devices(seg, &device_list)) {
|
if (!_attach_metadata_devices(seg, &device_list)) {
|
||||||
log_error("Failed to reattach %s device after clearing.",
|
log_error("Failed to reattach %s device after clearing.",
|
||||||
(seg_is_raid(seg)) ? "metadata" : "log");
|
(seg_is_raid(seg)) ? "metadata" : "log");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -91,7 +91,7 @@ static struct cmdline_context _cmdline;
|
|||||||
* to use these functions instead of the old per-command-name function.
|
* to use these functions instead of the old per-command-name function.
|
||||||
* For now, any command id not included here uses the old command fn.
|
* For now, any command id not included here uses the old command fn.
|
||||||
*/
|
*/
|
||||||
static const struct command_function command_functions[CMD_COUNT] = {
|
static const struct command_function _command_functions[CMD_COUNT] = {
|
||||||
{ lvmconfig_general_CMD, lvmconfig },
|
{ lvmconfig_general_CMD, lvmconfig },
|
||||||
{ lvchange_properties_CMD, lvchange_properties_cmd },
|
{ lvchange_properties_CMD, lvchange_properties_cmd },
|
||||||
{ lvchange_resync_CMD, lvchange_resync_cmd },
|
{ lvchange_resync_CMD, lvchange_resync_cmd },
|
||||||
@ -1234,7 +1234,7 @@ static void _set_valid_args_for_command_name(int ci)
|
|||||||
command_names[ci].num_args = num_args;
|
command_names[ci].num_args = num_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct command_name *find_command_name(const char *name)
|
static struct command_name *_find_command_name(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1255,8 +1255,8 @@ static const struct command_function *_find_command_id_function(int command_enum
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < CMD_COUNT; i++) {
|
for (i = 0; i < CMD_COUNT; i++) {
|
||||||
if (command_functions[i].command_enum == command_enum)
|
if (_command_functions[i].command_enum == command_enum)
|
||||||
return &command_functions[i];
|
return &_command_functions[i];
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1307,7 +1307,7 @@ int lvm_register_commands(struct cmd_context *cmd, const char *run_name)
|
|||||||
|
|
||||||
/* old style */
|
/* old style */
|
||||||
if (!commands[i].functions) {
|
if (!commands[i].functions) {
|
||||||
struct command_name *cname = find_command_name(commands[i].name);
|
struct command_name *cname = _find_command_name(commands[i].name);
|
||||||
if (cname)
|
if (cname)
|
||||||
commands[i].fn = cname->fn;
|
commands[i].fn = cname->fn;
|
||||||
}
|
}
|
||||||
@ -1877,7 +1877,7 @@ static void _short_usage(const char *name)
|
|||||||
|
|
||||||
static int _usage(const char *name, int longhelp, int skip_notes)
|
static int _usage(const char *name, int longhelp, int skip_notes)
|
||||||
{
|
{
|
||||||
struct command_name *cname = find_command_name(name);
|
struct command_name *cname = _find_command_name(name);
|
||||||
struct command *cmd = NULL;
|
struct command *cmd = NULL;
|
||||||
int show_full = longhelp;
|
int show_full = longhelp;
|
||||||
int i;
|
int i;
|
||||||
@ -2041,7 +2041,7 @@ static int _find_arg(const char *cmd_name, int goval)
|
|||||||
int arg_enum;
|
int arg_enum;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!(cname = find_command_name(cmd_name)))
|
if (!(cname = _find_command_name(cmd_name)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < cname->num_args; i++) {
|
for (i = 0; i < cname->num_args; i++) {
|
||||||
@ -2768,7 +2768,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return_ECMD_FAILED;
|
return_ECMD_FAILED;
|
||||||
|
|
||||||
/* Look up command - will be NULL if not recognised */
|
/* Look up command - will be NULL if not recognised */
|
||||||
if (!(cmd->cname = find_command_name(cmd->name)))
|
if (!(cmd->cname = _find_command_name(cmd->name)))
|
||||||
return ENO_SUCH_CMD;
|
return ENO_SUCH_CMD;
|
||||||
|
|
||||||
if (!_process_command_line(cmd, &argc, &argv)) {
|
if (!_process_command_line(cmd, &argc, &argv)) {
|
||||||
@ -3512,7 +3512,7 @@ int lvm2_main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (!run_name)
|
if (!run_name)
|
||||||
run_shell = 1;
|
run_shell = 1;
|
||||||
else if (!find_command_name(run_name))
|
else if (!_find_command_name(run_name))
|
||||||
run_script = 1;
|
run_script = 1;
|
||||||
else
|
else
|
||||||
run_command_name = run_name;
|
run_command_name = run_name;
|
||||||
|
@ -72,7 +72,7 @@ static int _set_daemon_parms(struct cmd_context *cmd, struct daemon_parms *parms
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int poll_lv(struct cmd_context *cmd, const char *lv_name)
|
static int _poll_lv(struct cmd_context *cmd, const char *lv_name)
|
||||||
{
|
{
|
||||||
struct daemon_parms parms = { 0 };
|
struct daemon_parms parms = { 0 };
|
||||||
struct poll_operation_id id = {
|
struct poll_operation_id id = {
|
||||||
@ -110,5 +110,5 @@ int lvpoll(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return poll_lv(cmd, argv[0]);
|
return _poll_lv(cmd, argv[0]);
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ static int _lvscan_single_lvmetad(struct cmd_context *cmd, struct logical_volume
|
|||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
|
static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
int inkernel, snap_active = 1;
|
int inkernel, snap_active = 1;
|
||||||
@ -119,5 +119,5 @@ int lvscan(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return process_each_lv(cmd, argc, argv, NULL, NULL, 0, NULL, NULL, &lvscan_single);
|
return process_each_lv(cmd, argc, argv, NULL, NULL, 0, NULL, NULL, &_lvscan_single);
|
||||||
}
|
}
|
||||||
|
@ -237,13 +237,13 @@ struct poll_id_list {
|
|||||||
struct poll_operation_id *id;
|
struct poll_operation_id *id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct poll_operation_id *copy_poll_operation_id(struct dm_pool *mem,
|
static struct poll_operation_id *_copy_poll_operation_id(struct dm_pool *mem,
|
||||||
const struct poll_operation_id *id)
|
const struct poll_operation_id *id)
|
||||||
{
|
{
|
||||||
struct poll_operation_id *copy;
|
struct poll_operation_id *copy;
|
||||||
|
|
||||||
if (!id || !id->vg_name || !id->lv_name || !id->display_name || !id->uuid) {
|
if (!id || !id->vg_name || !id->lv_name || !id->display_name || !id->uuid) {
|
||||||
log_error(INTERNAL_ERROR "Wrong params for copy_poll_operation_id.");
|
log_error(INTERNAL_ERROR "Wrong params for _copy_poll_operation_id.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,8 +264,8 @@ static struct poll_operation_id *copy_poll_operation_id(struct dm_pool *mem,
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct poll_id_list* poll_id_list_create(struct dm_pool *mem,
|
static struct poll_id_list* _poll_id_list_create(struct dm_pool *mem,
|
||||||
const struct poll_operation_id *id)
|
const struct poll_operation_id *id)
|
||||||
{
|
{
|
||||||
struct poll_id_list *idl = (struct poll_id_list *) dm_pool_alloc(mem, sizeof(struct poll_id_list));
|
struct poll_id_list *idl = (struct poll_id_list *) dm_pool_alloc(mem, sizeof(struct poll_id_list));
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ static struct poll_id_list* poll_id_list_create(struct dm_pool *mem,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(idl->id = copy_poll_operation_id(mem, id))) {
|
if (!(idl->id = _copy_poll_operation_id(mem, id))) {
|
||||||
dm_pool_free(mem, idl);
|
dm_pool_free(mem, idl);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
|
|||||||
id.vg_name = vg->name;
|
id.vg_name = vg->name;
|
||||||
id.uuid = lv->lvid.s;
|
id.uuid = lv->lvid.s;
|
||||||
|
|
||||||
idl = poll_id_list_create(cmd->mem, &id);
|
idl = _poll_id_list_create(cmd->mem, &id);
|
||||||
if (!idl) {
|
if (!idl) {
|
||||||
log_error("Failed to create poll_id_list.");
|
log_error("Failed to create poll_id_list.");
|
||||||
goto err;
|
goto err;
|
||||||
@ -379,8 +379,8 @@ typedef struct {
|
|||||||
struct dm_list idls;
|
struct dm_list idls;
|
||||||
} lvmpolld_parms_t;
|
} lvmpolld_parms_t;
|
||||||
|
|
||||||
static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id,
|
static int _report_progress(struct cmd_context *cmd, struct poll_operation_id *id,
|
||||||
struct daemon_parms *parms)
|
struct daemon_parms *parms)
|
||||||
{
|
{
|
||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
struct logical_volume *lv;
|
struct logical_volume *lv;
|
||||||
@ -482,7 +482,7 @@ static int _lvmpolld_init_poll_vg(struct cmd_context *cmd, const char *vgname,
|
|||||||
r = lvmpolld_poll_init(cmd, &id, lpdp->parms);
|
r = lvmpolld_poll_init(cmd, &id, lpdp->parms);
|
||||||
|
|
||||||
if (r && !lpdp->parms->background) {
|
if (r && !lpdp->parms->background) {
|
||||||
if (!(idl = poll_id_list_create(cmd->mem, &id)))
|
if (!(idl = _poll_id_list_create(cmd->mem, &id)))
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
|
|
||||||
dm_list_add(&lpdp->idls, &idl->list);
|
dm_list_add(&lpdp->idls, &idl->list);
|
||||||
@ -519,7 +519,7 @@ static void _lvmpolld_poll_for_all_vgs(struct cmd_context *cmd,
|
|||||||
if (!r || finished)
|
if (!r || finished)
|
||||||
dm_list_del(&idl->list);
|
dm_list_del(&idl->list);
|
||||||
else if (!parms->aborting)
|
else if (!parms->aborting)
|
||||||
report_progress(cmd, idl->id, lpdp.parms);
|
_report_progress(cmd, idl->id, lpdp.parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpdp.parms->interval)
|
if (lpdp.parms->interval)
|
||||||
@ -548,7 +548,7 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id
|
|||||||
while (1) {
|
while (1) {
|
||||||
if (!(r = lvmpolld_request_info(id, parms, &finished)) ||
|
if (!(r = lvmpolld_request_info(id, parms, &finished)) ||
|
||||||
finished ||
|
finished ||
|
||||||
(!parms->aborting && !(r = report_progress(cmd, id, parms))))
|
(!parms->aborting && !(r = _report_progress(cmd, id, parms))))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (parms->interval)
|
if (parms->interval)
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
* Output arguments:
|
* Output arguments:
|
||||||
* pp: structure allocated by caller, fields written / validated here
|
* pp: structure allocated by caller, fields written / validated here
|
||||||
*/
|
*/
|
||||||
static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
|
static int _pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
|
||||||
struct pvcreate_params *pp)
|
struct pvcreate_params *pp)
|
||||||
{
|
{
|
||||||
pp->restorefile = arg_str_value(cmd, restorefile_ARG, NULL);
|
pp->restorefile = arg_str_value(cmd, restorefile_ARG, NULL);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pvcreate_restore_params_from_backup(struct cmd_context *cmd,
|
static int _pvcreate_restore_params_from_backup(struct cmd_context *cmd,
|
||||||
struct pvcreate_params *pp)
|
struct pvcreate_params *pp)
|
||||||
{
|
{
|
||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
@ -110,7 +110,7 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Device info needs to be available for reading the VG backup file in
|
* Device info needs to be available for reading the VG backup file in
|
||||||
* pvcreate_restore_params_from_backup.
|
* _pvcreate_restore_params_from_backup.
|
||||||
*/
|
*/
|
||||||
lvmcache_seed_infos_from_lvmetad(cmd);
|
lvmcache_seed_infos_from_lvmetad(cmd);
|
||||||
|
|
||||||
@ -126,10 +126,10 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
pvcreate_params_set_defaults(&pp);
|
pvcreate_params_set_defaults(&pp);
|
||||||
|
|
||||||
if (!pvcreate_restore_params_from_args(cmd, argc, &pp))
|
if (!_pvcreate_restore_params_from_args(cmd, argc, &pp))
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
|
|
||||||
if (!pvcreate_restore_params_from_backup(cmd, &pp))
|
if (!_pvcreate_restore_params_from_backup(cmd, &pp))
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
|
|
||||||
if (!pvcreate_params_from_args(cmd, &pp))
|
if (!pvcreate_params_from_args(cmd, &pp))
|
||||||
|
@ -293,7 +293,7 @@ static int _insert_pvmove_mirrors(struct cmd_context *cmd,
|
|||||||
*
|
*
|
||||||
* Returns: 1 if true, 0 otherwise
|
* Returns: 1 if true, 0 otherwise
|
||||||
*/
|
*/
|
||||||
static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
|
static int _sub_lv_of(struct logical_volume *lv, const char *lv_name)
|
||||||
{
|
{
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Continue up the tree */
|
/* Continue up the tree */
|
||||||
return sub_lv_of(seg->lv, lv_name);
|
return _sub_lv_of(seg->lv, lv_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -319,7 +319,7 @@ static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
|
|||||||
*
|
*
|
||||||
* If this LV is below a cache LV (at any depth), return 1.
|
* If this LV is below a cache LV (at any depth), return 1.
|
||||||
*/
|
*/
|
||||||
static int parent_lv_is_cache_type(struct logical_volume *lv)
|
static int _parent_lv_is_cache_type(struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ static int parent_lv_is_cache_type(struct logical_volume *lv)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Continue up the tree */
|
/* Continue up the tree */
|
||||||
return parent_lv_is_cache_type(seg->lv);
|
return _parent_lv_is_cache_type(seg->lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create new LV with mirror segments for the required copies */
|
/* Create new LV with mirror segments for the required copies */
|
||||||
@ -451,7 +451,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lv_name) {
|
if (lv_name) {
|
||||||
if (strcmp(lv->name, lv_name) && !sub_lv_of(lv, lv_name))
|
if (strcmp(lv->name, lv_name) && !_sub_lv_of(lv, lv_name))
|
||||||
continue;
|
continue;
|
||||||
lv_found = 1;
|
lv_found = 1;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_lv_is_cache_type(lv)) {
|
if (_parent_lv_is_cache_type(lv)) {
|
||||||
log_print_unless_silent("Skipping %s because a parent"
|
log_print_unless_silent("Skipping %s because a parent"
|
||||||
" is of cache type", lv->name);
|
" is of cache type", lv->name);
|
||||||
lv_skipped = 1;
|
lv_skipped = 1;
|
||||||
|
@ -2375,7 +2375,7 @@ void opt_array_to_str(struct cmd_context *cmd, int *opts, int count,
|
|||||||
buf[len - 1] = '\0';
|
buf[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lvp_bits_to_str(uint64_t bits, char *buf, int len)
|
static void _lvp_bits_to_str(uint64_t bits, char *buf, int len)
|
||||||
{
|
{
|
||||||
struct lv_prop *prop;
|
struct lv_prop *prop;
|
||||||
int lvp_enum;
|
int lvp_enum;
|
||||||
@ -2396,7 +2396,7 @@ static void lvp_bits_to_str(uint64_t bits, char *buf, int len)
|
|||||||
buf[len - 1] = '\0';
|
buf[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lvt_bits_to_str(uint64_t bits, char *buf, int len)
|
static void _lvt_bits_to_str(uint64_t bits, char *buf, int len)
|
||||||
{
|
{
|
||||||
struct lv_type *type;
|
struct lv_type *type;
|
||||||
int lvt_enum;
|
int lvt_enum;
|
||||||
@ -2850,7 +2850,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
|
|
||||||
if (rule->check_lvt_bits && (rule->rule == RULE_REQUIRE) && !lv_types_match_bits) {
|
if (rule->check_lvt_bits && (rule->rule == RULE_REQUIRE) && !lv_types_match_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvt_bits_to_str(rule->check_lvt_bits, buf, sizeof(buf));
|
_lvt_bits_to_str(rule->check_lvt_bits, buf, sizeof(buf));
|
||||||
if (rule->opts_count)
|
if (rule->opts_count)
|
||||||
log_warn("Command on LV %s uses options that require LV types %s.",
|
log_warn("Command on LV %s uses options that require LV types %s.",
|
||||||
display_lvname(lv), buf);
|
display_lvname(lv), buf);
|
||||||
@ -2864,7 +2864,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
|
|
||||||
if (rule->check_lvp_bits && (rule->rule == RULE_INVALID) && lv_props_match_bits) {
|
if (rule->check_lvp_bits && (rule->rule == RULE_INVALID) && lv_props_match_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvp_bits_to_str(lv_props_match_bits, buf, sizeof(buf));
|
_lvp_bits_to_str(lv_props_match_bits, buf, sizeof(buf));
|
||||||
if (rule->opts_count)
|
if (rule->opts_count)
|
||||||
log_warn("Command on LV %s uses options that are invalid with LV properties: %s.",
|
log_warn("Command on LV %s uses options that are invalid with LV properties: %s.",
|
||||||
display_lvname(lv), buf);
|
display_lvname(lv), buf);
|
||||||
@ -2878,7 +2878,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
|
|
||||||
if (rule->check_lvp_bits && (rule->rule == RULE_REQUIRE) && lv_props_unmatch_bits) {
|
if (rule->check_lvp_bits && (rule->rule == RULE_REQUIRE) && lv_props_unmatch_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvp_bits_to_str(lv_props_unmatch_bits, buf, sizeof(buf));
|
_lvp_bits_to_str(lv_props_unmatch_bits, buf, sizeof(buf));
|
||||||
if (rule->opts_count)
|
if (rule->opts_count)
|
||||||
log_warn("Command on LV %s uses options that require LV properties: %s.",
|
log_warn("Command on LV %s uses options that require LV properties: %s.",
|
||||||
display_lvname(lv), buf);
|
display_lvname(lv), buf);
|
||||||
|
@ -47,9 +47,9 @@ static char *_expand_filename(const char *template, const char *vg_name,
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vg_backup_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle)
|
struct processing_handle *handle)
|
||||||
{
|
{
|
||||||
char **last_filename = (char **)handle->custom_handle;
|
char **last_filename = (char **)handle->custom_handle;
|
||||||
char *filename;
|
char *filename;
|
||||||
@ -95,7 +95,7 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
init_pvmove(1);
|
init_pvmove(1);
|
||||||
|
|
||||||
ret = process_each_vg(cmd, argc, argv, NULL, NULL, READ_ALLOW_INCONSISTENT, 0,
|
ret = process_each_vg(cmd, argc, argv, NULL, NULL, READ_ALLOW_INCONSISTENT, 0,
|
||||||
handle, &vg_backup_single);
|
handle, &_vg_backup_single);
|
||||||
|
|
||||||
dm_free(last_filename);
|
dm_free(last_filename);
|
||||||
|
|
||||||
|
@ -680,9 +680,9 @@ static int _vgchange_lock_stop(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
return lockd_stop_vg(cmd, vg);
|
return lockd_stop_vg(cmd, vg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle)
|
struct processing_handle *handle)
|
||||||
{
|
{
|
||||||
int ret = ECMD_PROCESSED;
|
int ret = ECMD_PROCESSED;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -927,7 +927,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = process_each_vg(cmd, argc, argv, NULL, NULL, flags, 0, handle, &vgchange_single);
|
ret = process_each_vg(cmd, argc, argv, NULL, NULL, flags, 0, handle, &_vgchange_single);
|
||||||
|
|
||||||
destroy_processing_handle(cmd, handle);
|
destroy_processing_handle(cmd, handle);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vgconvert_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct pv_create_args pva = { 0 };
|
struct pv_create_args pva = { 0 };
|
||||||
struct logical_volume *lv;
|
struct logical_volume *lv;
|
||||||
@ -170,5 +170,5 @@ int vgconvert(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return process_each_vg(cmd, argc, argv, NULL, NULL, READ_FOR_UPDATE, 0, NULL,
|
return process_each_vg(cmd, argc, argv, NULL, NULL, READ_FOR_UPDATE, 0, NULL,
|
||||||
&vgconvert_single);
|
&_vgconvert_single);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
if (arg_is_set(cmd, activevolumegroups_ARG) && !lvs_in_vg_activated(vg))
|
if (arg_is_set(cmd, activevolumegroups_ARG) && !lvs_in_vg_activated(vg))
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
@ -93,7 +93,7 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
**********/
|
**********/
|
||||||
|
|
||||||
return process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, NULL,
|
return process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, NULL,
|
||||||
vgdisplay_single);
|
_vgdisplay_single);
|
||||||
|
|
||||||
/******** FIXME Need to count number processed
|
/******** FIXME Need to count number processed
|
||||||
Add this to process_each_vg if arg_is_set(cmd,activevolumegroups_ARG) ?
|
Add this to process_each_vg if arg_is_set(cmd,activevolumegroups_ARG) ?
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int vgimport_single(struct cmd_context *cmd,
|
static int _vgimport_single(struct cmd_context *cmd,
|
||||||
const char *vg_name,
|
const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
@ -110,5 +110,5 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return process_each_vg(cmd, argc, argv, NULL, NULL,
|
return process_each_vg(cmd, argc, argv, NULL, NULL,
|
||||||
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
|
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
&vgimport_single);
|
&_vgimport_single);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vgremove_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Though vgremove operates per VG by definition, internally, it
|
* Though vgremove operates per VG by definition, internally, it
|
||||||
@ -111,7 +111,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
cmd->handles_missing_pvs = 1;
|
cmd->handles_missing_pvs = 1;
|
||||||
ret = process_each_vg(cmd, argc, argv, NULL, NULL,
|
ret = process_each_vg(cmd, argc, argv, NULL, NULL,
|
||||||
READ_FOR_UPDATE, 0,
|
READ_FOR_UPDATE, 0,
|
||||||
NULL, &vgremove_single);
|
NULL, &_vgremove_single);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
|
static int _vgscan_single(struct cmd_context *cmd, const char *vg_name,
|
||||||
struct volume_group *vg,
|
struct volume_group *vg,
|
||||||
struct processing_handle *handle __attribute__((unused)))
|
struct processing_handle *handle __attribute__((unused)))
|
||||||
{
|
{
|
||||||
log_print_unless_silent("Found %svolume group \"%s\" using metadata type %s",
|
log_print_unless_silent("Found %svolume group \"%s\" using metadata type %s",
|
||||||
vg_is_exported(vg) ? "exported " : "", vg_name,
|
vg_is_exported(vg) ? "exported " : "", vg_name,
|
||||||
@ -117,7 +117,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
else
|
else
|
||||||
log_print_unless_silent("Reading volume groups from cache.");
|
log_print_unless_silent("Reading volume groups from cache.");
|
||||||
|
|
||||||
maxret = process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, NULL, &vgscan_single);
|
maxret = process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, NULL, &_vgscan_single);
|
||||||
|
|
||||||
if (arg_is_set(cmd, mknodes_ARG)) {
|
if (arg_is_set(cmd, mknodes_ARG)) {
|
||||||
ret = vgmknodes(cmd, argc, argv);
|
ret = vgmknodes(cmd, argc, argv);
|
||||||
|
@ -529,7 +529,7 @@ static struct volume_group *_vgsplit_from(struct cmd_context *cmd,
|
|||||||
/*
|
/*
|
||||||
* Has the user given an option related to a new vg as the split destination?
|
* Has the user given an option related to a new vg as the split destination?
|
||||||
*/
|
*/
|
||||||
static int new_vg_option_specified(struct cmd_context *cmd)
|
static int _new_vg_option_specified(struct cmd_context *cmd)
|
||||||
{
|
{
|
||||||
return(arg_is_set(cmd, clustered_ARG) ||
|
return(arg_is_set(cmd, clustered_ARG) ||
|
||||||
arg_is_set(cmd, alloc_ARG) ||
|
arg_is_set(cmd, alloc_ARG) ||
|
||||||
@ -616,7 +616,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (existing_vg) {
|
if (existing_vg) {
|
||||||
if (new_vg_option_specified(cmd)) {
|
if (_new_vg_option_specified(cmd)) {
|
||||||
log_error("Volume group \"%s\" exists, but new VG "
|
log_error("Volume group \"%s\" exists, but new VG "
|
||||||
"option specified", vg_name_to);
|
"option specified", vg_name_to);
|
||||||
goto bad;
|
goto bad;
|
||||||
|
Loading…
Reference in New Issue
Block a user