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

tidy: Add missing underscores to statics.

This commit is contained in:
Alasdair G Kergon 2017-10-18 15:57:46 +01:00
parent 327d9d59be
commit f1cc5b12fd
37 changed files with 358 additions and 362 deletions

6
lib/cache/lvmetad.c vendored
View File

@ -39,7 +39,7 @@ static int64_t _lvmetad_update_timeout;
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)
{
@ -1090,7 +1090,7 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
* invalidated the cached vg.
*/
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);
fid = NULL;
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.
*/
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 uuid[64] __attribute__((aligned(8)));

View File

@ -54,7 +54,7 @@
# include <malloc.h>
#endif
static const size_t linebuffer_size = 4096;
static const size_t _linebuffer_size = 4096;
/*
* 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 */
if (set_buffering) {
/* 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.");
goto out;
}
@ -1884,7 +1884,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
(flags & O_ACCMODE) != O_WRONLY) {
if (!reopen_standard_stream(&stdin, "r"))
goto_out;
if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
if (setvbuf(stdin, cmd->linebuffer, _IOLBF, _linebuffer_size)) {
log_sys_error("setvbuf", "");
goto out;
}
@ -1895,8 +1895,8 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
(flags & O_ACCMODE) != O_RDONLY) {
if (!reopen_standard_stream(&stdout, "w"))
goto_out;
if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
_IOLBF, linebuffer_size)) {
if (setvbuf(stdout, cmd->linebuffer + _linebuffer_size,
_IOLBF, _linebuffer_size)) {
log_sys_error("setvbuf", "");
goto out;
}

View File

@ -261,8 +261,7 @@ out:
/*
* Retrieve chunk size from md device using sysfs.
*/
static unsigned long dev_md_chunk_size(struct dev_types *dt,
struct device *dev)
static unsigned long _dev_md_chunk_size(struct dev_types *dt, struct device *dev)
{
const char *attribute = "chunk_size";
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.
*/
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];
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.
*/
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";
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;
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)
return 0;
level = dev_md_level(dt, dev);
level = _dev_md_level(dt, dev);
if (level < 0)
return 0;
raid_disks = dev_md_raid_disks(dt, dev);
raid_disks = _dev_md_raid_disks(dt, dev);
if (!raid_disks)
return 0;

View File

@ -20,8 +20,7 @@
#define MAX_PAGESIZE (64 * 1024)
#define SIGNATURE_SIZE 10
static int
_swap_detect_signature(const char *buf)
static int _swap_detect_signature(const char *buf)
{
if (memcmp(buf, "SWAP-SPACE", 10) == 0 ||
memcmp(buf, "SWAPSPACE2", 10) == 0)

View File

@ -515,7 +515,7 @@ static int _lock_resource(struct cmd_context *cmd, const char *resource,
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)
return LCK_NULL;
@ -566,8 +566,8 @@ int query_resource(const char *resource, const char *node, int *mode)
* If two nodes report different locks,
* something is broken - just return more important mode.
*/
if (decode_lock_type(response[i].response) > *mode)
*mode = decode_lock_type(response[i].response);
if (_decode_lock_type(response[i].response) > *mode)
*mode = _decode_lock_type(response[i].response);
log_debug_locking("Lock held for %s, node %s : %s", resource,
response[i].node, response[i].response);

View File

@ -4719,7 +4719,7 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
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;
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. */
/* 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))
seg_mirrors = lv_mirror_count(seg->lv);

View File

@ -177,8 +177,8 @@ void del_pvl_from_vgs(struct volume_group *vg, struct pv_list *pvl)
* 1 - success
* FIXME: remove pv_name - obtain safely from pv
*/
static int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
struct physical_volume *pv, int new_pv)
static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name,
struct physical_volume *pv, int new_pv)
{
struct pv_list *pvl;
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
*
*/
static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
struct pvcreate_params *pp,
unsigned int *max_phys_block_size)
static int _vg_extend_single_pv(struct volume_group *vg, char *pv_name,
struct pvcreate_params *pp,
unsigned int *max_phys_block_size)
{
struct physical_volume *pv;
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)))
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;
if ((pv->fmt->features & FMT_PV_FLAGS) ||
@ -774,7 +774,7 @@ bad:
* source file. All the following and more are only used by liblvm:
*
* . vg_extend()
* . vg_extend_single_pv()
* . _vg_extend_single_pv()
* . pvcreate_vol()
* . _pvcreate_check()
* . _pvcreate_write()
@ -813,7 +813,7 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names
return 0;
}
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 "
"volume group '%s'.", pv_name, vg->name);
dm_free(pv_name);
@ -849,7 +849,7 @@ int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp)
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.",
pv_dev_name(pvl->pv), vg->name);
return 0;

View File

@ -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 */
static struct pv_segment *find_peg_by_pe(const struct physical_volume *pv,
uint32_t pe)
static struct pv_segment *_find_peg_by_pe(const struct physical_volume *pv,
uint32_t pe)
{
struct pv_segment *pvseg;
@ -137,7 +137,7 @@ int pv_split_segment(struct dm_pool *mem,
if (pe == pv->pe_count)
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",
pe, pv_dev_name(pv));
return 0;
@ -158,7 +158,7 @@ out:
return 1;
}
static struct pv_segment null_pv_segment = {
static struct pv_segment _null_pv_segment = {
.pv = NULL,
.pe = 0,
};
@ -172,7 +172,7 @@ struct pv_segment *assign_peg_to_lvseg(struct physical_volume *pv,
/* Missing format1 PV */
if (!pv)
return &null_pv_segment;
return &_null_pv_segment;
if (!pv_split_segment(seg->lv->vg->vgmem, pv, pe, &peg) ||
!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.
* New size must fit within pv->size.
*/
static int pv_resize(struct physical_volume *pv,
struct volume_group *vg,
uint64_t size)
static int _pv_resize(struct physical_volume *pv, struct volume_group *vg, uint64_t size)
{
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.",
pv_name, size);
if (!pv_resize(pv, vg, size))
if (!_pv_resize(pv, vg, size))
goto_out;
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.
* 0 indicates we may not.
*/
static int pvremove_check(struct cmd_context *cmd, const char *name,
unsigned force_count, unsigned prompt, struct dm_list *pvslist)
static int _pvremove_check(struct cmd_context *cmd, const char *name,
unsigned force_count, unsigned prompt, struct dm_list *pvslist)
{
static const char really_wipe_msg[] = "Really WIPE LABELS from physical volume";
struct device *dev;
@ -804,7 +802,7 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
struct lvmcache_info *info;
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;
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {

View File

@ -1321,7 +1321,7 @@ static int _cmp_level(const struct segment_type *t1, const struct segment_type *
*
* 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);
}
@ -2331,7 +2331,7 @@ static int _raid_reshape(struct logical_volume *lv,
if (!seg_is_reshapable_raid(seg))
return_0;
if (!is_same_level(seg->segtype, new_segtype))
if (!_is_same_level(seg->segtype, new_segtype))
return_0;
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;
/* Switching raid levels is a takeover, no reshape */
if (!is_same_level(seg->segtype, segtype))
if (!_is_same_level(seg->segtype, segtype))
return 0;
/* 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;
/* 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;
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 &&
!yes &&
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 *type_fmt = " to %s type";
const char *question_fmt = "? [y/n]: ";

View File

@ -396,7 +396,7 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
#define _GNU_SOURCE
#endif
#include <dlfcn.h>
static const unsigned char INSTRUCTION_HLT = 0x94;
static const unsigned char _instruction_hlt = 0x94;
static char _mmap_orig;
static unsigned char *_mmap_addr;
#ifdef __i386__
@ -429,8 +429,8 @@ static int _disable_mmap(void)
}
_mmap_orig = *_mmap_addr;
}
log_debug_mem("Remapping mmap entry %02x to %02x.", _mmap_orig, INSTRUCTION_HLT);
*_mmap_addr = INSTRUCTION_HLT;
log_debug_mem("Remapping mmap entry %02x to %02x.", _mmap_orig, _instruction_hlt);
*_mmap_addr = _instruction_hlt;
#ifdef __i386__
if (!_mmap64_addr) {

View File

@ -38,8 +38,7 @@ struct lvm_report_object {
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.
@ -1091,10 +1090,10 @@ static void *_lv_time_handler_get_dynamic_value(struct dm_report *rh,
return result;
}
static int lv_time_handler(struct dm_report *rh, struct dm_pool *mem,
uint32_t field_num,
dm_report_reserved_action_t action,
const void *data_in, const void **data_out)
static int _lv_time_handler(struct dm_report *rh, struct dm_pool *mem,
uint32_t field_num,
dm_report_reserved_action_t action,
const void *data_in, const void **data_out)
{
*data_out = NULL;
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,
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_group ? : "", object_group_id ? : "",
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)
{
log_seqnum = 1;
_log_seqnum = 1;
}
int report_current_object_cmdlog(const char *type, const char *msg, int32_t ret_code)

View File

@ -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_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(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, 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)
/* Reserved values for SEG fields */
FIELD_RESERVED_VALUE(NOFLAG, cache_policy, cache_policy_undef, "", "", "", "undefined")

View File

@ -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 */
static int close_enough(double d1, double d2)
static int _close_enough(double d1, double d2)
{
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) {
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_EMPTY_ARRAY: return 0;
}

View File

@ -24,7 +24,7 @@ struct backend {
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;
@ -44,7 +44,7 @@ static void log_syslog(log_state *s, void **state, int type, const char *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;
@ -60,8 +60,8 @@ static void log_stderr(log_state *s, void **state, int type, const char *message
}
struct backend backend[] = {
{ DAEMON_LOG_OUTLET_SYSLOG, log_syslog },
{ DAEMON_LOG_OUTLET_STDERR, log_stderr },
{ DAEMON_LOG_OUTLET_SYSLOG, _log_syslog },
{ DAEMON_LOG_OUTLET_STDERR, _log_stderr },
{ 0, 0 }
};

View File

@ -498,7 +498,7 @@ fail:
return NULL;
}
static int handle_connect(daemon_state s)
static int _handle_connect(daemon_state s)
{
thread_state *ts;
struct sockaddr_un sockaddr;
@ -651,7 +651,7 @@ void daemon_start(daemon_state s)
perror("select error");
if (FD_ISSET(s.socket_fd, &in)) {
timeout_count = 0;
handle_connect(s);
_handle_connect(s);
}
_reap(s, 0);

View File

@ -594,7 +594,7 @@ int dm_cookie_supported(void)
_dm_version_minor >= 15);
}
static int dm_inactive_supported(void)
static int _dm_inactive_supported(void)
{
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;
}
if (dmt->query_inactive_table) {
if (!dm_inactive_supported())
if (!_dm_inactive_supported())
log_warn("WARNING: Inactive table query unsupported "
"by kernel. It will use live table.");
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;

View File

@ -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_token(struct dm_pool *mem, const char *b, const char *e);
static const int sep = '/';
static const int _sep = '/';
#define MAX_INDENT 32
@ -530,11 +530,11 @@ static struct dm_config_node *_find_or_make_node(struct dm_pool *mem,
while (cn || mem) {
/* trim any leading slashes */
while (*path && (*path == sep))
while (*path && (*path == _sep))
path++;
/* find the end of this segment */
for (e = path; *e && (*e != sep); e++) ;
for (e = path; *e && (*e != _sep); e++) ;
/* hunt for the node */
cn_found = NULL;

View File

@ -269,16 +269,16 @@ static struct chunk *_new_chunk(struct dm_pool *p, size_t s)
p->spare_chunk = 0;
} else {
#ifdef DEBUG_ENFORCE_POOL_LOCKING
if (!pagesize) {
pagesize = getpagesize(); /* lvm_pagesize(); */
pagesize_mask = pagesize - 1;
if (!_pagesize) {
_pagesize = getpagesize(); /* lvm_pagesize(); */
_pagesize_mask = _pagesize - 1;
}
/*
* Allocate page aligned size so malloc could work.
* Otherwise page fault would happen from pool unrelated
* 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)
#else
# define aligned_malloc(s) (c = dm_malloc(s))

View File

@ -35,9 +35,9 @@ void dm_pools_check_leaks(void);
* - Only pool-fast is properly handled for now.
* - Checksum is slower compared to mprotect.
*/
static size_t pagesize = 0;
static size_t pagesize_mask = 0;
#define ALIGN_ON_PAGE(size) (((size) + (pagesize_mask)) & ~(pagesize_mask))
static size_t _pagesize = 0;
static size_t _pagesize_mask = 0;
#define ALIGN_ON_PAGE(size) (((size) + (_pagesize_mask)) & ~(_pagesize_mask))
#endif
#ifdef DEBUG_POOL

File diff suppressed because it is too large Load Diff

View File

@ -4625,8 +4625,8 @@ FIELD_F(STATS_META, STR, "ObjType", 7, dm_stats_object_type, "obj_type", "Type o
#undef NUM
#undef SIZ
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 *_default_report_options = "name,major,minor,attr,open,segments,events,uuid";
static const char *_splitname_report_options = "vg_name,lv_name,lv_layer";
/* Stats counters & derived metrics. */
#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)
{
char *options = (char *) default_report_options;
char *options = (char *) _default_report_options;
char *opt_fields = NULL; /* optional fields from command line */
const char *keys = "";
const char *separator = " ";
@ -4673,7 +4673,7 @@ static int _report_init(const struct command *cmd, const char *subcommand)
int r = 0;
if (cmd && !strcmp(cmd->name, "splitname")) {
options = (char *) splitname_report_options;
options = (char *) _splitname_report_options;
_report_type |= DR_NAME;
}
@ -6490,7 +6490,7 @@ static int _process_tree_options(const char *options)
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 *device = NULL;
@ -6657,7 +6657,7 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
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",
base, (*argvp)[0]);
_usage(stderr);

View File

@ -241,7 +241,7 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
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 num_meta_lvs;
@ -274,7 +274,7 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
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;
@ -407,7 +407,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
lv->status &= ~LV_NOTSYNCED;
/* 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.",
lvseg_name(seg), seg_is_raid(seg) ?
"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 */
if (!attach_metadata_devices(seg, &device_list)) {
if (!_attach_metadata_devices(seg, &device_list)) {
log_error("Failed to reattach %s device after clearing.",
(seg_is_raid(seg)) ? "metadata" : "log");
return 0;

View File

@ -91,7 +91,7 @@ static struct cmdline_context _cmdline;
* 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.
*/
static const struct command_function command_functions[CMD_COUNT] = {
static const struct command_function _command_functions[CMD_COUNT] = {
{ lvmconfig_general_CMD, lvmconfig },
{ lvchange_properties_CMD, lvchange_properties_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;
}
static struct command_name *find_command_name(const char *name)
static struct command_name *_find_command_name(const char *name)
{
int i;
@ -1255,8 +1255,8 @@ static const struct command_function *_find_command_id_function(int command_enum
return NULL;
for (i = 0; i < CMD_COUNT; i++) {
if (command_functions[i].command_enum == command_enum)
return &command_functions[i];
if (_command_functions[i].command_enum == command_enum)
return &_command_functions[i];
}
return NULL;
}
@ -1307,7 +1307,7 @@ int lvm_register_commands(struct cmd_context *cmd, const char *run_name)
/* old style */
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)
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)
{
struct command_name *cname = find_command_name(name);
struct command_name *cname = _find_command_name(name);
struct command *cmd = NULL;
int show_full = longhelp;
int i;
@ -2041,7 +2041,7 @@ static int _find_arg(const char *cmd_name, int goval)
int arg_enum;
int i;
if (!(cname = find_command_name(cmd_name)))
if (!(cname = _find_command_name(cmd_name)))
return -1;
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;
/* 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;
if (!_process_command_line(cmd, &argc, &argv)) {
@ -3512,7 +3512,7 @@ int lvm2_main(int argc, char **argv)
*/
if (!run_name)
run_shell = 1;
else if (!find_command_name(run_name))
else if (!_find_command_name(run_name))
run_script = 1;
else
run_command_name = run_name;

View File

@ -72,7 +72,7 @@ static int _set_daemon_parms(struct cmd_context *cmd, struct daemon_parms *parms
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 poll_operation_id id = {
@ -110,5 +110,5 @@ int lvpoll(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
return poll_lv(cmd, argv[0]);
return _poll_lv(cmd, argv[0]);
}

View File

@ -45,8 +45,8 @@ static int _lvscan_single_lvmetad(struct cmd_context *cmd, struct logical_volume
return ECMD_PROCESSED;
}
static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle __attribute__((unused)))
static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle __attribute__((unused)))
{
struct lvinfo info;
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);
}

View File

@ -237,13 +237,13 @@ struct poll_id_list {
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)
{
struct poll_operation_id *copy;
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;
}
@ -264,8 +264,8 @@ static struct poll_operation_id *copy_poll_operation_id(struct dm_pool *mem,
return copy;
}
static struct poll_id_list* poll_id_list_create(struct dm_pool *mem,
const struct poll_operation_id *id)
static struct poll_id_list* _poll_id_list_create(struct dm_pool *mem,
const struct poll_operation_id *id)
{
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;
}
if (!(idl->id = copy_poll_operation_id(mem, id))) {
if (!(idl->id = _copy_poll_operation_id(mem, id))) {
dm_pool_free(mem, idl);
return NULL;
}
@ -329,7 +329,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
id.vg_name = vg->name;
id.uuid = lv->lvid.s;
idl = poll_id_list_create(cmd->mem, &id);
idl = _poll_id_list_create(cmd->mem, &id);
if (!idl) {
log_error("Failed to create poll_id_list.");
goto err;
@ -379,8 +379,8 @@ typedef struct {
struct dm_list idls;
} lvmpolld_parms_t;
static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id,
struct daemon_parms *parms)
static int _report_progress(struct cmd_context *cmd, struct poll_operation_id *id,
struct daemon_parms *parms)
{
struct volume_group *vg;
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);
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;
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)
dm_list_del(&idl->list);
else if (!parms->aborting)
report_progress(cmd, idl->id, lpdp.parms);
_report_progress(cmd, idl->id, lpdp.parms);
}
if (lpdp.parms->interval)
@ -548,7 +548,7 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id
while (1) {
if (!(r = lvmpolld_request_info(id, parms, &finished)) ||
finished ||
(!parms->aborting && !(r = report_progress(cmd, id, parms))))
(!parms->aborting && !(r = _report_progress(cmd, id, parms))))
break;
if (parms->interval)

View File

@ -22,8 +22,8 @@
* Output arguments:
* pp: structure allocated by caller, fields written / validated here
*/
static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
struct pvcreate_params *pp)
static int _pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
struct pvcreate_params *pp)
{
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;
}
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 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
* pvcreate_restore_params_from_backup.
* _pvcreate_restore_params_from_backup.
*/
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);
if (!pvcreate_restore_params_from_args(cmd, argc, &pp))
if (!_pvcreate_restore_params_from_args(cmd, argc, &pp))
return EINVALID_CMD_LINE;
if (!pvcreate_restore_params_from_backup(cmd, &pp))
if (!_pvcreate_restore_params_from_backup(cmd, &pp))
return EINVALID_CMD_LINE;
if (!pvcreate_params_from_args(cmd, &pp))

View File

@ -293,7 +293,7 @@ static int _insert_pvmove_mirrors(struct cmd_context *cmd,
*
* 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;
@ -308,7 +308,7 @@ static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
return 1;
/* 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.
*/
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;
@ -334,7 +334,7 @@ static int parent_lv_is_cache_type(struct logical_volume *lv)
return 1;
/* 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 */
@ -451,7 +451,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
continue;
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;
lv_found = 1;
}
@ -469,7 +469,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
continue;
}
if (parent_lv_is_cache_type(lv)) {
if (_parent_lv_is_cache_type(lv)) {
log_print_unless_silent("Skipping %s because a parent"
" is of cache type", lv->name);
lv_skipped = 1;

View File

@ -2375,7 +2375,7 @@ void opt_array_to_str(struct cmd_context *cmd, int *opts, int count,
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;
int lvp_enum;
@ -2396,7 +2396,7 @@ static void lvp_bits_to_str(uint64_t bits, char *buf, int len)
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;
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) {
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)
log_warn("Command on LV %s uses options that require LV types %s.",
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) {
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)
log_warn("Command on LV %s uses options that are invalid with LV properties: %s.",
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) {
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)
log_warn("Command on LV %s uses options that require LV properties: %s.",
display_lvname(lv), buf);

View File

@ -47,9 +47,9 @@ static char *_expand_filename(const char *template, const char *vg_name,
return filename;
}
static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle)
static int _vg_backup_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle)
{
char **last_filename = (char **)handle->custom_handle;
char *filename;
@ -95,7 +95,7 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv)
init_pvmove(1);
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);

View File

@ -680,9 +680,9 @@ static int _vgchange_lock_stop(struct cmd_context *cmd, struct volume_group *vg)
return lockd_stop_vg(cmd, vg);
}
static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle)
static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle)
{
int ret = ECMD_PROCESSED;
unsigned i;
@ -927,7 +927,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
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);
return ret;

View File

@ -15,9 +15,9 @@
#include "tools.h"
static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
static int _vgconvert_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
{
struct pv_create_args pva = { 0 };
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,
&vgconvert_single);
&_vgconvert_single);
}

View File

@ -15,9 +15,9 @@
#include "tools.h"
static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
static int _vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
{
if (arg_is_set(cmd, activevolumegroups_ARG) && !lvs_in_vg_activated(vg))
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,
vgdisplay_single);
_vgdisplay_single);
/******** FIXME Need to count number processed
Add this to process_each_vg if arg_is_set(cmd,activevolumegroups_ARG) ?

View File

@ -15,10 +15,10 @@
#include "tools.h"
static int vgimport_single(struct cmd_context *cmd,
const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
static int _vgimport_single(struct cmd_context *cmd,
const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
{
struct pv_list *pvl;
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,
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
0, NULL,
&vgimport_single);
&_vgimport_single);
}

View File

@ -15,9 +15,9 @@
#include "tools.h"
static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
static int _vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
{
/*
* 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;
ret = process_each_vg(cmd, argc, argv, NULL, NULL,
READ_FOR_UPDATE, 0,
NULL, &vgremove_single);
NULL, &_vgremove_single);
return ret;
}

View File

@ -15,9 +15,9 @@
#include "tools.h"
static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
static int _vgscan_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
struct processing_handle *handle __attribute__((unused)))
{
log_print_unless_silent("Found %svolume group \"%s\" using metadata type %s",
vg_is_exported(vg) ? "exported " : "", vg_name,
@ -117,7 +117,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv)
else
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)) {
ret = vgmknodes(cmd, argc, argv);

View File

@ -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?
*/
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) ||
arg_is_set(cmd, alloc_ARG) ||
@ -616,7 +616,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
}
if (existing_vg) {
if (new_vg_option_specified(cmd)) {
if (_new_vg_option_specified(cmd)) {
log_error("Volume group \"%s\" exists, but new VG "
"option specified", vg_name_to);
goto bad;