mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
cache: using unsigned argc
Convert using unsigned for _argc.
This commit is contained in:
parent
da268eb4cc
commit
c651c614ec
@ -96,8 +96,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
|
|||||||
if (!dm_config_has_node(sn, "core_argv"))
|
if (!dm_config_has_node(sn, "core_argv"))
|
||||||
return SEG_LOG_ERROR("not all core arguments defined in");
|
return SEG_LOG_ERROR("not all core arguments defined in");
|
||||||
|
|
||||||
if (!dm_config_get_uint32(sn, "core_argc",
|
if (!dm_config_get_uint32(sn, "core_argc", &seg->core_argc))
|
||||||
(uint32_t *)&seg->core_argc))
|
|
||||||
return SEG_LOG_ERROR("Unable to read core_argc in");
|
return SEG_LOG_ERROR("Unable to read core_argc in");
|
||||||
|
|
||||||
str = dm_config_find_str(sn, "core_argv", NULL);
|
str = dm_config_find_str(sn, "core_argv", NULL);
|
||||||
@ -110,8 +109,8 @@ static int _cache_pool_text_import(struct lv_segment *seg,
|
|||||||
return_0;
|
return_0;
|
||||||
if (str &&
|
if (str &&
|
||||||
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
||||||
(seg->core_argc != dm_split_words(argv_str, seg->core_argc,
|
((int)seg->core_argc != dm_split_words(argv_str, seg->core_argc,
|
||||||
0, seg->core_argv))))
|
0, seg->core_argv))))
|
||||||
return SEG_LOG_ERROR("core_argc and core_argv do"
|
return SEG_LOG_ERROR("core_argc and core_argv do"
|
||||||
" not match in");
|
" not match in");
|
||||||
}
|
}
|
||||||
@ -135,8 +134,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
|
|||||||
return SEG_LOG_ERROR("policy_name must be a string in");
|
return SEG_LOG_ERROR("policy_name must be a string in");
|
||||||
seg->policy_name = dm_pool_strdup(mem, str);
|
seg->policy_name = dm_pool_strdup(mem, str);
|
||||||
|
|
||||||
if (!dm_config_get_uint32(sn, "policy_argc",
|
if (!dm_config_get_uint32(sn, "policy_argc", &seg->policy_argc))
|
||||||
(uint32_t *)&seg->policy_argc))
|
|
||||||
return SEG_LOG_ERROR("Unable to read policy_argc in");
|
return SEG_LOG_ERROR("Unable to read policy_argc in");
|
||||||
|
|
||||||
str = dm_config_find_str(sn, "policy_argv", NULL);
|
str = dm_config_find_str(sn, "policy_argv", NULL);
|
||||||
@ -149,9 +147,9 @@ static int _cache_pool_text_import(struct lv_segment *seg,
|
|||||||
return_0;
|
return_0;
|
||||||
if (str &&
|
if (str &&
|
||||||
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
||||||
(seg->policy_argc != dm_split_words(argv_str,
|
((int)seg->policy_argc != dm_split_words(argv_str,
|
||||||
seg->policy_argc,
|
seg->policy_argc,
|
||||||
0, seg->policy_argv))))
|
0, seg->policy_argv))))
|
||||||
return SEG_LOG_ERROR("policy_argc and policy_argv do"
|
return SEG_LOG_ERROR("policy_argc and policy_argv do"
|
||||||
" not match in");
|
" not match in");
|
||||||
}
|
}
|
||||||
@ -176,7 +174,7 @@ static int _cache_pool_text_import_area_count(const struct dm_config_node *sn,
|
|||||||
static int _cache_pool_text_export(const struct lv_segment *seg,
|
static int _cache_pool_text_export(const struct lv_segment *seg,
|
||||||
struct formatter *f)
|
struct formatter *f)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
char buf[256]; //FIXME: IS THERE AN 'outf' THAT DOESN'T DO NEWLINE?!?
|
char buf[256]; //FIXME: IS THERE AN 'outf' THAT DOESN'T DO NEWLINE?!?
|
||||||
uint32_t feature_flags = seg->feature_flags;
|
uint32_t feature_flags = seg->feature_flags;
|
||||||
|
|
||||||
@ -199,7 +197,7 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seg->core_argc) {
|
if (seg->core_argc) {
|
||||||
outf(f, "core_argc = %d", seg->core_argc);
|
outf(f, "core_argc = %u", seg->core_argc);
|
||||||
outf(f, "core_argv = \"");
|
outf(f, "core_argv = \"");
|
||||||
for (i = 0; i < seg->core_argc; i++)
|
for (i = 0; i < seg->core_argc; i++)
|
||||||
outf(f, "%s%s", i ? " " : "", seg->core_argv[i]);
|
outf(f, "%s%s", i ? " " : "", seg->core_argv[i]);
|
||||||
@ -208,7 +206,7 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
|
|||||||
|
|
||||||
if (seg->policy_name) {
|
if (seg->policy_name) {
|
||||||
outf(f, "policy_name = \"%s\"", seg->policy_name);
|
outf(f, "policy_name = \"%s\"", seg->policy_name);
|
||||||
outf(f, "policy_argc = %d", seg->policy_argc);
|
outf(f, "policy_argc = %u", seg->policy_argc);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
for (i = 0; i < seg->policy_argc; i++)
|
for (i = 0; i < seg->policy_argc; i++)
|
||||||
sprintf(buf, "%s%s", i ? " " : "", seg->policy_argv[i]);
|
sprintf(buf, "%s%s", i ? " " : "", seg->policy_argv[i]);
|
||||||
|
@ -397,10 +397,10 @@ struct lv_segment {
|
|||||||
uint32_t device_id; /* For thin, 24bit */
|
uint32_t device_id; /* For thin, 24bit */
|
||||||
|
|
||||||
uint32_t feature_flags; /* For cache */
|
uint32_t feature_flags; /* For cache */
|
||||||
int core_argc; /* For cache */
|
unsigned core_argc; /* For cache */
|
||||||
char **core_argv; /* For cache */
|
char **core_argv; /* For cache */
|
||||||
char *policy_name; /* For cache */
|
char *policy_name; /* For cache */
|
||||||
int policy_argc; /* For cache */
|
unsigned policy_argc; /* For cache */
|
||||||
char **policy_argv; /* For cache */
|
char **policy_argv; /* For cache */
|
||||||
|
|
||||||
struct logical_volume *replicator;/* For replicator-devs - link to replicator LV */
|
struct logical_volume *replicator;/* For replicator-devs - link to replicator LV */
|
||||||
|
@ -772,10 +772,10 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
|
|||||||
const char *origin_uuid,
|
const char *origin_uuid,
|
||||||
uint32_t chunk_size,
|
uint32_t chunk_size,
|
||||||
uint32_t feature_flags, /* DM_CACHE_FEATURE_* */
|
uint32_t feature_flags, /* DM_CACHE_FEATURE_* */
|
||||||
int core_argc,
|
unsigned core_argc,
|
||||||
char **core_argv,
|
char **core_argv,
|
||||||
char *policy_name,
|
char *policy_name,
|
||||||
int policy_argc,
|
unsigned policy_argc,
|
||||||
char **policy_argv);
|
char **policy_argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -172,10 +172,10 @@ struct load_segment {
|
|||||||
uint32_t flags; /* Mirror + raid + Cache */
|
uint32_t flags; /* Mirror + raid + Cache */
|
||||||
char *uuid; /* Clustered mirror log */
|
char *uuid; /* Clustered mirror log */
|
||||||
|
|
||||||
int core_argc; /* Cache */
|
unsigned core_argc; /* Cache */
|
||||||
char **core_argv; /* Cache */
|
char **core_argv; /* Cache */
|
||||||
char *policy_name; /* Cache */
|
char *policy_name; /* Cache */
|
||||||
int policy_argc; /* Cache */
|
unsigned policy_argc; /* Cache */
|
||||||
char **policy_argv; /* Cache */
|
char **policy_argv; /* Cache */
|
||||||
|
|
||||||
const char *cipher; /* Crypt */
|
const char *cipher; /* Crypt */
|
||||||
@ -2274,7 +2274,8 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
|
|||||||
struct load_segment *seg,
|
struct load_segment *seg,
|
||||||
char *params, size_t paramsize)
|
char *params, size_t paramsize)
|
||||||
{
|
{
|
||||||
int i, pos = 0;
|
int pos = 0;
|
||||||
|
unsigned i = 0;
|
||||||
unsigned feature_count;
|
unsigned feature_count;
|
||||||
struct seg_area *area;
|
struct seg_area *area;
|
||||||
char data[DM_FORMAT_DEV_BUFSIZE];
|
char data[DM_FORMAT_DEV_BUFSIZE];
|
||||||
@ -2302,7 +2303,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
|
|||||||
|
|
||||||
/* Features */
|
/* Features */
|
||||||
feature_count = hweight32(seg->flags);
|
feature_count = hweight32(seg->flags);
|
||||||
EMIT_PARAMS(pos, " %d", feature_count);
|
EMIT_PARAMS(pos, " %u", feature_count);
|
||||||
if (seg->flags & DM_CACHE_FEATURE_WRITETHROUGH)
|
if (seg->flags & DM_CACHE_FEATURE_WRITETHROUGH)
|
||||||
EMIT_PARAMS(pos, " writethrough");
|
EMIT_PARAMS(pos, " writethrough");
|
||||||
else if (seg->flags & DM_CACHE_FEATURE_WRITEBACK)
|
else if (seg->flags & DM_CACHE_FEATURE_WRITEBACK)
|
||||||
@ -2310,7 +2311,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
|
|||||||
|
|
||||||
/* Core Arguments (like 'migration_threshold') */
|
/* Core Arguments (like 'migration_threshold') */
|
||||||
if (seg->core_argc) {
|
if (seg->core_argc) {
|
||||||
EMIT_PARAMS(pos, " %d", seg->core_argc);
|
EMIT_PARAMS(pos, " %u", seg->core_argc);
|
||||||
for (i = 0; i < seg->core_argc; i++)
|
for (i = 0; i < seg->core_argc; i++)
|
||||||
EMIT_PARAMS(pos, " %s", seg->core_argv[i]);
|
EMIT_PARAMS(pos, " %s", seg->core_argv[i]);
|
||||||
}
|
}
|
||||||
@ -2319,7 +2320,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
|
|||||||
if (!seg->policy_name)
|
if (!seg->policy_name)
|
||||||
EMIT_PARAMS(pos, " default 0");
|
EMIT_PARAMS(pos, " default 0");
|
||||||
else {
|
else {
|
||||||
EMIT_PARAMS(pos, " %s %d", seg->policy_name, seg->policy_argc);
|
EMIT_PARAMS(pos, " %s %u", seg->policy_name, seg->policy_argc);
|
||||||
if (seg->policy_argc % 2) {
|
if (seg->policy_argc % 2) {
|
||||||
log_error(INTERNAL_ERROR
|
log_error(INTERNAL_ERROR
|
||||||
"Cache policy arguments must be in "
|
"Cache policy arguments must be in "
|
||||||
@ -3206,10 +3207,10 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
|
|||||||
const char *origin_uuid,
|
const char *origin_uuid,
|
||||||
uint32_t chunk_size,
|
uint32_t chunk_size,
|
||||||
uint32_t feature_flags, /* DM_CACHE_FEATURE_* */
|
uint32_t feature_flags, /* DM_CACHE_FEATURE_* */
|
||||||
int core_argc,
|
unsigned core_argc,
|
||||||
char **core_argv,
|
char **core_argv,
|
||||||
char *policy_name,
|
char *policy_name,
|
||||||
int policy_argc,
|
unsigned policy_argc,
|
||||||
char **policy_argv)
|
char **policy_argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user