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/lib/metadata lv_manip.c
Date: Tue, 07 Aug 2007 16:57:00 -0000	[thread overview]
Message-ID: <20070807165709.9377.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2007-08-07 16:57:09

Modified files:
	lib/metadata   : lv_manip.c 

Log message:
	Some simple fixups for last checkin:
	* remove "_" from "return_0"
	* improve some naming and terminology
	* add 'const'

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120

--- LVM2/lib/metadata/lv_manip.c	2007/08/06 20:35:48	1.119
+++ LVM2/lib/metadata/lv_manip.c	2007/08/07 16:57:09	1.120
@@ -1472,12 +1472,12 @@
 	if (find_lv_in_vg(vg, new_name)) {
 		log_error("Logical volume \"%s\" already exists in "
 			  "volume group \"%s\"", new_name, vg->name);
-		return_0;
+		return 0;
 	}
 
 	if (lv->status & LOCKED) {
 		log_error("Cannot rename locked LV %s", lv->name);
-		return_0;
+		return 0;
 	}
 
 	lv->name = new_name;
@@ -1489,7 +1489,7 @@
  * Returns a pointer to LV name suffix.
  * Returns NULL if the LV doesn't have suffix.
  */
-static char * sub_lv_name_suffix(const char *lvname)
+static char *_sub_lv_name_suffix(const char *lvname)
 {
 	char *s;
 
@@ -1504,24 +1504,23 @@
 
 /*
  * Rename sub LV.
- * Returns 0 on failure, 1 on success.
  * If a new name for the sub LV cannot be determined, 1 is returned.
- * 'lv_main_old' and 'lv_main_new' are old and new names of the main LV.
+ * 'lv_name_old' and 'lv_name_new' are old and new names of the main LV.
  */
 static int _rename_sub_lv(struct cmd_context *cmd,
 			  struct logical_volume *lv,
-			  char *lv_main_old, char *lv_main_new)
+			  const char *lv_name_old, const char *lv_name_new)
 {
 	char *suffix, *new_name;
-	size_t l;
+	size_t len;
 
 	/* Rename only if the lv has known suffix */
-	if (!(suffix = sub_lv_name_suffix(lv->name)))
+	if (!(suffix = _sub_lv_name_suffix(lv->name)))
 		return 1;
 
-	/* Make sure that lv->name is exactly a lv_main_old + suffix */
-	l = suffix - lv->name;
-	if (strlen(lv_main_old) != l || strncmp(lv->name, lv_main_old, l))
+	/* Make sure that lv->name is exactly a lv_name_old + suffix */
+	len = suffix - lv->name;
+	if (strlen(lv_name_old) != len || strncmp(lv->name, lv_name_old, len))
 		return 1;
 
  	/*
@@ -1530,15 +1529,15 @@
 	 *        if the sub LV is "lvol0_mlog" and
 	 *        a new name for main LV is "lvol1"
 	 */
-	l = strlen(lv_main_new) + strlen(suffix) + 1;
-	new_name = dm_pool_alloc(cmd->mem, l);
+	len = strlen(lv_name_new) + strlen(suffix) + 1;
+	new_name = dm_pool_alloc(cmd->mem, len);
 	if (!new_name) {
 		log_error("Failed to allocate space for new name");
-		return_0;
+		return 0;
 	}
-	if (!dm_snprintf(new_name, l, "%s%s", lv_main_new, suffix)) {
+	if (!dm_snprintf(new_name, len, "%s%s", lv_name_new, suffix)) {
 		log_error("Failed to create new name");
-		return_0;
+		return 0;
 	}
 
 	/* Rename it */
@@ -1569,11 +1568,11 @@
 
 	list_iterate_items(seg, &lv->segments) {
 		if (seg->log_lv && !func(cmd, seg->log_lv, data))
-			return_0;
+			return 0;
 		for (s = 0; s < seg->area_count; s++)
 			if (seg_type(seg, s) == AREA_LV &&
 			    !func(cmd, seg_lv(seg, s), data))
-				return_0;
+				return 0;
 	}
 
 	return 1;
@@ -1593,7 +1592,7 @@
 
 	/* rename is not allowed on sub LVs */
 	if ((lv->status & MIRROR_LOG) || (lv->status & MIRROR_IMAGE)) {
-		log_error("Cannot rename hidden LV \"%s\".", lv->name);
+		log_error("Cannot rename internal LV \"%s\".", lv->name);
 		return 0;
 	}
 
@@ -1609,7 +1608,7 @@
 	}
 
 	if (!archive(vg))
-		return_0;
+		return 0;
 
 	/* rename sub LVs */
 	names[0] = lv->name;
@@ -1625,7 +1624,7 @@
 
 	log_verbose("Writing out updated volume group");
 	if (!vg_write(vg))
-		return_0;
+		return 0;
 
 	backup(vg);
 


             reply	other threads:[~2007-08-07 16:57 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-07 16:57 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-11 15:32 agk
2012-05-11 15:26 agk
2012-03-04 15:57 zkabelac
2012-03-01 10:09 zkabelac
2012-02-28 10:08 zkabelac
2012-02-12 21:37 agk
2012-02-01  2:11 agk
2012-01-26 21:39 zkabelac
2012-01-25 11:27 zkabelac
2012-01-25  9:15 zkabelac
2012-01-25  9:14 zkabelac
2012-01-25  9:02 zkabelac
2012-01-25  8:57 zkabelac
2012-01-24 14:54 agk
2012-01-24 14:15 mbroz
2012-01-19 15:39 zkabelac
2011-11-15 17:29 zkabelac
2011-11-15 17:23 zkabelac
2011-11-12 22:53 zkabelac
2011-11-12 22:52 zkabelac
2011-11-12 22:51 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:39 zkabelac
2011-11-07 13:54 agk
2011-11-04 22:45 zkabelac
2011-11-03 15:46 zkabelac
2011-11-03 14:56 zkabelac
2011-10-30 22:02 zkabelac
2011-10-28 20:29 zkabelac
2011-10-28 20:18 zkabelac
2011-10-22 16:49 zkabelac
2011-10-22 16:46 zkabelac
2011-10-21  9:55 zkabelac
2011-10-20 10:35 zkabelac
2011-10-03 18:43 zkabelac
2011-09-16 18:39 jbrassow
2011-09-16 12:12 zkabelac
2011-09-16 11:59 zkabelac
2011-09-06 15:39 agk
2011-08-19 22:55 agk
2011-08-19 16:41 agk
2011-08-10 16:44 jbrassow
2011-08-05  9:21 prajnoha
2011-06-06 12:08 agk
2011-03-25 22:02 jbrassow
2010-04-08  0:56 agk
2010-04-08  0:52 agk
2010-04-02  1:35 agk
2010-04-01 13:58 agk
2010-04-01 12:29 agk
2010-03-31 20:26 agk
2010-02-17 23:36 snitzer
2010-01-20 21:53 snitzer
2010-01-14 10:17 zkabelac
2010-01-14 10:09 zkabelac
2010-01-14 10:08 zkabelac
2010-01-13  1:52 snitzer
2010-01-13  1:51 snitzer
2010-01-10 20:44 snitzer
2010-01-08 23:06 jbrassow
2009-06-06 16:37 mbroz
2009-06-01 14:23 mbroz
2009-01-06 17:24 mbroz
2008-01-16 20:00 agk
2007-11-04 16:28 agk
2007-08-08 18:00 wysochanski
2007-08-07 18:55 wysochanski
2007-08-06 20:35 wysochanski
2006-10-07 16:00 agk
2006-10-07 11:34 agk
2006-10-07 11:23 agk
2006-04-27 17:58 agk
2005-11-24 21:23 agk
2005-11-24 18:00 agk
2005-10-27 22:20 agk
2005-06-03 15:44 agk
2004-03-19 16:19 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=20070807165709.9377.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).