mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Allow pvcreate_single to be called with NULL for default pvcreate params.
Passing NULL for pvcreate parameters gives you default parameters for pvcreate_single. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Author: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
parent
d4b6a8aa2a
commit
9d5a318ac6
@ -1089,12 +1089,37 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void fill_default_pvcreate_params(struct pvcreate_params *pp)
|
||||
{
|
||||
memset(pp, 0, sizeof(*pp));
|
||||
pp->zero = 0;
|
||||
pp->size = 0;
|
||||
pp->data_alignment = UINT64_C(0);
|
||||
pp->pvmetadatacopies = DEFAULT_PVMETADATACOPIES;
|
||||
pp->pvmetadatasize = DEFAULT_PVMETADATASIZE;
|
||||
pp->labelsector = DEFAULT_LABELSECTOR;
|
||||
pp->idp = 0;
|
||||
pp->pe_start = 0;
|
||||
pp->extent_count = 0;
|
||||
pp->extent_size = 0;
|
||||
pp->restorefile = 0;
|
||||
pp->force = PROMPT;
|
||||
pp->yes = 0;
|
||||
}
|
||||
|
||||
int pvcreate_single(struct cmd_context *cmd, const char *pv_name, void *handle)
|
||||
{
|
||||
struct pvcreate_params *pp = (struct pvcreate_params *) handle;
|
||||
struct pvcreate_params *pp;
|
||||
void *pv;
|
||||
struct device *dev;
|
||||
struct dm_list mdas;
|
||||
struct pvcreate_params default_pp;
|
||||
|
||||
fill_default_pvcreate_params(&default_pp);
|
||||
if (!handle)
|
||||
pp = &default_pp;
|
||||
else
|
||||
pp = (struct pvcreate_params *) handle;
|
||||
|
||||
if (pp->idp) {
|
||||
if ((dev = device_from_pvid(cmd, pp->idp)) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user