[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] new device-mapper required to build latest lvm from cvs



> lvm_fclose() calls dm_fclose(), which cause the linker to
> bring libdm-file.o in liblvm.a. Then there happens a conflict
> of create_dir().
> 
> Attached is a patch for device-mapper to rename the function
> and export it. It alone fixes the build error.
> 
> A patch for LVM2 to use the exported function will follow.

This is the patch for LVM2.
LVM2's create_dir() is left there for the case LVM2 specific
something could be put in future.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Use dm_create_dir() instead of its own.

Index: LVM2.work/lib/misc/lvm-file.c
===================================================================
--- LVM2.work.orig/lib/misc/lvm-file.c
+++ LVM2.work/lib/misc/lvm-file.c
@@ -140,54 +140,9 @@ int dir_exists(const char *path)
 	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;
+	return dm_create_dir(dir);
 }
 
 int is_empty_dir(const char *dir)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]