1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-11 20:58:50 +03:00

lvcreate: code move

This commit is contained in:
Zdenek Kabelac 2022-01-18 17:33:53 +01:00
parent 89cec5b65a
commit 7f1f7ad694

View File

@ -1851,30 +1851,28 @@ static int _lvcreate_and_attach_writecache_single(struct cmd_context *cmd,
int lvcreate_and_attach_writecache_cmd(struct cmd_context *cmd, int argc, char **argv) int lvcreate_and_attach_writecache_cmd(struct cmd_context *cmd, int argc, char **argv)
{ {
struct processing_handle *handle = NULL; struct processing_handle *handle = NULL;
struct processing_params pp;
struct lvcreate_params lp = { struct lvcreate_params lp = {
.major = -1, .major = -1,
.minor = -1, .minor = -1,
};
struct lvcreate_cmdline_params lcp = { 0 };
int ret;
/* /*
* Tell lvcreate to ignore --type since we are using lvcreate * Tell lvcreate to ignore --type since we are using lvcreate
* to create a linear LV and using lvconvert to add cache. * to create a linear LV and using lvconvert to add cache.
* (Would be better if lvcreate code was split up so we could * (Would be better if lvcreate code was split up so we could
* call a specific function that just created a linear/striped LV.) * call a specific function that just created a linear/striped LV.)
*/ */
lp.ignore_type = 1; .ignore_type = 1,
};
struct lvcreate_cmdline_params lcp = { 0 };
struct processing_params pp = {
.lp = &lp,
.lcp = &lcp,
};
int ret;
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) { if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
stack; stack;
return EINVALID_CMD_LINE; return EINVALID_CMD_LINE;
} }
pp.lp = &lp;
pp.lcp = &lcp;
if (!(handle = init_processing_handle(cmd, NULL))) { if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle."); log_error("Failed to initialize processing handle.");
return ECMD_FAILED; return ECMD_FAILED;
@ -1925,30 +1923,29 @@ static int _lvcreate_and_attach_cache_single(struct cmd_context *cmd,
int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv) int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
{ {
struct processing_handle *handle = NULL; struct processing_handle *handle = NULL;
struct processing_params pp;
struct lvcreate_params lp = { struct lvcreate_params lp = {
.major = -1, .major = -1,
.minor = -1, .minor = -1,
};
struct lvcreate_cmdline_params lcp = { 0 };
int ret;
/* /*
* Tell lvcreate to ignore --type since we are using lvcreate * Tell lvcreate to ignore --type since we are using lvcreate
* to create a linear LV and using lvconvert to add cache. * to create a linear LV and using lvconvert to add cache.
* (Would be better if lvcreate code was split up so we could * (Would be better if lvcreate code was split up so we could
* call a specific function that just created a linear/striped LV.) * call a specific function that just created a linear/striped LV.)
*/ */
lp.ignore_type = 1; .ignore_type = 1,
};
struct lvcreate_cmdline_params lcp = { 0 };
struct processing_params pp = {
.lp = &lp,
.lcp = &lcp,
};
int ret;
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) { if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
stack; stack;
return EINVALID_CMD_LINE; return EINVALID_CMD_LINE;
} }
pp.lp = &lp;
pp.lcp = &lcp;
if (!(handle = init_processing_handle(cmd, NULL))) { if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle."); log_error("Failed to initialize processing handle.");
return ECMD_FAILED; return ECMD_FAILED;
@ -1963,4 +1960,3 @@ int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv
destroy_processing_handle(cmd, handle); destroy_processing_handle(cmd, handle);
return ret; return ret;
} }