CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2021-05-13 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu May 13 09:05:19 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_dataset.c

Log Message:
this is not FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c:1.4 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c:1.5
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c:1.4	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c	Thu May 13 09:05:19 2021
@@ -1135,7 +1135,7 @@ badlabel:
 			m_label_free(new_sl);	/* OK if null */
 #else	/* !illumos */
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-			"mlslabel is not supported on FreeBSD"));
+			"mlslabel is not supported on NetBSD"));
 			(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
 #endif	/* illumos */
 			goto error;
@@ -1644,7 +1644,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl
 		case ZFS_PROP_NBMAND:
 		case ZFS_PROP_MLSLABEL:
 			(void) snprintf(errbuf, sizeof (errbuf),
-			"property '%s' not supported on FreeBSD",
+			"property '%s' not supported on NetBSD",
 			nvpair_name(elem));
 			ret = zfs_error(hdl, EZFS_PERM, errbuf);
 			goto error;



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2020-04-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr  4 13:45:22 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
When collecting zpool devices, skip disks with wedges so that a
concurrent test of a wedge on that disk doesn't fail.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.5 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.6
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.5	Tue Aug 20 08:11:21 2019
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c	Sat Apr  4 13:45:22 2020
@@ -1095,8 +1095,16 @@ zpool_open_func(void *arg)
 	}
 #endif /* __FreeBSD__ */
 #ifdef __NetBSD__
+	struct dkwedge_list dkwl;
 	off_t size;
 
+	/* skip devices with wedges */
+	if (native_ioctl(fd, DIOCLWEDGES, ) == 0 &&
+	dkwl.dkwl_nwedges > 0) {
+		(void) close(fd);
+		return;
+	}
+
 	if (native_ioctl(fd, DIOCGMEDIASIZE, ) < 0 ||
 	size < SPA_MINDEVSIZE) {
 		(void) close(fd);



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2013-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 26 20:15:50 UTC 2013

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_util.c

Log Message:
Avoid comparison between pointer and integer.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.5 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.6
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.5	Tue Jan  1 14:02:19 2013
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c	Sat Jan 26 15:15:50 2013
@@ -686,7 +686,7 @@ zcmd_alloc_dst_nvlist(libzfs_handle_t *h
 		len = 4*1024;
 	zc-zc_nvlist_dst_size = len;
 	if ((zc-zc_nvlist_dst = (uint64_t)(uintptr_t)
-	zfs_alloc(hdl, zc-zc_nvlist_dst_size)) == NULL)
+	zfs_alloc(hdl, zc-zc_nvlist_dst_size)) == 0)
 		return (-1);
 
 	return (0);
@@ -702,8 +702,7 @@ zcmd_expand_dst_nvlist(libzfs_handle_t *
 {
 	free((void *)(uintptr_t)zc-zc_nvlist_dst);
 	if ((zc-zc_nvlist_dst = (uint64_t)(uintptr_t)
-	zfs_alloc(hdl, zc-zc_nvlist_dst_size))
-	== NULL)
+	zfs_alloc(hdl, zc-zc_nvlist_dst_size)) == 0)
 		return (-1);
 
 	return (0);



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2013-01-01 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Tue Jan  1 19:02:19 UTC 2013

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_util.c

Log Message:
This needs an explicit include of sys/ioctl.h.
XXX: There is some crappy code in here :-)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.4 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.5
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.4	Fri Dec 24 16:13:58 2010
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c	Tue Jan  1 19:02:19 2013
@@ -40,6 +40,7 @@
 #include sys/mnttab.h
 #include sys/mntent.h
 #include sys/types.h
+#include sys/ioctl.h
 
 #include libzfs.h
 



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2012-06-03 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Jun  3 10:53:52 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_sendrecv.c

Log Message:
Not sure why this has just started to fail!
But it really isn't a good idea to compare a uint64_t to NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c:1.1.1.2 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c:1.2
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c:1.1.1.2	Sat Feb 27 22:30:28 2010
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c	Sun Jun  3 10:53:51 2012
@@ -2245,7 +2245,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in
 			(void) printf(found clone origin %s\n, zc.zc_string);
 	}
 
-	stream_wantsnewfs = (drrb-drr_fromguid == NULL ||
+	stream_wantsnewfs = (drrb-drr_fromguid == 0 ||
 	(drrb-drr_flags  DRR_FLAG_CLONE));
 
 	if (stream_wantsnewfs) {



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2010-12-24 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Fri Dec 24 16:13:58 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_util.c

Log Message:
libzfs_fru_clear was not ported to NetBSD disable it foor now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.3 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.4
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c:1.3	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c	Fri Dec 24 16:13:58 2010
@@ -615,7 +615,9 @@
 	if (hdl-libzfs_log_str)
 		(void) free(hdl-libzfs_log_str);
 	zpool_free_handles(hdl);
+#ifdef PORT_SOLARIS
 	libzfs_fru_clear(hdl, B_TRUE);
+#endif	
 	namespace_clear(hdl);
 	libzfs_mnttab_fini(hdl);
 	free(hdl);



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2010-12-13 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Tue Dec 14 01:22:24 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_mount.c

Log Message:
Fix amd64 build where sysinfo was not defined, disable libshare for now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c:1.3 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c:1.4
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c:1.3	Sat Feb 27 23:43:52 2010
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c	Tue Dec 14 01:22:24 2010
@@ -168,7 +168,7 @@
 		/* the mountpoint is the first entry on each line */
 		if ((tab = strchr(buf, '\t')) == NULL)
 			continue;
-
+#if defined(sun)
 		*tab = '\0';
 		if (strcmp(buf, mountpoint) == 0) {
 			/*
@@ -194,6 +194,11 @@
 }
 			}
 		}
+#else
+			if (proto == PROTO_NFS)
+return (SHARED_NFS);
+#endif
+
 	}
 
 	return (SHARED_NOT_SHARED);
@@ -515,7 +520,7 @@
  * wrapper functions that check to see that the pointers to functions
  * initialized in _zfs_init_libshare() are actually present.
  */
-
+#ifdef PORT_SOLARIS
 static sa_handle_t (*_sa_init)(int);
 static void (*_sa_fini)(sa_handle_t);
 static sa_share_t (*_sa_find_share)(sa_handle_t, char *);
@@ -528,7 +533,7 @@
 static int (*_sa_zfs_process_share)(sa_handle_t, sa_group_t, sa_share_t,
 char *, char *, zprop_source_t, char *, char *, char *);
 static void (*_sa_update_sharetab_ts)(sa_handle_t);
-
+#endif
 /*
  * _zfs_init_libshare()
  *
@@ -541,6 +546,7 @@
 static void
 _zfs_init_libshare(void)
 {
+#ifdef PORT_SOLARIS
 	void *libshare;
 	char path[MAXPATHLEN];
 	char isa[MAXISALEN];
@@ -595,6 +601,7 @@
 			_sa_update_sharetab_ts = NULL;
 		}
 	}
+#endif
 }
 
 /*
@@ -609,7 +616,7 @@
 zfs_init_libshare(libzfs_handle_t *zhandle, int service)
 {
 	int ret = SA_OK;
-
+#ifdef PORT_SOLARIS
 	if (_sa_init == NULL)
 		ret = SA_CONFIG_ERR;
 
@@ -635,7 +642,7 @@
 
 	if (ret == SA_OK  zhandle-libzfs_sharehdl == NULL)
 		ret = SA_NO_MEMORY;
-
+#endif
 	return (ret);
 }
 
@@ -649,8 +656,10 @@
 zfs_uninit_libshare(libzfs_handle_t *zhandle)
 {
 	if (zhandle != NULL  zhandle-libzfs_sharehdl != NULL) {
+#ifdef PORT_SOLARIS
 		if (_sa_fini != NULL)
 			_sa_fini(zhandle-libzfs_sharehdl);
+#endif
 		zhandle-libzfs_sharehdl = NULL;
 	}
 }
@@ -664,13 +673,18 @@
 int
 zfs_parse_options(char *options, zfs_share_proto_t proto)
 {
+#ifdef PORT_SOLARIS
 	if (_sa_parse_legacy_options != NULL) {
 		return (_sa_parse_legacy_options(NULL, options,
 		proto_table[proto].p_name));
 	}
 	return (SA_CONFIG_ERR);
+#else
+	return (SA_OK);
+#endif
 }
 
+#ifdef PORT_SOLARIS
 /*
  * zfs_sa_find_share(handle, path)
  *
@@ -712,7 +726,7 @@
 		return (_sa_disable_share(share, proto));
 	return (SA_CONFIG_ERR);
 }
-
+#endif
 /*
  * Share the given filesystem according to the options in the specified
  * protocol specific properties (sharenfs, sharesmb).  We rely
@@ -728,11 +742,11 @@
 	sa_share_t share;
 	zfs_share_proto_t *curr_proto;
 	zprop_source_t sourcetype;
-	int ret;
+	int error, ret;
 
 	if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
 		return (0);
-
+#ifdef PORT_SOLARIS
 	if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
 		(void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
 		dgettext(TEXT_DOMAIN, cannot share '%s': %s),
@@ -740,7 +754,7 @@
 		_sa_errorstr(ret) : );
 		return (-1);
 	}
-
+#endif
 	for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
 		/*
 		 * Return success if there are no share options.
@@ -760,6 +774,7 @@
 		if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
 			continue;
 
+#ifdef PORT_SOLARIS
 		share = zfs_sa_find_share(hdl-libzfs_sharehdl, mountpoint);
 		if (share == NULL) {
 			/*
@@ -803,7 +818,7 @@
 			zfs_get_name(zhp));
 			return (-1);
 		}
-
+#endif
 	}
 	return (0);
 }
@@ -834,6 +849,7 @@
 unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
 zfs_share_proto_t proto)
 {
+#ifdef PORT_SOLARIS
 	sa_share_t share;
 	int err;
 	char *mntpt;
@@ -867,6 +883,7 @@
 		dgettext(TEXT_DOMAIN, cannot unshare '%s': not found),
 		name));
 	}
+#endif
 	return (0);
 }
 
@@ -1027,7 +1044,7 @@
 	sizeof (shareopts), NULL, NULL, 0, B_FALSE) != 0 ||
 	strcmp(shareopts, off) == 0)
 		return (0);
-
+#ifdef PORT_ISCSI /* NetBSD do not support zfssharing with iscsi, yet */
 	if (iscsitgt_zfs_share == NULL || iscsitgt_zfs_share(dataset) != 0) {
 		int error = EZFS_SHAREISCSIFAILED;
 
@@ -1042,7 +1059,7 @@
 		return (zfs_error_fmt(hdl, error,
 		dgettext(TEXT_DOMAIN, cannot share '%s'), dataset));
 	}
-
+#endif
 	return (0);
 }
 
@@ -1052,6 +1069,7 @@
 	

CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2009-10-06 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Tue Oct  6 12:03:47 UTC 2009

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
Replace another openat call with open + changed path.

XXX. This commit should be reverted after proper implementation of *at syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.1.1.1 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.2
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.1.1.1	Fri Aug  7 18:32:44 2009
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c	Tue Oct  6 12:03:47 2009
@@ -860,7 +860,10 @@
 			(name[1] == 0 || (name[1] == '.'  name[2] == 0)))
 continue;
 
-			if ((fd = openat64(dfd, name, O_RDONLY))  0)
+			(void)snprintf(path, sizeof (path), %s/%s,
+			rdsk, dp-d_name);
+			
+			if ((fd = open(path, O_RDONLY))  0)
 continue;
 
 			/*



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2009-10-05 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Mon Oct  5 16:25:27 UTC 2009

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_pool.c

Log Message:
Disable *at functions for now. These functions should be implemented
because they are part of POSIX standard but it seems to be a long time process.

XXX. This commit should be reverted after adding support for openat and fstatat.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.1.1.1 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.2
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c:1.1.1.1	Fri Aug  7 18:32:46 2009
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c	Mon Oct  5 16:25:27 2009
@@ -2092,20 +2092,23 @@
 	libzfs_handle_t *hdl = zhp-zpool_hdl;
 	char (*paths)[MAXPATHLEN];
 	size_t size = 4;
-	int curr, fd, base, ret = 0;
+	int curr, base, ret = 0;
+#ifdef PORT_NETBSD
+	int fd;
 	DIR *dirp;
 	struct dirent *dp;
+#endif	
 	struct stat st;
 
 	if ((base = open(/dev/zvol/dsk, O_RDONLY))  0)
 		return (errno == ENOENT ? 0 : -1);
-
+#ifdef PORT_NETBSD
 	if (fstatat(base, zhp-zpool_name, st, 0) != 0) {
 		int err = errno;
 		(void) close(base);
 		return (err == ENOENT ? 0 : -1);
 	}
-
+#endif
 	/*
 	 * Oddly this wasn't a directory -- ignore that failure since we
 	 * know there are no links lower in the (non-existant) hierarchy.
@@ -2122,7 +2125,8 @@
 
 	(void) strlcpy(paths[0], zhp-zpool_name, sizeof (paths[0]));
 	curr = 0;
-
+	
+#ifdef PORT_NETBSD	
 	while (curr = 0) {
 		if (fstatat(base, paths[curr], st, AT_SYMLINK_NOFOLLOW) != 0)
 			goto err;
@@ -2171,7 +2175,8 @@
 
 		curr--;
 	}
-
+#endif /* PORT_NETBSD */
+	
 	free(paths);
 	(void) close(base);