1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

cleanup: use _ for static var

Add missing '_' for some static vars.
This commit is contained in:
Zdenek Kabelac 2024-05-30 15:41:50 +02:00
parent cd0f5ee36c
commit 896410b393
6 changed files with 30 additions and 28 deletions

View File

@ -220,22 +220,22 @@ void init_log_fn(lvm2_log_fn_t log_fn)
/* Read /proc/self/stat to extract pid and starttime */
static int _get_pid_starttime(int *pid, unsigned long long *starttime)
{
static const char statfile[] = DEFAULT_PROC_DIR "/self/stat";
static const char _statfile[] = DEFAULT_PROC_DIR "/self/stat";
char buf[1024];
char *p;
int fd;
int e;
if ((fd = open(statfile, O_RDONLY)) == -1) {
log_sys_debug("open", statfile);
if ((fd = open(_statfile, O_RDONLY)) == -1) {
log_sys_debug("open", _statfile);
return 0;
}
if ((e = read(fd, buf, sizeof(buf) - 1)) <= 0)
log_sys_debug("read", statfile);
log_sys_debug("read", _statfile);
if (close(fd))
log_sys_debug("close", statfile);
log_sys_debug("close", _statfile);
if (e <= 0)
return 0;
@ -251,7 +251,7 @@ static int _get_pid_starttime(int *pid, unsigned long long *starttime)
"%llu", starttime) == 1))
return 1;
log_debug("Cannot parse content of %s.", statfile);
log_debug("Cannot parse content of %s.", _statfile);
return 0;
}

View File

@ -784,9 +784,9 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
{
static const struct {
const struct segtype_handler *ops;
const char name[16];
const char name[12];
uint32_t flags;
} reg_segtypes[] = {
} _reg_segtypes[] = {
{ &_thin_pool_ops, "thin-pool", SEG_THIN_POOL | SEG_CANNOT_BE_ZEROED |
SEG_ONLY_EXCLUSIVE | SEG_CAN_ERROR_WHEN_FULL },
/* FIXME Maybe use SEG_THIN_VOLUME instead of SEG_VIRTUAL */
@ -796,24 +796,24 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
struct segment_type *segtype;
unsigned i;
for (i = 0; i < DM_ARRAY_SIZE(reg_segtypes); ++i) {
for (i = 0; i < DM_ARRAY_SIZE(_reg_segtypes); ++i) {
segtype = zalloc(sizeof(*segtype));
if (!segtype) {
log_error("Failed to allocate memory for %s segtype",
reg_segtypes[i].name);
_reg_segtypes[i].name);
return 0;
}
segtype->ops = reg_segtypes[i].ops;
segtype->name = reg_segtypes[i].name;
segtype->flags = reg_segtypes[i].flags;
segtype->ops = _reg_segtypes[i].ops;
segtype->name = _reg_segtypes[i].name;
segtype->flags = _reg_segtypes[i].flags;
#ifdef DEVMAPPER_SUPPORT
# ifdef DMEVENTD
segtype->dso = get_monitor_dso_path(cmd, dmeventd_thin_library_CFG);
if ((reg_segtypes[i].flags & SEG_THIN_POOL) &&
if ((_reg_segtypes[i].flags & SEG_THIN_POOL) &&
segtype->dso)
segtype->flags |= SEG_MONITORED;
# endif /* DMEVENTD */

View File

@ -122,7 +122,7 @@ int id_write_format(const struct id *id, char *buffer, size_t size)
{
int i, tot;
static const unsigned group_size[] = { 6, 4, 4, 4, 4, 4, 6 };
static const unsigned _group_size[] = { 6, 4, 4, 4, 4, 4, 6 };
assert(ID_LEN == 32);
@ -140,9 +140,9 @@ int id_write_format(const struct id *id, char *buffer, size_t size)
}
for (i = 0, tot = 0; i < 7; i++) {
memcpy(buffer, id->uuid + tot, group_size[i]);
buffer += group_size[i];
tot += group_size[i];
memcpy(buffer, id->uuid + tot, _group_size[i]);
buffer += _group_size[i];
tot += _group_size[i];
*buffer++ = '-';
}

View File

@ -54,7 +54,7 @@ static const struct opt_name opt_names[ARG_COUNT + 1] = {
/* create table of lv property names, e.g. lv_is_foo, and corresponding enum from lv_props.h */
static const struct lv_prop lv_props[LVP_COUNT + 1] = {
static const struct lv_prop _lv_props[LVP_COUNT + 1] = {
{ "" },
#define lvp(a) { "lv_" # a, a ## _LVP },
#include "lv_props.h"
@ -63,7 +63,7 @@ static const struct lv_prop lv_props[LVP_COUNT + 1] = {
/* create table of lv type names, e.g. linear and corresponding enum from lv_types.h */
static const struct lv_type lv_types[LVT_COUNT + 1] = {
static const struct lv_type _lv_types[LVT_COUNT + 1] = {
{ "" },
#define lvt(a) { # a, a ## _LVT },
#include "lv_types.h"
@ -116,14 +116,14 @@ const struct lv_prop *get_lv_prop(int lvp_enum)
{
if (!lvp_enum)
return NULL;
return &lv_props[lvp_enum];
return &_lv_props[lvp_enum];
}
const struct lv_type *get_lv_type(int lvt_enum)
{
if (!lvt_enum)
return NULL;
return &lv_types[lvt_enum];
return &_lv_types[lvt_enum];
}
#endif /* MAN_PAGE_GENERATOR */
@ -317,8 +317,8 @@ static int _lvp_name_to_enum(struct command *cmd, const char *str)
int i;
for (i = 1; i < LVP_COUNT; i++) {
if (!strcmp(str, lv_props[i].name))
return lv_props[i].lvp_enum;
if (!strcmp(str, _lv_props[i].name))
return _lv_props[i].lvp_enum;
}
log_error("Parsing command defs: unknown lv property %s.", str);
@ -333,8 +333,8 @@ static int _lvt_name_to_enum(struct command *cmd, const char *str)
int i;
for (i = 1; i < LVT_COUNT; i++) {
if (!strcmp(str, lv_types[i].name))
return lv_types[i].lvt_enum;
if (!strcmp(str, _lv_types[i].name))
return _lv_types[i].lvt_enum;
}
log_error("Parsing command defs: unknown lv type %s.", str);

View File

@ -6173,8 +6173,10 @@ static int _check_writecache_memory(struct cmd_context *cmd, struct logical_volu
while (fgets(line, sizeof(line), fp)) {
if (strncmp(line, "MemTotal:", 9))
continue;
if (sscanf(line, "%*s%llu%*s", &proc_mem_kb) != 1)
if (sscanf(line, "%*s%llu%*s", &proc_mem_kb) != 1) {
stack;
break;
}
break;
}
(void)fclose(fp);

View File

@ -114,7 +114,7 @@ static const size_t _LONG_LINE = 42; /* length of line that neededs .nh .. .hy *
static const char *_lvt_enum_to_name(int lvt_enum)
{
return lv_types[lvt_enum].name;
return _lv_types[lvt_enum].name;
}
static int _get_val_enum(const struct command_name *cname, int opt_enum)