public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: wysochanski@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/tools pvcreate.c
Date: Fri, 25 Jul 2008 14:12:00 -0000	[thread overview]
Message-ID: <20080725141230.1851.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-07-25 14:12:30

Modified files:
	tools          : pvcreate.c 

Log message:
	Refactor pvcreate - use '0' for no --uuid or --restorefile options.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70

--- LVM2/tools/pvcreate.c	2008/07/25 00:30:57	1.69
+++ LVM2/tools/pvcreate.c	2008/07/25 14:12:29	1.70
@@ -23,11 +23,11 @@
 	uint64_t pvmetadatasize;
 	int64_t labelsector;
 	struct id id; /* FIXME: redundant */
-	struct id *idp;
+	struct id *idp; /* 0 if no --uuid option */
 	uint64_t pe_start;
 	uint32_t extent_count;
 	uint32_t extent_size;
-	const char *restorefile;
+	const char *restorefile; /* 0 if no --restorefile option */
 };
 
 const char _really_init[] =
@@ -37,7 +37,8 @@
  * See if we may pvcreate on this device.
  * 0 indicates we may not.
  */
-static int pvcreate_check(struct cmd_context *cmd, const char *name)
+static int pvcreate_check(struct cmd_context *cmd, const char *name,
+			  struct pvcreate_params *pp)
 {
 	struct physical_volume *pv;
 	struct device *dev;
@@ -112,8 +113,8 @@
 
 	/* Wipe superblock? */
 	if (dev_is_md(dev, &md_superblock) &&
-	    ((!arg_count(cmd, uuidstr_ARG) &&
-	      !arg_count(cmd, restorefile_ARG)) ||
+	    ((!pp->idp &&
+	      !pp->restorefile) ||
 	     arg_count(cmd, yes_ARG) ||
 	     (yes_no_prompt("Software RAID md superblock "
 			    "detected on %s. Wipe it? [y/n] ", name) == 'y'))) {
@@ -161,7 +162,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!pvcreate_check(cmd, pv_name))
+	if (!pvcreate_check(cmd, pv_name, pp))
 		goto error;
 
 	if (sigint_caught())


             reply	other threads:[~2008-07-25 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 14:12 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-03-16 15:48 agk
2009-03-17 14:01 mornfall
2008-07-25 14:45 wysochanski
2008-07-23 19:29 wysochanski
2008-07-21 19:27 wysochanski
2004-11-19 19:32 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080725141230.1851.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).