On Thu, Jan 05, 2012 at 01:28:25PM +0000, FreeBSD Tinderbox wrote:
> ...
> cc -O2 -pipe  
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libzpool/common 
> -I/src/cddl/sbin/zpool/../../../cddl/compat/opensolaris/include 
> -I/src/cddl/sbin/zpool/../../../cddl/compat/opensolaris/lib/libumem 
> -I/src/cddl/sbin/zpool/../../../sys/cddl/compat/opensolaris 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/head 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libuutil/common 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libumem/common 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libzfs/common 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/lib/libnvpair 
> -I/src/cddl/sbin/zpool/../../../sys/cddl/contrib/opensolaris/common/zfs 
> -I/src/cddl/sbin/zpool/../../../sys/cddl/contrib/opensolaris/uts/common 
> -I/src/cddl/sbin/zpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
>  -I/src/cddl/sbin/zpool/../../../sys/cddl/contrib/opensolaris/uts/common/sys 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/o!
>  pensolaris/lib/libzpool/common 
> -I/src/cddl/sbin/zpool/../../../cddl/contrib/opensolaris/cmd/stat/common 
> -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-unknown-pragmas  -o 
> zpool zpool_main.o zpool_vdev.o zpool_iter.o zpool_util.o zfs_comutil.o 
> timestamp.o -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil 
> -lzfs
> zpool_main.o(.text+0x34fd): In function `zpool_do_labelclear':
> : undefined reference to `zpool_pool_state_to_name'
> *** Error code 1
> ...

Attached patch gets around the above for me.

Caveats:
* I haven't finished the build yet (but did get beyond that breakage).

* I don't use ZFS, so I don't exercise the code.

Peace,
david
-- 
David H. Wolfskill                              da...@catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
===================================================================
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	(revision 229586)
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h	(working copy)
@@ -202,7 +202,8 @@
 extern void zpool_close(zpool_handle_t *);
 extern const char *zpool_get_name(zpool_handle_t *);
 extern int zpool_get_state(zpool_handle_t *);
-extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
+extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
+extern const char *zpool_pool_state_to_name(pool_state_t);
 extern void zpool_free_handles(libzfs_handle_t *);
 
 /*
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
===================================================================
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	(revision 229586)
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c	(working copy)
@@ -176,7 +176,7 @@
 /*
  * Map VDEV STATE to printed strings.
  */
-char *
+const char *
 zpool_state_to_name(vdev_state_t state, vdev_aux_t aux)
 {
 	switch (state) {
@@ -204,6 +204,34 @@
 }
 
 /*
+ * Map POOL STATE to printed strings.
+ */
+const char *
+zpool_pool_state_to_name(pool_state_t state)
+{
+	switch (state) {
+	case POOL_STATE_ACTIVE:
+		return (gettext("ACTIVE"));
+	case POOL_STATE_EXPORTED:
+		return (gettext("EXPORTED"));
+	case POOL_STATE_DESTROYED:
+		return (gettext("DESTROYED"));
+	case POOL_STATE_SPARE:
+		return (gettext("SPARE"));
+	case POOL_STATE_L2CACHE:
+		return (gettext("L2CACHE"));
+	case POOL_STATE_UNINITIALIZED:
+		return (gettext("UNINITIALIZED"));
+	case POOL_STATE_UNAVAIL:
+		return (gettext("UNAVAIL"));
+	case POOL_STATE_POTENTIALLY_ACTIVE:
+		return (gettext("POTENTIALLY_ACTIVE"));
+	}
+
+	return (gettext("UNKNOWN"));
+}
+
+/*
  * Get a zpool property value for 'prop' and return the value in
  * a pre-allocated buffer.
  */

Attachment: pgp3XnLXOGPzz.pgp
Description: PGP signature

Reply via email to