mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: add static _
This commit is contained in:
parent
5b7e30da76
commit
46669fe9e8
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
int disks_found;
|
static int _disks_found;
|
||||||
int parts_found;
|
static int _parts_found;
|
||||||
int pv_disks_found;
|
static int _pv_disks_found;
|
||||||
int pv_parts_found;
|
static int _pv_parts_found;
|
||||||
int max_len;
|
static int _max_len;
|
||||||
|
|
||||||
static int _get_max_dev_name_len(struct cmd_context *cmd, struct dev_filter *filter)
|
static int _get_max_dev_name_len(struct cmd_context *cmd, struct dev_filter *filter)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ static void _count(struct device *dev, int *disks, int *parts)
|
|||||||
static void _print(struct cmd_context *cmd, const struct device *dev,
|
static void _print(struct cmd_context *cmd, const struct device *dev,
|
||||||
uint64_t size, const char *what)
|
uint64_t size, const char *what)
|
||||||
{
|
{
|
||||||
log_print("%-*s [%15s] %s", max_len, dev_name(dev),
|
log_print("%-*s [%15s] %s", _max_len, dev_name(dev),
|
||||||
display_size(cmd, size), what ? : "");
|
display_size(cmd, size), what ? : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ static int _check_device(struct cmd_context *cmd, struct device *dev)
|
|||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
_print(cmd, dev, size, NULL);
|
_print(cmd, dev, size, NULL);
|
||||||
_count(dev, &disks_found, &parts_found);
|
_count(dev, &_disks_found, &_parts_found);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -89,10 +89,10 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
|
|||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
/* initialise these here to avoid problems with the lvm shell */
|
/* initialise these here to avoid problems with the lvm shell */
|
||||||
disks_found = 0;
|
_disks_found = 0;
|
||||||
parts_found = 0;
|
_parts_found = 0;
|
||||||
pv_disks_found = 0;
|
_pv_disks_found = 0;
|
||||||
pv_parts_found = 0;
|
_pv_parts_found = 0;
|
||||||
|
|
||||||
if (arg_is_set(cmd, lvmpartition_ARG))
|
if (arg_is_set(cmd, lvmpartition_ARG))
|
||||||
log_warn("WARNING: only considering LVM devices");
|
log_warn("WARNING: only considering LVM devices");
|
||||||
@ -100,7 +100,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
|
|||||||
/* Call before using dev_iter which uses filters which want bcache data. */
|
/* Call before using dev_iter which uses filters which want bcache data. */
|
||||||
label_scan(cmd);
|
label_scan(cmd);
|
||||||
|
|
||||||
max_len = _get_max_dev_name_len(cmd, cmd->filter);
|
_max_len = _get_max_dev_name_len(cmd, cmd->filter);
|
||||||
|
|
||||||
if (!(iter = dev_iter_create(cmd->filter, 0))) {
|
if (!(iter = dev_iter_create(cmd->filter, 0))) {
|
||||||
log_error("dev_iter_create failed");
|
log_error("dev_iter_create failed");
|
||||||
@ -115,7 +115,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_print(cmd, dev, size, "LVM physical volume");
|
_print(cmd, dev, size, "LVM physical volume");
|
||||||
_count(dev, &pv_disks_found, &pv_parts_found);
|
_count(dev, &_pv_disks_found, &_pv_parts_found);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* If user just wants PVs we are done */
|
/* If user just wants PVs we are done */
|
||||||
@ -131,14 +131,14 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
|
|||||||
/* Display totals */
|
/* Display totals */
|
||||||
if (!arg_is_set(cmd, lvmpartition_ARG)) {
|
if (!arg_is_set(cmd, lvmpartition_ARG)) {
|
||||||
log_print("%d disk%s",
|
log_print("%d disk%s",
|
||||||
disks_found, disks_found == 1 ? "" : "s");
|
_disks_found, _disks_found == 1 ? "" : "s");
|
||||||
log_print("%d partition%s",
|
log_print("%d partition%s",
|
||||||
parts_found, parts_found == 1 ? "" : "s");
|
_parts_found, _parts_found == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
log_print("%d LVM physical volume whole disk%s",
|
log_print("%d LVM physical volume whole disk%s",
|
||||||
pv_disks_found, pv_disks_found == 1 ? "" : "s");
|
_pv_disks_found, _pv_disks_found == 1 ? "" : "s");
|
||||||
log_print("%d LVM physical volume%s",
|
log_print("%d LVM physical volume%s",
|
||||||
pv_parts_found, pv_parts_found == 1 ? "" : "s");
|
_pv_parts_found, _pv_parts_found == 1 ? "" : "s");
|
||||||
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
}
|
}
|
||||||
|
18
tools/pvck.c
18
tools/pvck.c
@ -284,7 +284,7 @@ static int _text_buf_parsable(char *text_buf, uint64_t text_size)
|
|||||||
#define MAX_LINE_CHECK 128
|
#define MAX_LINE_CHECK 128
|
||||||
|
|
||||||
#define MAX_DESC 1024
|
#define MAX_DESC 1024
|
||||||
char desc_line[MAX_DESC];
|
static char _desc_line[MAX_DESC];
|
||||||
|
|
||||||
static void _copy_line(char *in, char *out, int *len, int linesize)
|
static void _copy_line(char *in, char *out, int *len, int linesize)
|
||||||
{
|
{
|
||||||
@ -603,18 +603,18 @@ static int _dump_all_text(struct cmd_context *cmd, struct settings *set, const c
|
|||||||
if (arg_is_set(cmd, verbose_ARG)) {
|
if (arg_is_set(cmd, verbose_ARG)) {
|
||||||
char *str1, *str2;
|
char *str1, *str2;
|
||||||
if ((str1 = strstr(text_buf, "description = "))) {
|
if ((str1 = strstr(text_buf, "description = "))) {
|
||||||
memset(desc_line, 0, sizeof(desc_line));
|
memset(_desc_line, 0, sizeof(_desc_line));
|
||||||
_copy_line(str1, desc_line, &len, sizeof(desc_line)-1);
|
_copy_line(str1, _desc_line, &len, sizeof(_desc_line)-1);
|
||||||
if ((p = strchr(desc_line, '\n')))
|
if ((p = strchr(_desc_line, '\n')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
log_print("%s", desc_line);
|
log_print("%s", _desc_line);
|
||||||
}
|
}
|
||||||
if (str1 && (str2 = strstr(str1, "creation_time = "))) {
|
if (str1 && (str2 = strstr(str1, "creation_time = "))) {
|
||||||
memset(desc_line, 0, sizeof(desc_line));
|
memset(_desc_line, 0, sizeof(_desc_line));
|
||||||
_copy_line(str2, desc_line, &len, sizeof(desc_line)-1);
|
_copy_line(str2, _desc_line, &len, sizeof(_desc_line)-1);
|
||||||
if ((p = strchr(desc_line, '\n')))
|
if ((p = strchr(_desc_line, '\n')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
log_print("%s\n", desc_line);
|
log_print("%s\n", _desc_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ static void _sigchld_handler(int sig __attribute__((unused)))
|
|||||||
*/
|
*/
|
||||||
int become_daemon(struct cmd_context *cmd, int skip_lvm)
|
int become_daemon(struct cmd_context *cmd, int skip_lvm)
|
||||||
{
|
{
|
||||||
static const char devnull[] = "/dev/null";
|
static const char _devnull[] = "/dev/null";
|
||||||
int null_fd;
|
int null_fd;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct sigaction act = {
|
struct sigaction act = {
|
||||||
@ -83,8 +83,8 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
|
|||||||
// #define DEBUG_CHILD
|
// #define DEBUG_CHILD
|
||||||
|
|
||||||
#ifndef DEBUG_CHILD
|
#ifndef DEBUG_CHILD
|
||||||
if ((null_fd = open(devnull, O_RDWR)) == -1) {
|
if ((null_fd = open(_devnull, O_RDWR)) == -1) {
|
||||||
log_sys_error("open", devnull);
|
log_sys_error("open", _devnull);
|
||||||
_exit(ECMD_FAILED);
|
_exit(ECMD_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user