This patch annotates ~90 symbols with explicit public visibility
across various parts of ZFS or related code in the bds/ subtree. This is
in preparation of the next patch that extracts ZFS code into a separate
libsolaris.so library where all symbols but the ones marked as public
here. These symbols need to be exposed for the main user of
libsolaris.so - libzfs.so.

Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 .../opensolaris/kern/opensolaris_kmem.c       |  3 +
 .../opensolaris/kern/opensolaris_taskq.c      | 12 ++--
 .../cddl/contrib/opensolaris/common/avl/avl.c | 25 +++----
 .../opensolaris/common/nvpair/fnvpair.c       | 12 ++--
 .../opensolaris/common/nvpair/nvpair.c        | 68 ++++++++++---------
 .../opensolaris/common/zfs/zfeature_common.c  |  8 ++-
 .../opensolaris/common/zfs/zfs_comutil.c      |  8 ++-
 .../opensolaris/common/zfs/zfs_namecheck.c    |  7 +-
 .../contrib/opensolaris/common/zfs/zfs_prop.c | 30 ++++----
 .../opensolaris/common/zfs/zpool_prop.c       | 30 ++++----
 .../opensolaris/common/zfs/zprop_common.c     |  4 +-
 .../opensolaris/uts/common/fs/zfs/spa.c       |  4 +-
 .../opensolaris/uts/common/fs/zfs/spa_misc.c  | 13 ++--
 include/osv/export.h                          |  3 +
 14 files changed, 128 insertions(+), 99 deletions(-)

diff --git a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 
b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
index f7c6b53a..aac97ce8 100644
--- a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
+++ b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
@@ -35,6 +35,8 @@
 #include <bsd/porting/netport.h>
 #include <assert.h>
 
+#include <osv/export.h>
+
 void *
 zfs_kmem_alloc(size_t size, int kmflags)
 {
@@ -133,6 +135,7 @@ kmem_debugging(void)
        return (0);
 }
 
+OSV_LIB_SOLARIS_API
 uint64_t kmem_size(void)
 {
        return physmem * PAGE_SIZE;
diff --git a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c 
b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
index 9711bb4f..3fc69e84 100644
--- a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
+++ b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
@@ -35,12 +35,14 @@
 #include <sys/queue.h>
 #include <sys/taskqueue.h>
 #include <sys/taskq.h>
+#include <osv/export.h>
 
 static uma_zone_t taskq_zone;
 
+OSV_LIB_SOLARIS_API
 taskq_t *system_taskq = NULL;
 
-void
+OSV_LIB_SOLARIS_API void
 system_taskq_init(void *arg)
 {
        taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask),
@@ -49,7 +51,7 @@ system_taskq_init(void *arg)
 }
 SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, 
NULL);
 
-void
+OSV_LIB_SOLARIS_API void
 system_taskq_fini(void *arg)
 {
 
@@ -58,7 +60,7 @@ system_taskq_fini(void *arg)
 }
 SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, 
system_taskq_fini, NULL);
 
-taskq_t *
+OSV_LIB_SOLARIS_API taskq_t *
 taskq_create(const char *name, int nthreads, pri_t pri, int minalloc 
__bsd_unused2,
     int maxalloc __bsd_unused2, uint_t flags)
 {
@@ -83,7 +85,7 @@ taskq_create_proc(const char *name, int nthreads, pri_t pri, 
int minalloc,
        return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags));
 }
 
-void
+OSV_LIB_SOLARIS_API void
 taskq_destroy(taskq_t *tq)
 {
 
@@ -108,7 +110,7 @@ taskq_run(void *arg, int pending __bsd_unused2)
        uma_zfree(taskq_zone, task);
 }
 
-taskqid_t
+OSV_LIB_SOLARIS_API taskqid_t
 taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
 {
        struct ostask *task;
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c 
b/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
index e5ac2f7e..6413c208 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
@@ -93,6 +93,7 @@
 #include <stdint.h>
 #include <sys/debug.h>
 #include <sys/avl.h>
+#include <osv/export.h>
 
 /*
  * Small arrays to translate between balance (or diff) values and child 
indeces.
@@ -121,7 +122,7 @@ static const int  avl_balance2child[]       = {0, 0, 1};
  * NULL - if at the end of the nodes
  * otherwise next node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_walk(avl_tree_t *tree, void        *oldnode, int left)
 {
        size_t off = tree->avl_offset;
@@ -168,7 +169,7 @@ avl_walk(avl_tree_t *tree, void     *oldnode, int left)
  * Return the lowest valued node in a tree or NULL.
  * (leftmost child from root of tree)
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_first(avl_tree_t *tree)
 {
        avl_node_t *node;
@@ -187,7 +188,7 @@ avl_first(avl_tree_t *tree)
  * Return the highest valued node in a tree or NULL.
  * (rightmost child from root of tree)
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_last(avl_tree_t *tree)
 {
        avl_node_t *node;
@@ -211,7 +212,7 @@ avl_last(avl_tree_t *tree)
  *     NULL: no node in the given direction
  *     "void *"  of the found tree node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_nearest(avl_tree_t *tree, avl_index_t where, int direction)
 {
        int child = AVL_INDEX2CHILD(where);
@@ -240,7 +241,7 @@ avl_nearest(avl_tree_t *tree, avl_index_t where, int 
direction)
  *             *where (if not NULL)  is set to indicate the insertion point
  *     "void *"  of the found tree node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_find(avl_tree_t *tree, const void *value, avl_index_t *where)
 {
        avl_node_t *node;
@@ -467,7 +468,7 @@ avl_rotation(avl_tree_t *tree, avl_node_t *node, int 
balance)
  * After the node is inserted, a single rotation further up the tree may
  * be necessary to maintain an acceptable AVL balance.
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_insert(avl_tree_t *tree, void *new_data, avl_index_t where)
 {
        avl_node_t *node;
@@ -617,7 +618,7 @@ avl_insert_here(
 /*
  * Add a new node to an AVL tree.
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_add(avl_tree_t *tree, void *new_node)
 {
        avl_index_t where;
@@ -660,7 +661,7 @@ avl_add(avl_tree_t *tree, void *new_node)
  * avl_rotation() is used to detect when a subtree did not change overall
  * height due to a rotation.
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_remove(avl_tree_t *tree, void *data)
 {
        avl_node_t *delete;
@@ -867,7 +868,7 @@ avl_update(avl_tree_t *t, void *obj)
 /*
  * initialize a new AVL tree
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_create(avl_tree_t *tree, int (*compar) (const void *, const void *),
     size_t size, size_t offset)
 {
@@ -890,7 +891,7 @@ avl_create(avl_tree_t *tree, int (*compar) (const void *, 
const void *),
  * Delete a tree.
  */
 /* ARGSUSED */
-void
+OSV_LIB_SOLARIS_API void
 avl_destroy(avl_tree_t *tree)
 {
        ASSERT(tree);
@@ -902,7 +903,7 @@ avl_destroy(avl_tree_t *tree)
 /*
  * Return the number of nodes in an AVL tree.
  */
-ulong_t
+OSV_LIB_SOLARIS_API ulong_t
 avl_numnodes(avl_tree_t *tree)
 {
        ASSERT(tree);
@@ -937,7 +938,7 @@ avl_is_empty(avl_tree_t *tree)
  *
  * On input, a cookie value of CHILDBIT indicates the tree is done.
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_destroy_nodes(avl_tree_t *tree, void **cookie)
 {
        avl_node_t      *node;
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c 
b/bsd/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c
index 1b67e624..06245337 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c
@@ -32,6 +32,8 @@
 #include <sys/kmem.h>
 #endif
 
+#include <osv/export.h>
+
 /*
  * "Force" nvlist wrapper.
  *
@@ -176,13 +178,13 @@ fnvlist_add_int64(nvlist_t *nvl, const char *name, 
int64_t val)
        VERIFY0(nvlist_add_int64(nvl, name, val));
 }
 
-void
+OSV_LIB_SOLARIS_API void
 fnvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val)
 {
        VERIFY0(nvlist_add_uint64(nvl, name, val));
 }
 
-void
+OSV_LIB_SOLARIS_API void
 fnvlist_add_string(nvlist_t *nvl, const char *name, const char *val)
 {
        VERIFY0(nvlist_add_string(nvl, name, val));
@@ -377,7 +379,7 @@ fnvlist_lookup_uint32(nvlist_t *nvl, const char *name)
        return (rv);
 }
 
-uint64_t
+OSV_LIB_SOLARIS_API uint64_t
 fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
 {
        uint64_t rv;
@@ -385,7 +387,7 @@ fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
        return (rv);
 }
 
-char *
+OSV_LIB_SOLARIS_API char *
 fnvlist_lookup_string(nvlist_t *nvl, const char *name)
 {
        char *rv;
@@ -393,7 +395,7 @@ fnvlist_lookup_string(nvlist_t *nvl, const char *name)
        return (rv);
 }
 
-nvlist_t *
+OSV_LIB_SOLARIS_API nvlist_t *
 fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name)
 {
        nvlist_t *rv;
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c 
b/bsd/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
index d9407309..f8bbe9b6 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
@@ -40,6 +40,8 @@
 #include <strings.h>
 #endif
 
+#include <osv/export.h>
+
 #ifndef        offsetof
 #define        offsetof(s, m)          ((size_t)(&(((s *)0)->m)))
 #endif
@@ -263,7 +265,7 @@ nvlist_nvflag(nvlist_t *nvl)
  * nvlist_alloc - Allocate nvlist.
  */
 /*ARGSUSED1*/
-int
+OSV_LIB_SOLARIS_API int
 nvlist_alloc(nvlist_t **nvlp, uint_t nvflag, int kmflag)
 {
 #if defined(_KERNEL) && !defined(_BOOT)
@@ -549,7 +551,7 @@ nvpair_free(nvpair_t *nvp)
 /*
  * nvlist_free - free an unpacked nvlist
  */
-void
+OSV_LIB_SOLARIS_API void
 nvlist_free(nvlist_t *nvl)
 {
        nvpriv_t *priv;
@@ -599,7 +601,7 @@ nvlist_contains_nvp(nvlist_t *nvl, nvpair_t *nvp)
  * Make a copy of nvlist
  */
 /*ARGSUSED1*/
-int
+OSV_LIB_SOLARIS_API int
 nvlist_dup(nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
 {
 #if defined(_KERNEL) && !defined(_BOOT)
@@ -633,7 +635,7 @@ nvlist_xdup(nvlist_t *nvl, nvlist_t **nvlp, nv_alloc_t *nva)
 /*
  * Remove all with matching name
  */
-int
+OSV_LIB_SOLARIS_API int
 nvlist_remove_all(nvlist_t *nvl, const char *name)
 {
        nvpriv_t *priv;
@@ -665,7 +667,7 @@ nvlist_remove_all(nvlist_t *nvl, const char *name)
 /*
  * Remove first one with matching name and type
  */
-int
+OSV_LIB_SOLARIS_API int
 nvlist_remove(nvlist_t *nvl, const char *name, data_type_t type)
 {
        nvpriv_t *priv;
@@ -978,13 +980,13 @@ nvlist_add_common(nvlist_t *nvl, const char *name,
        return (0);
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_boolean(nvlist_t *nvl, const char *name)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_BOOLEAN, 0, NULL));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_boolean_value(nvlist_t *nvl, const char *name, boolean_t val)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_BOOLEAN_VALUE, 1, &val));
@@ -1026,7 +1028,7 @@ nvlist_add_int32(nvlist_t *nvl, const char *name, int32_t 
val)
        return (nvlist_add_common(nvl, name, DATA_TYPE_INT32, 1, &val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_uint32(nvlist_t *nvl, const char *name, uint32_t val)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_UINT32, 1, &val));
@@ -1038,7 +1040,7 @@ nvlist_add_int64(nvlist_t *nvl, const char *name, int64_t 
val)
        return (nvlist_add_common(nvl, name, DATA_TYPE_INT64, 1, &val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_UINT64, 1, &val));
@@ -1052,7 +1054,7 @@ nvlist_add_double(nvlist_t *nvl, const char *name, double 
val)
 }
 #endif
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_string(nvlist_t *nvl, const char *name, const char *val)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_STRING, 1, (void *)val));
@@ -1113,7 +1115,7 @@ nvlist_add_int64_array(nvlist_t *nvl, const char *name, 
int64_t *a, uint_t n)
        return (nvlist_add_common(nvl, name, DATA_TYPE_INT64_ARRAY, n, a));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_uint64_array(nvlist_t *nvl, const char *name, uint64_t *a, uint_t n)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_UINT64_ARRAY, n, a));
@@ -1132,20 +1134,20 @@ nvlist_add_hrtime(nvlist_t *nvl, const char *name, 
hrtime_t val)
        return (nvlist_add_common(nvl, name, DATA_TYPE_HRTIME, 1, &val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_NVLIST, 1, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_add_nvlist_array(nvlist_t *nvl, const char *name, nvlist_t **a, uint_t 
n)
 {
        return (nvlist_add_common(nvl, name, DATA_TYPE_NVLIST_ARRAY, n, a));
 }
 
 /* reading name-value pairs */
-nvpair_t *
+OSV_LIB_SOLARIS_API nvpair_t *
 nvlist_next_nvpair(nvlist_t *nvl, nvpair_t *nvp)
 {
        nvpriv_t *priv;
@@ -1198,7 +1200,7 @@ nvlist_prev_nvpair(nvlist_t *nvl, nvpair_t *nvp)
        return (curr != NULL ? &curr->nvi_nvp : NULL);
 }
 
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 nvlist_empty(nvlist_t *nvl)
 {
        nvpriv_t *priv;
@@ -1210,13 +1212,13 @@ nvlist_empty(nvlist_t *nvl)
        return (priv->nvp_list == NULL);
 }
 
-char *
+OSV_LIB_SOLARIS_API char *
 nvpair_name(nvpair_t *nvp)
 {
        return (NVP_NAME(nvp));
 }
 
-data_type_t
+OSV_LIB_SOLARIS_API data_type_t
 nvpair_type(nvpair_t *nvp)
 {
        return (NVP_TYPE(nvp));
@@ -1348,7 +1350,7 @@ nvlist_lookup_boolean(nvlist_t *nvl, const char *name)
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_BOOLEAN, NULL, NULL));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_boolean_value(nvlist_t *nvl, const char *name, boolean_t *val)
 {
        return (nvlist_lookup_common(nvl, name,
@@ -1391,19 +1393,19 @@ nvlist_lookup_int32(nvlist_t *nvl, const char *name, 
int32_t *val)
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT32, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_uint32(nvlist_t *nvl, const char *name, uint32_t *val)
 {
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT32, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_int64(nvlist_t *nvl, const char *name, int64_t *val)
 {
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT64, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_uint64(nvlist_t *nvl, const char *name, uint64_t *val)
 {
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_UINT64, NULL, val));
@@ -1417,13 +1419,13 @@ nvlist_lookup_double(nvlist_t *nvl, const char *name, 
double *val)
 }
 #endif
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_string(nvlist_t *nvl, const char *name, char **val)
 {
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_STRING, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_nvlist(nvlist_t *nvl, const char *name, nvlist_t **val)
 {
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_NVLIST, NULL, val));
@@ -1492,7 +1494,7 @@ nvlist_lookup_int64_array(nvlist_t *nvl, const char *name,
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_INT64_ARRAY, n, a));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_uint64_array(nvlist_t *nvl, const char *name,
     uint64_t **a, uint_t *n)
 {
@@ -1506,7 +1508,7 @@ nvlist_lookup_string_array(nvlist_t *nvl, const char 
*name,
        return (nvlist_lookup_common(nvl, name, DATA_TYPE_STRING_ARRAY, n, a));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_lookup_nvlist_array(nvlist_t *nvl, const char *name,
     nvlist_t ***a, uint_t *n)
 {
@@ -1784,7 +1786,7 @@ int nvlist_lookup_nvpair_embedded_index(nvlist_t *nvl,
        return (nvlist_lookup_nvpair_ei_sep(nvl, name, '.', ret, ip, ep));
 }
 
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 nvlist_exists(nvlist_t *nvl, const char *name)
 {
        nvpriv_t *priv;
@@ -1847,7 +1849,7 @@ nvpair_value_int32(nvpair_t *nvp, int32_t *val)
        return (nvpair_value_common(nvp, DATA_TYPE_INT32, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvpair_value_uint32(nvpair_t *nvp, uint32_t *val)
 {
        return (nvpair_value_common(nvp, DATA_TYPE_UINT32, NULL, val));
@@ -1859,7 +1861,7 @@ nvpair_value_int64(nvpair_t *nvp, int64_t *val)
        return (nvpair_value_common(nvp, DATA_TYPE_INT64, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvpair_value_uint64(nvpair_t *nvp, uint64_t *val)
 {
        return (nvpair_value_common(nvp, DATA_TYPE_UINT64, NULL, val));
@@ -1873,13 +1875,13 @@ nvpair_value_double(nvpair_t *nvp, double *val)
 }
 #endif
 
-int
+OSV_LIB_SOLARIS_API int
 nvpair_value_string(nvpair_t *nvp, char **val)
 {
        return (nvpair_value_common(nvp, DATA_TYPE_STRING, NULL, val));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvpair_value_nvlist(nvpair_t *nvp, nvlist_t **val)
 {
        return (nvpair_value_common(nvp, DATA_TYPE_NVLIST, NULL, val));
@@ -2327,7 +2329,7 @@ nvlist_common(nvlist_t *nvl, char *buf, size_t *buflen, 
int encoding,
        return (err);
 }
 
-int
+OSV_LIB_SOLARIS_API int
 nvlist_size(nvlist_t *nvl, size_t *size, int encoding)
 {
        return (nvlist_common(nvl, NULL, size, encoding, NVS_OP_GETSIZE));
@@ -2337,7 +2339,7 @@ nvlist_size(nvlist_t *nvl, size_t *size, int encoding)
  * Pack nvlist into contiguous memory
  */
 /*ARGSUSED1*/
-int
+OSV_LIB_SOLARIS_API int
 nvlist_pack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
     int kmflag)
 {
@@ -2400,7 +2402,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *buflen, 
int encoding,
  * Unpack buf into an nvlist_t
  */
 /*ARGSUSED1*/
-int
+OSV_LIB_SOLARIS_API int
 nvlist_unpack(char *buf, size_t buflen, nvlist_t **nvlp, int kmflag)
 {
 #if defined(_KERNEL) && !defined(_BOOT)
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
index c2539d24..9e9e7215 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
@@ -34,6 +34,7 @@
 #include <sys/fs/zfs.h>
 #include <sys/types.h>
 #include "zfeature_common.h"
+#include <osv/export.h>
 
 /*
  * Set to disable all feature checks while opening pools, allowing pools with
@@ -41,6 +42,7 @@
  */
 boolean_t zfeature_checks_disable = B_FALSE;
 
+OSV_LIB_SOLARIS_API
 zfeature_info_t spa_feature_table[SPA_FEATURES];
 
 /*
@@ -84,7 +86,7 @@ zfeature_is_valid_guid(const char *name)
        return (has_colon);
 }
 
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zfeature_is_supported(const char *guid)
 {
        if (zfeature_checks_disable)
@@ -108,7 +110,7 @@ zfeature_lookup_guid(const char *guid, zfeature_info_t 
**res)
        return (ENOENT);
 }
 
-int
+OSV_LIB_SOLARIS_API int
 zfeature_lookup_name(const char *name, zfeature_info_t **res)
 {
        for (int i = 0; i < SPA_FEATURES; i++) {
@@ -147,7 +149,7 @@ zfeature_register(int fid, const char *guid, const char 
*name, const char *desc,
        feature->fi_depends = deps;
 }
 
-void
+OSV_LIB_SOLARIS_API void
 zpool_feature_init(void)
 {
        zfeature_register(SPA_FEATURE_ASYNC_DESTROY,
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c
index 5df68766..eb28d6de 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c
@@ -38,11 +38,12 @@
 #include <sys/fs/zfs.h>
 #include <sys/nvpair.h>
 #include "zfs_comutil.h"
+#include <osv/export.h>
 
 /*
  * Are there allocatable vdevs?
  */
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zfs_allocatable_devs(nvlist_t *nv)
 {
        uint64_t is_log;
@@ -64,7 +65,7 @@ zfs_allocatable_devs(nvlist_t *nv)
        return (B_FALSE);
 }
 
-void
+OSV_LIB_SOLARIS_API void
 zpool_get_rewind_policy(nvlist_t *nvl, zpool_rewind_policy_t *zrpp)
 {
        nvlist_t *policy;
@@ -142,7 +143,7 @@ zfs_zpl_version_map(int spa_version)
  * Return the min spa version for a corresponding spa version
  * -1 is returned if no mapping exists.
  */
-int
+OSV_LIB_SOLARIS_API int
 zfs_spa_version_map(int zpl_version)
 {
        int i;
@@ -156,6 +157,7 @@ zfs_spa_version_map(int zpl_version)
        return (version);
 }
 
+OSV_LIB_SOLARIS_API
 const char *zfs_history_event_names[LOG_END] = {
        "invalid event",
        "pool create",
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
index 5cfafea4..146c7377 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
@@ -45,6 +45,7 @@
 #include <sys/nvpair.h>
 #include "zfs_namecheck.h"
 #include "zfs_deleg.h"
+#include <osv/export.h>
 
 static int
 valid_char(char c)
@@ -129,7 +130,7 @@ permset_namecheck(const char *path, namecheck_err_t *why, 
char *what)
  * We allow '%' here as we use that character internally to create unique
  * names for temporary clones (for online recv).
  */
-int
+OSV_LIB_SOLARIS_API int
 dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
 {
        const char *loc, *end;
@@ -247,7 +248,7 @@ dataset_namecheck(const char *path, namecheck_err_t *why, 
char *what)
  *
  *     /[component][/]*[component][/]
  */
-int
+OSV_LIB_SOLARIS_API int
 mountpoint_namecheck(const char *path, namecheck_err_t *why)
 {
        const char *start, *end;
@@ -291,7 +292,7 @@ mountpoint_namecheck(const char *path, namecheck_err_t *why)
  * with a letter.  The pool names 'raidz' and 'mirror' are also reserved names
  * that cannot be used.
  */
-int
+OSV_LIB_SOLARIS_API int
 pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
 {
        const char *c;
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
index 2924d1d5..48382b57 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
@@ -38,10 +38,12 @@
 
 #if defined(_KERNEL)
 #include <sys/systm.h>
+#define OSV_LIB_ZFS_API
 #else
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#define OSV_LIB_ZFS_API __attribute__((__visibility__("default")))
 #endif
 
 static zprop_desc_t zfs_prop_table[ZFS_NUM_PROPS];
@@ -54,7 +56,7 @@ const char *zfs_userquota_prop_prefixes[] = {
        "groupquota@"
 };
 
-zprop_desc_t *
+OSV_LIB_ZFS_API zprop_desc_t *
 zfs_prop_get_table(void)
 {
        return (zfs_prop_table);
@@ -415,7 +417,7 @@ zfs_prop_delegatable(zfs_prop_t prop)
 /*
  * Given a zfs dataset property name, returns the corresponding property ID.
  */
-zfs_prop_t
+OSV_LIB_ZFS_API zfs_prop_t
 zfs_name_to_prop(const char *propname)
 {
        return (zprop_name_to_prop(propname, ZFS_TYPE_DATASET));
@@ -436,7 +438,7 @@ valid_char(char c)
 /*
  * Returns true if this is a valid user-defined property (one with a ':').
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_user(const char *name)
 {
        int i;
@@ -462,7 +464,7 @@ zfs_prop_user(const char *name)
  * Note that after the @, any character is valid (eg, another @, for SID
  * user@domain).
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_userquota(const char *name)
 {
        zfs_userquota_prop_t prop;
@@ -482,7 +484,7 @@ zfs_prop_userquota(const char *name)
  * Note that after the @, any character is valid (eg, another @, for
  * written@pool/fs@origin).
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_written(const char *name)
 {
        static const char *prefix = "written@";
@@ -493,7 +495,7 @@ zfs_prop_written(const char *name)
  * Tables of index types, plus functions to convert between the user view
  * (strings) and internal representation (uint64_t).
  */
-int
+OSV_LIB_ZFS_API int
 zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *index)
 {
        return (zprop_string_to_index(prop, string, index, ZFS_TYPE_DATASET));
@@ -514,7 +516,7 @@ zfs_prop_random_value(zfs_prop_t prop, uint64_t seed)
 /*
  * Returns TRUE if the property applies to any of the given dataset types.
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_valid_for_type(int prop, zfs_type_t types)
 {
        return (zprop_valid_for_type(prop, types));
@@ -529,7 +531,7 @@ zfs_prop_get_type(zfs_prop_t prop)
 /*
  * Returns TRUE if the property is readonly.
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_readonly(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_attr == PROP_READONLY ||
@@ -561,7 +563,7 @@ zfs_prop_default_numeric(zfs_prop_t prop)
  * Given a dataset property ID, returns the corresponding name.
  * Assuming the zfs dataset property ID is valid.
  */
-const char *
+OSV_LIB_ZFS_API const char *
 zfs_prop_to_name(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_name);
@@ -570,7 +572,7 @@ zfs_prop_to_name(zfs_prop_t prop)
 /*
  * Returns TRUE if the property is inheritable.
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_inheritable(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_attr == PROP_INHERIT ||
@@ -583,7 +585,7 @@ zfs_prop_inheritable(zfs_prop_t prop)
  * Returns a string describing the set of acceptable values for the given
  * zfs property, or NULL if it cannot be set.
  */
-const char *
+OSV_LIB_ZFS_API const char *
 zfs_prop_values(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_values);
@@ -594,7 +596,7 @@ zfs_prop_values(zfs_prop_t prop)
  * (compression, checksum) are treated as strings in userland, even though they
  * are stored numerically on disk.
  */
-int
+OSV_LIB_ZFS_API int
 zfs_prop_is_string(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_proptype == PROP_TYPE_STRING ||
@@ -605,7 +607,7 @@ zfs_prop_is_string(zfs_prop_t prop)
  * Returns the column header for the given property.  Used only in
  * 'zfs list -o', but centralized here with the other property information.
  */
-const char *
+OSV_LIB_ZFS_API const char *
 zfs_prop_column_name(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_colname);
@@ -615,7 +617,7 @@ zfs_prop_column_name(zfs_prop_t prop)
  * Returns whether the given property should be displayed right-justified for
  * 'zfs list'.
  */
-boolean_t
+OSV_LIB_ZFS_API boolean_t
 zfs_prop_align_right(zfs_prop_t prop)
 {
        return (zfs_prop_table[prop].pd_rightalign);
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
index 075611f4..cab9d410 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
@@ -40,15 +40,17 @@
 #include <ctype.h>
 #endif
 
+#include <osv/export.h>
+
 static zprop_desc_t zpool_prop_table[ZPOOL_NUM_PROPS];
 
-zprop_desc_t *
+OSV_LIB_SOLARIS_API zprop_desc_t *
 zpool_prop_get_table(void)
 {
        return (zpool_prop_table);
 }
 
-void
+OSV_LIB_SOLARIS_API void
 zpool_prop_init(void)
 {
        static zprop_index_t boolean_table[] = {
@@ -128,7 +130,7 @@ zpool_prop_init(void)
 /*
  * Given a property name and its type, returns the corresponding property ID.
  */
-zpool_prop_t
+OSV_LIB_SOLARIS_API zpool_prop_t
 zpool_name_to_prop(const char *propname)
 {
        return (zprop_name_to_prop(propname, ZFS_TYPE_POOL));
@@ -138,31 +140,31 @@ zpool_name_to_prop(const char *propname)
  * Given a pool property ID, returns the corresponding name.
  * Assuming the pool propety ID is valid.
  */
-const char *
+OSV_LIB_SOLARIS_API const char *
 zpool_prop_to_name(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_name);
 }
 
-zprop_type_t
+OSV_LIB_SOLARIS_API zprop_type_t
 zpool_prop_get_type(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_proptype);
 }
 
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zpool_prop_readonly(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_attr == PROP_READONLY);
 }
 
-const char *
+OSV_LIB_SOLARIS_API const char *
 zpool_prop_default_string(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_strdefault);
 }
 
-uint64_t
+OSV_LIB_SOLARIS_API uint64_t
 zpool_prop_default_numeric(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_numdefault);
@@ -171,7 +173,7 @@ zpool_prop_default_numeric(zpool_prop_t prop)
 /*
  * Returns true if this is a valid feature@ property.
  */
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zpool_prop_feature(const char *name)
 {
        static const char *prefix = "feature@";
@@ -181,7 +183,7 @@ zpool_prop_feature(const char *name)
 /*
  * Returns true if this is a valid unsupported@ property.
  */
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zpool_prop_unsupported(const char *name)
 {
        static const char *prefix = "unsupported@";
@@ -195,7 +197,7 @@ zpool_prop_string_to_index(zpool_prop_t prop, const char 
*string,
        return (zprop_string_to_index(prop, string, index, ZFS_TYPE_POOL));
 }
 
-int
+OSV_LIB_SOLARIS_API int
 zpool_prop_index_to_string(zpool_prop_t prop, uint64_t index,
     const char **string)
 {
@@ -210,19 +212,19 @@ zpool_prop_random_value(zpool_prop_t prop, uint64_t seed)
 
 #if !defined(_KERNEL) || defined(__OSV__)
 
-const char *
+OSV_LIB_SOLARIS_API const char *
 zpool_prop_values(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_values);
 }
 
-const char *
+OSV_LIB_SOLARIS_API const char *
 zpool_prop_column_name(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_colname);
 }
 
-boolean_t
+OSV_LIB_SOLARIS_API boolean_t
 zpool_prop_align_right(zpool_prop_t prop)
 {
        return (zpool_prop_table[prop].pd_rightalign);
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c 
b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c
index b1c3ba6e..a07eda57 100644
--- a/bsd/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c
@@ -38,12 +38,14 @@
 #include "zfs_deleg.h"
 
 #if defined(_KERNEL)
+#define OSV_LIB_ZFS_API
 #include <sys/systm.h>
 #include <sys/libkern.h>
 #else
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#define OSV_LIB_ZFS_API __attribute__((__visibility__("default")))
 #endif
 
 static zprop_desc_t *
@@ -367,7 +369,7 @@ zprop_valid_for_type(int prop, zfs_type_t type)
  * Determines the minimum width for the column, and indicates whether it's 
fixed
  * or not.  Only string columns are non-fixed.
  */
-size_t
+OSV_LIB_ZFS_API size_t
 zprop_width(int prop, boolean_t *fixed, zfs_type_t type)
 {
        zprop_desc_t *prop_tbl, *pd;
diff --git a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c 
b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
index b43813d4..6cee8352 100644
--- a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -72,6 +72,8 @@
 #include "zfs_prop.h"
 #include "zfs_comutil.h"
 
+#include <osv/export.h>
+
 /* Check hostid on import? */
 static int check_hostid = 1;
 
@@ -3139,7 +3141,7 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config)
        nvlist_free(features);
 }
 
-int
+OSV_LIB_SOLARIS_API int
 spa_get_stats(const char *name, nvlist_t **config,
     char *altroot, size_t buflen)
 {
diff --git a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c 
b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
index 606fd18f..2ea8b577 100644
--- a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
+++ b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
@@ -49,6 +49,7 @@
 #include <sys/ddt.h>
 #include "zfs_prop.h"
 #include "zfeature_common.h"
+#include <osv/export.h>
 
 /*
  * SPA locking
@@ -237,8 +238,10 @@ int spa_mode_global;
 
 #ifdef ZFS_DEBUG
 /* Everything except dprintf is on by default in debug builds */
+OSV_LIB_SOLARIS_API
 int zfs_flags = ~ZFS_DEBUG_DPRINTF;
 #else
+OSV_LIB_SOLARIS_API
 int zfs_flags = 0;
 #endif
 
@@ -1162,7 +1165,7 @@ spa_guid_exists(uint64_t pool_guid, uint64_t device_guid)
        return (spa_by_guid(pool_guid, device_guid) != NULL);
 }
 
-char *
+OSV_LIB_SOLARIS_API char *
 spa_strdup(const char *s)
 {
        size_t len;
@@ -1176,7 +1179,7 @@ spa_strdup(const char *s)
        return (new);
 }
 
-void
+OSV_LIB_SOLARIS_API void
 spa_strfree(char *s)
 {
        kmem_free(s, strlen(s) + 1);
@@ -1343,7 +1346,7 @@ spa_sync_pass(spa_t *spa)
        return (spa->spa_sync_pass);
 }
 
-char *
+OSV_LIB_SOLARIS_API char *
 spa_name(spa_t *spa)
 {
        return (spa->spa_name);
@@ -1585,7 +1588,7 @@ spa_boot_init()
        spa_config_load();
 }
 
-void
+OSV_LIB_SOLARIS_API void
 spa_init(int mode)
 {
        mutex_init(&spa_namespace_lock, NULL, MUTEX_DEFAULT, NULL);
@@ -1631,7 +1634,7 @@ spa_init(int mode)
        l2arc_start();
 }
 
-void
+OSV_LIB_SOLARIS_API void
 spa_fini(void)
 {
        l2arc_stop();
diff --git a/include/osv/export.h b/include/osv/export.h
index ab93da14..c03659b8 100644
--- a/include/osv/export.h
+++ b/include/osv/export.h
@@ -30,6 +30,9 @@
 #define OSV_LIBXENSTORE_API __attribute__((__visibility__("default")))
 #define OSV_LD_LINUX_x86_64_API __attribute__((__visibility__("default")))
 
+// This is to expose some symbols in libsolaris.so
+#define OSV_LIB_SOLARIS_API __attribute__((__visibility__("default")))
+
 // In some very few cases, when source files are compiled without visibility
 // flag in order to expose most symbols in the corresponding file, there are 
some specific
 // symbols in the same file that we want to hide and this is where we use this 
macro.
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20211215223925.1399624-1-jwkozaczuk%40gmail.com.

Reply via email to