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

Re: [Glibc-bsd-commits] r3162 - trunk/zfsutils/debian/patches



Hi,

On Fri, Aug 13, 2010 at 10:46:46PM +0000, Tuco Xyz wrote:
> Author: tuco-guest
> Date: 2010-08-13 22:46:46 +0000 (Fri, 13 Aug 2010)
> New Revision: 3162
> 
> Added:
>    trunk/zfsutils/debian/patches/10_dev_dsk.diff
> Modified:
>    trunk/zfsutils/debian/patches/series
> Log:
> 
> This makes zpool import work. The real problem here is NOT that /dev/ is not searched for. On FreeBSD scan is usually performed by geom_find_import(), and /dev is not searched unless that fails. The problem was that GNU realpath() fails for inexistant paths and BSD realpath() doesn't.
> 

Given the explanation you are giving there, I am not sure it is the
correct fix. Given GNU realpath() behave differently than the BSD
realpath() used in the original code, how about fixing the code 
that call realpath() to behave correctly with the GNU version?

> 
> Added: trunk/zfsutils/debian/patches/10_dev_dsk.diff
> ===================================================================
> --- trunk/zfsutils/debian/patches/10_dev_dsk.diff	                        (rev 0)
> +++ trunk/zfsutils/debian/patches/10_dev_dsk.diff	2010-08-13 22:46:46 UTC (rev 3162)
> @@ -0,0 +1,40 @@
> +--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
> ++++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
> +@@ -1468,7 +1468,11 @@
> + 
> + 	if (searchdirs == NULL) {
> + 		searchdirs = safe_malloc(sizeof (char *));
> ++#ifdef __sun
> + 		searchdirs[0] = "/dev/dsk";
> ++#else
> ++		searchdirs[0] = "/dev";
> ++#endif
> + 		nsearch = 1;
> + 	}
> + 
> +--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
> ++++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
> +@@ -848,7 +848,11 @@
> + 	size_t pathleft;
> + 	struct stat64 statbuf;
> + 	nvlist_t *ret = NULL, *config;
> ++#ifdef __sun
> + 	static char *default_dir = "/dev/dsk";
> ++#else
> ++	static char *default_dir = "/dev";
> ++#endif
> + 	int fd;
> + 	pool_list_t pools = { 0 };
> + 	pool_entry_t *pe, *penext;
> +@@ -894,9 +898,11 @@
> + 		 * reading the labels skips a bunch of slow operations during
> + 		 * close(2) processing, so we replace /dev/dsk with /dev/rdsk.
> + 		 */
> ++#ifdef __sun
> + 		if (strcmp(path, "/dev/dsk/") == 0)
> + 			rdsk = "/dev/rdsk/";
> + 		else
> ++#endif
> + 			rdsk = path;
> + 
> + 		if ((dirp = opendir(rdsk)) == NULL) {
> 
> Modified: trunk/zfsutils/debian/patches/series
> ===================================================================
> --- trunk/zfsutils/debian/patches/series	2010-08-13 22:24:54 UTC (rev 3161)
> +++ trunk/zfsutils/debian/patches/series	2010-08-13 22:46:46 UTC (rev 3162)
> @@ -7,3 +7,4 @@
>  07_manpages.diff
>  08_libbsd.diff
>  09_xdr_control.diff
> +10_dev_dsk.diff
> 
> 
> _______________________________________________
> Glibc-bsd-commits mailing list
> Glibc-bsd-commits@lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/glibc-bsd-commits
> 

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: