[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



Jun'ichi Nomura wrote:
> Alasdair G Kergon wrote:
>> The functions are not quite identical:-)
..
>>   2 - error suppression for read-only filesystems
> 
> It can be brought into dm_create_dir() or we can move logging
> to the outside of dm_create_dir() and let callers do it.
> Which way do you think is better?

And this patch adds EROFS check to libdevmapper version of
_create_dir_recursive() so that they are equivalent.
(The patch is applicable after the log_sys_* macro patch.)

For really making them identical, I think LVM2 should call
dm_init_log() with its own log function.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
LVM2 version of _create_dir_recursive() checks EROFS to decide
whether it should omit the log message.
Brings the same check to libdevmapper.

Index: device-mapper.work/lib/libdm-file.c
===================================================================
--- device-mapper.work.orig/lib/libdm-file.c
+++ device-mapper.work/lib/libdm-file.c
@@ -33,7 +33,8 @@ static int _create_dir_recursive(const c
 		if (*orig) {
 			rc = mkdir(orig, 0777);
 			if (rc < 0 && errno != EEXIST) {
-				log_sys_error("mkdir", orig);
+				if (errno != EROFS)
+					log_sys_error("mkdir", orig);
 				goto out;
 			}
 		}
@@ -43,7 +44,8 @@ static int _create_dir_recursive(const c
 	/* Create final directory */
 	rc = mkdir(dir, 0777);
 	if (rc < 0 && errno != EEXIST) {
-		log_sys_error("mkdir", orig);
+		if (errno != EROFS)
+			log_sys_error("mkdir", orig);
 		goto out;
 	}
 

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