public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: meyering@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/commands/toolcontext.c li ...
Date: Sat, 28 Jul 2007 12:26:00 -0000	[thread overview]
Message-ID: <20070728122622.24978.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	meyering@sourceware.org	2007-07-28 12:26:21

Modified files:
	.              : WHATS_NEW 
	lib/commands   : toolcontext.c 
	lib/format_text: archiver.c format-text.c 
	lib/locking    : file_locking.c 
	lib/misc       : lvm-file.c lvm-file.h 

Log message:
	Remove create_dir function; use now-equivalent dm_create_dir instead.
	* lib/misc/lvm-file.c (_create_dir_recursive, create_dir): Remove functions.
	* lib/misc/lvm-file.h (create_dir): Remove declaration.
	* lib/commands/toolcontext.c (create_toolcontext): s/create_dir/dm_create_dir/
	* lib/format_text/archiver.c (archive, backup): Likewise.
	* lib/format_text/format-text.c (_add_dir): Likewise.
	* lib/locking/file_locking.c (init_file_locking): Likewise.
	Patch by Jun'ichi Nomura.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.672&r2=1.673
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archiver.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11

--- LVM2/WHATS_NEW	2007/07/26 13:28:32	1.672
+++ LVM2/WHATS_NEW	2007/07/28 12:26:21	1.673
@@ -1,5 +1,6 @@
 Version 2.02.28 -
 ================================
+  Remove create_dir function; use now-equivalent dm_create_dir instead
   Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose
   Fix clvmd if compiled with gulm support. (2.02.26)
   Trivial fix to lvdisplay man page.
--- LVM2/lib/commands/toolcontext.c	2007/07/23 10:45:49	1.52
+++ LVM2/lib/commands/toolcontext.c	2007/07/28 12:26:21	1.53
@@ -939,7 +939,7 @@
 		goto error;
 
 	/* Create system directory if it doesn't already exist */
-	if (*cmd->sys_dir && !create_dir(cmd->sys_dir)) {
+	if (*cmd->sys_dir && !dm_create_dir(cmd->sys_dir)) {
 		log_error("Failed to create LVM2 system dir for metadata backups, config "
 			  "files and internal cache.");
 		log_error("Set environment variable LVM_SYSTEM_DIR to alternative location "
--- LVM2/lib/format_text/archiver.c	2007/06/28 17:33:44	1.7
+++ LVM2/lib/format_text/archiver.c	2007/07/28 12:26:21	1.8
@@ -117,7 +117,7 @@
 		return 1;
 	}
 
-	if (!create_dir(vg->cmd->archive_params->dir))
+	if (!dm_create_dir(vg->cmd->archive_params->dir))
 		return 0;
 
 	/* Trap a read-only file system */
@@ -223,7 +223,7 @@
 		return 1;
 	}
 
-	if (!create_dir(vg->cmd->backup_params->dir))
+	if (!dm_create_dir(vg->cmd->backup_params->dir))
 		return 0;
 
 	/* Trap a read-only file system */
--- LVM2/lib/format_text/format-text.c	2007/07/24 17:48:08	1.78
+++ LVM2/lib/format_text/format-text.c	2007/07/28 12:26:21	1.79
@@ -1856,7 +1856,7 @@
 {
 	struct dir_list *dl;
 
-	if (create_dir(dir)) {
+	if (dm_create_dir(dir)) {
 		if (!(dl = dm_malloc(sizeof(struct list) + strlen(dir) + 1))) {
 			log_error("_add_dir allocation failed");
 			return 0;
--- LVM2/lib/locking/file_locking.c	2007/07/20 15:22:46	1.28
+++ LVM2/lib/locking/file_locking.c	2007/07/28 12:26:21	1.29
@@ -284,7 +284,7 @@
 						DEFAULT_LOCK_DIR),
 		sizeof(_lock_dir));
 
-	if (!create_dir(_lock_dir))
+	if (!dm_create_dir(_lock_dir))
 		return 0;
 
 	/* Trap a read-only file system */
--- LVM2/lib/misc/lvm-file.c	2007/07/24 17:48:08	1.21
+++ LVM2/lib/misc/lvm-file.c	2007/07/28 12:26:21	1.22
@@ -140,56 +140,6 @@
 	return 1;
 }
 
-static int _create_dir_recursive(const char *dir)
-{
-	char *orig, *s;
-	int rc;
-
-	log_verbose("Creating directory \"%s\"", dir);
-	/* Create parent directories */
-	orig = s = dm_strdup(dir);
-	while ((s = strchr(s, '/')) != NULL) {
-		*s = '\0';
-		if (*orig) {
-			rc = mkdir(orig, 0777);
-			if (rc < 0 && errno != EEXIST) {
-				if (errno != EROFS)
-					log_sys_error("mkdir", orig);
-				dm_free(orig);
-				return 0;
-			}
-		}
-		*s++ = '/';
-	}
-	dm_free(orig);
-
-	/* Create final directory */
-	rc = mkdir(dir, 0777);
-	if (rc < 0 && errno != EEXIST) {
-		if (errno != EROFS)
-			log_sys_error("mkdir", dir);
-		return 0;
-	}
-	return 1;
-}
-
-int create_dir(const char *dir)
-{
-	struct stat info;
-
-	if (!*dir)
-		return 1;
-
-	if (stat(dir, &info) < 0)
-		return _create_dir_recursive(dir);
-
-	if (S_ISDIR(info.st_mode))
-		return 1;
-
-	log_error("Directory \"%s\" not found", dir);
-	return 0;
-}
-
 int is_empty_dir(const char *dir)
 {
 	struct dirent *dirent;
@@ -273,7 +223,7 @@
 	if ((c = strrchr(dir, '/')))
 		*c = '\0';
 
-	if (!create_dir(dir)) {
+	if (!dm_create_dir(dir)) {
 		dm_free(dir);
 		return -1;
 	}
--- LVM2/lib/misc/lvm-file.h	2007/07/24 17:48:08	1.10
+++ LVM2/lib/misc/lvm-file.h	2007/07/28 12:26:21	1.11
@@ -39,12 +39,6 @@
  */
 int is_empty_dir(const char *dir);
 
-/*
- * Create directory (recursively) if necessary.  Return 1
- * if directory was successfully created (or already exists), else 0.
- */
-int create_dir(const char *dir);
-
 /* Sync directory changes */
 void sync_dir(const char *file);
 


             reply	other threads:[~2007-07-28 12:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28 12:26 meyering [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-01 13:42 zkabelac
2012-01-11 20:38 agk
2011-01-06 15:29 zkabelac
2010-11-11 17:29 agk
2010-09-09 13:07 prajnoha
2010-08-11 12:14 prajnoha
2010-04-29  1:38 agk
2009-07-08 12:36 agk
2008-12-07  4:27 wysochanski
2007-07-23 10:45 mbroz
2006-11-04  3:34 agk
2006-08-31 22:21 agk
2006-04-03 18:43 agk
2004-12-10 16:01 agk
2004-11-19 19:25 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=20070728122622.24978.qmail@sourceware.org \
    --to=meyering@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).