diff --git a/cmd/zhack/zhack.c b/cmd/zhack/zhack.c index 08263120c..c1017ec23 100644 --- a/cmd/zhack/zhack.c +++ b/cmd/zhack/zhack.c @@ -48,10 +48,9 @@ #include #include #include +#include #include -extern boolean_t zfeature_checks_disable; - const char cmdname[] = "zhack"; static importargs_t g_importargs; static char *g_pool; diff --git a/config/Abigail.am b/config/Abigail.am index 599f61194..0a74741b4 100644 --- a/config/Abigail.am +++ b/config/Abigail.am @@ -25,5 +25,5 @@ checkabi: storeabi: cd .libs ; \ for lib in $(lib_LTLIBRARIES) ; do \ - abidw $${lib%.la}.so > ../$${lib%.la}.abi ; \ + abidw --no-show-locs $${lib%.la}.so > ../$${lib%.la}.abi ; \ done diff --git a/include/cityhash.h b/include/cityhash.h index 33c3b7bc2..3b2d1e84b 100644 --- a/include/cityhash.h +++ b/include/cityhash.h @@ -24,7 +24,7 @@ */ #ifndef _SYS_CITYHASH_H -#define _SYS_CITYHASH_H +#define _SYS_CITYHASH_H extern __attribute__((visibility("default"))) #include @@ -32,7 +32,7 @@ extern "C" { #endif -uint64_t cityhash4(uint64_t, uint64_t, uint64_t, uint64_t); +_SYS_CITYHASH_H uint64_t cityhash4(uint64_t, uint64_t, uint64_t, uint64_t); #ifdef __cplusplus } diff --git a/include/libzfs.h b/include/libzfs.h index 344d2146f..9ef280636 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -32,7 +32,7 @@ */ #ifndef _LIBZFS_H -#define _LIBZFS_H +#define _LIBZFS_H extern __attribute__((visibility("default"))) #include #include @@ -196,64 +196,64 @@ typedef struct zfs_handle zfs_handle_t; typedef struct zpool_handle zpool_handle_t; typedef struct libzfs_handle libzfs_handle_t; -extern int zpool_wait(zpool_handle_t *, zpool_wait_activity_t); -extern int zpool_wait_status(zpool_handle_t *, zpool_wait_activity_t, +_LIBZFS_H int zpool_wait(zpool_handle_t *, zpool_wait_activity_t); +_LIBZFS_H int zpool_wait_status(zpool_handle_t *, zpool_wait_activity_t, boolean_t *, boolean_t *); /* * Library initialization */ -extern libzfs_handle_t *libzfs_init(void); -extern void libzfs_fini(libzfs_handle_t *); +_LIBZFS_H libzfs_handle_t *libzfs_init(void); +_LIBZFS_H void libzfs_fini(libzfs_handle_t *); -extern libzfs_handle_t *zpool_get_handle(zpool_handle_t *); -extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *); +_LIBZFS_H libzfs_handle_t *zpool_get_handle(zpool_handle_t *); +_LIBZFS_H libzfs_handle_t *zfs_get_handle(zfs_handle_t *); -extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t); +_LIBZFS_H void libzfs_print_on_error(libzfs_handle_t *, boolean_t); -extern void zfs_save_arguments(int argc, char **, char *, int); -extern int zpool_log_history(libzfs_handle_t *, const char *); +_LIBZFS_H void zfs_save_arguments(int argc, char **, char *, int); +_LIBZFS_H int zpool_log_history(libzfs_handle_t *, const char *); -extern int libzfs_errno(libzfs_handle_t *); -extern const char *libzfs_error_init(int); -extern const char *libzfs_error_action(libzfs_handle_t *); -extern const char *libzfs_error_description(libzfs_handle_t *); -extern int zfs_standard_error(libzfs_handle_t *, int, const char *); -extern void libzfs_mnttab_init(libzfs_handle_t *); -extern void libzfs_mnttab_fini(libzfs_handle_t *); -extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t); -extern int libzfs_mnttab_find(libzfs_handle_t *, const char *, +_LIBZFS_H int libzfs_errno(libzfs_handle_t *); +_LIBZFS_H const char *libzfs_error_init(int); +_LIBZFS_H const char *libzfs_error_action(libzfs_handle_t *); +_LIBZFS_H const char *libzfs_error_description(libzfs_handle_t *); +_LIBZFS_H int zfs_standard_error(libzfs_handle_t *, int, const char *); +_LIBZFS_H void libzfs_mnttab_init(libzfs_handle_t *); +_LIBZFS_H void libzfs_mnttab_fini(libzfs_handle_t *); +_LIBZFS_H void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t); +_LIBZFS_H int libzfs_mnttab_find(libzfs_handle_t *, const char *, struct mnttab *); -extern void libzfs_mnttab_add(libzfs_handle_t *, const char *, +_LIBZFS_H void libzfs_mnttab_add(libzfs_handle_t *, const char *, const char *, const char *); -extern void libzfs_mnttab_remove(libzfs_handle_t *, const char *); +_LIBZFS_H void libzfs_mnttab_remove(libzfs_handle_t *, const char *); /* * Basic handle functions */ -extern zpool_handle_t *zpool_open(libzfs_handle_t *, const char *); -extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *); -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 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 *); +_LIBZFS_H zpool_handle_t *zpool_open(libzfs_handle_t *, const char *); +_LIBZFS_H zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *); +_LIBZFS_H void zpool_close(zpool_handle_t *); +_LIBZFS_H const char *zpool_get_name(zpool_handle_t *); +_LIBZFS_H int zpool_get_state(zpool_handle_t *); +_LIBZFS_H const char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +_LIBZFS_H const char *zpool_pool_state_to_name(pool_state_t); +_LIBZFS_H void zpool_free_handles(libzfs_handle_t *); /* * Iterate over all active pools in the system. */ typedef int (*zpool_iter_f)(zpool_handle_t *, void *); -extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *); -extern boolean_t zpool_skip_pool(const char *); +_LIBZFS_H int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *); +_LIBZFS_H boolean_t zpool_skip_pool(const char *); /* * Functions to create and destroy pools */ -extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *, +_LIBZFS_H int zpool_create(libzfs_handle_t *, const char *, nvlist_t *, nvlist_t *, nvlist_t *); -extern int zpool_destroy(zpool_handle_t *, const char *); -extern int zpool_add(zpool_handle_t *, nvlist_t *); +_LIBZFS_H int zpool_destroy(zpool_handle_t *, const char *); +_LIBZFS_H int zpool_add(zpool_handle_t *, nvlist_t *); typedef struct splitflags { /* do not split, but return the config that would be split off */ @@ -281,57 +281,60 @@ typedef struct trimflags { /* * Functions to manipulate pool and vdev state */ -extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t); -extern int zpool_initialize(zpool_handle_t *, pool_initialize_func_t, +_LIBZFS_H int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t); +_LIBZFS_H int zpool_initialize(zpool_handle_t *, pool_initialize_func_t, nvlist_t *); -extern int zpool_initialize_wait(zpool_handle_t *, pool_initialize_func_t, +_LIBZFS_H int zpool_initialize_wait(zpool_handle_t *, pool_initialize_func_t, nvlist_t *); -extern int zpool_trim(zpool_handle_t *, pool_trim_func_t, nvlist_t *, +_LIBZFS_H int zpool_trim(zpool_handle_t *, pool_trim_func_t, nvlist_t *, trimflags_t *); -extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); -extern int zpool_reguid(zpool_handle_t *); -extern int zpool_reopen_one(zpool_handle_t *, void *); +_LIBZFS_H int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); +_LIBZFS_H int zpool_reguid(zpool_handle_t *); +_LIBZFS_H int zpool_reopen_one(zpool_handle_t *, void *); -extern int zpool_sync_one(zpool_handle_t *, void *); +_LIBZFS_H int zpool_sync_one(zpool_handle_t *, void *); -extern int zpool_vdev_online(zpool_handle_t *, const char *, int, +_LIBZFS_H int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); -extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); -extern int zpool_vdev_attach(zpool_handle_t *, const char *, +_LIBZFS_H int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); +_LIBZFS_H int zpool_vdev_attach(zpool_handle_t *, const char *, const char *, nvlist_t *, int, boolean_t); -extern int zpool_vdev_detach(zpool_handle_t *, const char *); -extern int zpool_vdev_remove(zpool_handle_t *, const char *); -extern int zpool_vdev_remove_cancel(zpool_handle_t *); -extern int zpool_vdev_indirect_size(zpool_handle_t *, const char *, uint64_t *); -extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *, - splitflags_t); +_LIBZFS_H int zpool_vdev_detach(zpool_handle_t *, const char *); +_LIBZFS_H int zpool_vdev_remove(zpool_handle_t *, const char *); +_LIBZFS_H int zpool_vdev_remove_cancel(zpool_handle_t *); +_LIBZFS_H int zpool_vdev_indirect_size(zpool_handle_t *, const char *, + uint64_t *); +_LIBZFS_H int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, + nvlist_t *, splitflags_t); -extern int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t); -extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t); -extern int zpool_vdev_clear(zpool_handle_t *, uint64_t); +_LIBZFS_H int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t); +_LIBZFS_H int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t); +_LIBZFS_H int zpool_vdev_clear(zpool_handle_t *, uint64_t); -extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *, +_LIBZFS_H nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, +_LIBZFS_H nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); -extern uint64_t zpool_vdev_path_to_guid(zpool_handle_t *zhp, const char *path); +_LIBZFS_H int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, + const char *); +_LIBZFS_H uint64_t zpool_vdev_path_to_guid(zpool_handle_t *zhp, + const char *path); -const char *zpool_get_state_str(zpool_handle_t *); +_LIBZFS_H const char *zpool_get_state_str(zpool_handle_t *); /* * Functions to manage pool properties */ -extern int zpool_set_prop(zpool_handle_t *, const char *, const char *); -extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, +_LIBZFS_H int zpool_set_prop(zpool_handle_t *, const char *, const char *); +_LIBZFS_H int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t proplen, zprop_source_t *, boolean_t literal); -extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t, +_LIBZFS_H uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t, zprop_source_t *); -extern int zpool_props_refresh(zpool_handle_t *); +_LIBZFS_H int zpool_props_refresh(zpool_handle_t *); -extern const char *zpool_prop_to_name(zpool_prop_t); -extern const char *zpool_prop_values(zpool_prop_t); +_LIBZFS_H const char *zpool_prop_to_name(zpool_prop_t); +_LIBZFS_H const char *zpool_prop_values(zpool_prop_t); /* * Pool health statistics. @@ -401,36 +404,36 @@ typedef enum { ZPOOL_STATUS_OK } zpool_status_t; -extern zpool_status_t zpool_get_status(zpool_handle_t *, char **, +_LIBZFS_H zpool_status_t zpool_get_status(zpool_handle_t *, char **, zpool_errata_t *); -extern zpool_status_t zpool_import_status(nvlist_t *, char **, +_LIBZFS_H zpool_status_t zpool_import_status(nvlist_t *, char **, zpool_errata_t *); /* * Statistics and configuration functions. */ -extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **); -extern nvlist_t *zpool_get_features(zpool_handle_t *); -extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); -extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **); +_LIBZFS_H nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **); +_LIBZFS_H nvlist_t *zpool_get_features(zpool_handle_t *); +_LIBZFS_H int zpool_refresh_stats(zpool_handle_t *, boolean_t *); +_LIBZFS_H int zpool_get_errlog(zpool_handle_t *, nvlist_t **); /* * Import and export functions */ -extern int zpool_export(zpool_handle_t *, boolean_t, const char *); -extern int zpool_export_force(zpool_handle_t *, const char *); -extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, +_LIBZFS_H int zpool_export(zpool_handle_t *, boolean_t, const char *); +_LIBZFS_H int zpool_export_force(zpool_handle_t *, const char *); +_LIBZFS_H int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, char *altroot); -extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, +_LIBZFS_H int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, nvlist_t *, int); -extern void zpool_print_unsup_feat(nvlist_t *config); +_LIBZFS_H void zpool_print_unsup_feat(nvlist_t *config); /* * Miscellaneous pool functions */ struct zfs_cmd; -extern const char *zfs_history_event_names[]; +_LIBZFS_H const char *zfs_history_event_names[]; typedef enum { VDEV_NAME_PATH = 1 << 0, @@ -439,39 +442,39 @@ typedef enum { VDEV_NAME_TYPE_ID = 1 << 3, } vdev_name_t; -extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, +_LIBZFS_H char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, int name_flags); -extern int zpool_upgrade(zpool_handle_t *, uint64_t); -extern int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *, +_LIBZFS_H int zpool_upgrade(zpool_handle_t *, uint64_t); +_LIBZFS_H int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *, boolean_t *); -extern int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, unsigned, +_LIBZFS_H int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, unsigned, int); -extern int zpool_events_clear(libzfs_handle_t *, int *); -extern int zpool_events_seek(libzfs_handle_t *, uint64_t, int); -extern void zpool_obj_to_path_ds(zpool_handle_t *, uint64_t, uint64_t, char *, +_LIBZFS_H int zpool_events_clear(libzfs_handle_t *, int *); +_LIBZFS_H int zpool_events_seek(libzfs_handle_t *, uint64_t, int); +_LIBZFS_H void zpool_obj_to_path_ds(zpool_handle_t *, uint64_t, uint64_t, + char *, size_t); +_LIBZFS_H void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, size_t); -extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, - size_t); -extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); -extern int zpool_get_physpath(zpool_handle_t *, char *, size_t); -extern void zpool_explain_recover(libzfs_handle_t *, const char *, int, +_LIBZFS_H int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); +_LIBZFS_H int zpool_get_physpath(zpool_handle_t *, char *, size_t); +_LIBZFS_H void zpool_explain_recover(libzfs_handle_t *, const char *, int, nvlist_t *); -extern int zpool_checkpoint(zpool_handle_t *); -extern int zpool_discard_checkpoint(zpool_handle_t *); -extern boolean_t zpool_is_draid_spare(const char *); +_LIBZFS_H int zpool_checkpoint(zpool_handle_t *); +_LIBZFS_H int zpool_discard_checkpoint(zpool_handle_t *); +_LIBZFS_H boolean_t zpool_is_draid_spare(const char *); /* * Basic handle manipulations. These functions do not create or destroy the * underlying datasets, only the references to them. */ -extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int); -extern zfs_handle_t *zfs_handle_dup(zfs_handle_t *); -extern void zfs_close(zfs_handle_t *); -extern zfs_type_t zfs_get_type(const zfs_handle_t *); -extern zfs_type_t zfs_get_underlying_type(const zfs_handle_t *); -extern const char *zfs_get_name(const zfs_handle_t *); -extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *); -extern const char *zfs_get_pool_name(const zfs_handle_t *); +_LIBZFS_H zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int); +_LIBZFS_H zfs_handle_t *zfs_handle_dup(zfs_handle_t *); +_LIBZFS_H void zfs_close(zfs_handle_t *); +_LIBZFS_H zfs_type_t zfs_get_type(const zfs_handle_t *); +_LIBZFS_H zfs_type_t zfs_get_underlying_type(const zfs_handle_t *); +_LIBZFS_H const char *zfs_get_name(const zfs_handle_t *); +_LIBZFS_H zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *); +_LIBZFS_H const char *zfs_get_pool_name(const zfs_handle_t *); /* * Property management functions. Some functions are shared with the kernel, @@ -481,58 +484,60 @@ extern const char *zfs_get_pool_name(const zfs_handle_t *); /* * zfs dataset property management */ -extern const char *zfs_prop_default_string(zfs_prop_t); -extern uint64_t zfs_prop_default_numeric(zfs_prop_t); -extern const char *zfs_prop_column_name(zfs_prop_t); -extern boolean_t zfs_prop_align_right(zfs_prop_t); +_LIBZFS_H const char *zfs_prop_default_string(zfs_prop_t); +_LIBZFS_H uint64_t zfs_prop_default_numeric(zfs_prop_t); +_LIBZFS_H const char *zfs_prop_column_name(zfs_prop_t); +_LIBZFS_H boolean_t zfs_prop_align_right(zfs_prop_t); -extern nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t, nvlist_t *, - uint64_t, zfs_handle_t *, zpool_handle_t *, boolean_t, const char *); +_LIBZFS_H nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t, + nvlist_t *, uint64_t, zfs_handle_t *, zpool_handle_t *, boolean_t, + const char *); -extern const char *zfs_prop_to_name(zfs_prop_t); -extern int zfs_prop_set(zfs_handle_t *, const char *, const char *); -extern int zfs_prop_set_list(zfs_handle_t *, nvlist_t *); -extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t, +_LIBZFS_H const char *zfs_prop_to_name(zfs_prop_t); +_LIBZFS_H int zfs_prop_set(zfs_handle_t *, const char *, const char *); +_LIBZFS_H int zfs_prop_set_list(zfs_handle_t *, nvlist_t *); +_LIBZFS_H int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t, zprop_source_t *, char *, size_t, boolean_t); -extern int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t, +_LIBZFS_H int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t, boolean_t); -extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *, +_LIBZFS_H int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *, zprop_source_t *, char *, size_t); -extern int zfs_prop_get_userquota_int(zfs_handle_t *zhp, const char *propname, - uint64_t *propvalue); -extern int zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname, +_LIBZFS_H int zfs_prop_get_userquota_int(zfs_handle_t *zhp, + const char *propname, uint64_t *propvalue); +_LIBZFS_H int zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname, char *propbuf, int proplen, boolean_t literal); -extern int zfs_prop_get_written_int(zfs_handle_t *zhp, const char *propname, +_LIBZFS_H int zfs_prop_get_written_int(zfs_handle_t *zhp, const char *propname, uint64_t *propvalue); -extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname, +_LIBZFS_H int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname, char *propbuf, int proplen, boolean_t literal); -extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname, +_LIBZFS_H int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname, char *buf, size_t len); -extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **); -extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); -extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); -extern const char *zfs_prop_values(zfs_prop_t); -extern int zfs_prop_is_string(zfs_prop_t prop); -extern nvlist_t *zfs_get_all_props(zfs_handle_t *); -extern nvlist_t *zfs_get_user_props(zfs_handle_t *); -extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *); -extern nvlist_t *zfs_get_clones_nvl(zfs_handle_t *); +_LIBZFS_H uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **); +_LIBZFS_H uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); +_LIBZFS_H int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); +_LIBZFS_H const char *zfs_prop_values(zfs_prop_t); +_LIBZFS_H int zfs_prop_is_string(zfs_prop_t prop); +_LIBZFS_H nvlist_t *zfs_get_all_props(zfs_handle_t *); +_LIBZFS_H nvlist_t *zfs_get_user_props(zfs_handle_t *); +_LIBZFS_H nvlist_t *zfs_get_recvd_props(zfs_handle_t *); +_LIBZFS_H nvlist_t *zfs_get_clones_nvl(zfs_handle_t *); -extern int zfs_wait_status(zfs_handle_t *, zfs_wait_activity_t, +_LIBZFS_H int zfs_wait_status(zfs_handle_t *, zfs_wait_activity_t, boolean_t *, boolean_t *); /* * zfs encryption management */ -extern int zfs_crypto_get_encryption_root(zfs_handle_t *, boolean_t *, char *); -extern int zfs_crypto_create(libzfs_handle_t *, char *, nvlist_t *, nvlist_t *, - boolean_t stdin_available, uint8_t **, uint_t *); -extern int zfs_crypto_clone_check(libzfs_handle_t *, zfs_handle_t *, char *, +_LIBZFS_H int zfs_crypto_get_encryption_root(zfs_handle_t *, boolean_t *, + char *); +_LIBZFS_H int zfs_crypto_create(libzfs_handle_t *, char *, nvlist_t *, + nvlist_t *, boolean_t stdin_available, uint8_t **, uint_t *); +_LIBZFS_H int zfs_crypto_clone_check(libzfs_handle_t *, zfs_handle_t *, char *, nvlist_t *); -extern int zfs_crypto_attempt_load_keys(libzfs_handle_t *, char *); -extern int zfs_crypto_load_key(zfs_handle_t *, boolean_t, char *); -extern int zfs_crypto_unload_key(zfs_handle_t *); -extern int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t); +_LIBZFS_H int zfs_crypto_attempt_load_keys(libzfs_handle_t *, char *); +_LIBZFS_H int zfs_crypto_load_key(zfs_handle_t *, boolean_t, char *); +_LIBZFS_H int zfs_crypto_unload_key(zfs_handle_t *); +_LIBZFS_H int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t); typedef struct zprop_list { int pl_prop; @@ -544,9 +549,9 @@ typedef struct zprop_list { boolean_t pl_fixed; } zprop_list_t; -extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t, +_LIBZFS_H int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t, boolean_t); -extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *); +_LIBZFS_H void zfs_prune_proplist(zfs_handle_t *, uint8_t *); #define ZFS_MOUNTPOINT_NONE "none" #define ZFS_MOUNTPOINT_LEGACY "legacy" @@ -561,22 +566,23 @@ extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *); /* * zpool property management */ -extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **, boolean_t); -extern int zpool_prop_get_feature(zpool_handle_t *, const char *, char *, +_LIBZFS_H int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **, + boolean_t); +_LIBZFS_H int zpool_prop_get_feature(zpool_handle_t *, const char *, char *, size_t); -extern const char *zpool_prop_default_string(zpool_prop_t); -extern uint64_t zpool_prop_default_numeric(zpool_prop_t); -extern const char *zpool_prop_column_name(zpool_prop_t); -extern boolean_t zpool_prop_align_right(zpool_prop_t); +_LIBZFS_H const char *zpool_prop_default_string(zpool_prop_t); +_LIBZFS_H uint64_t zpool_prop_default_numeric(zpool_prop_t); +_LIBZFS_H const char *zpool_prop_column_name(zpool_prop_t); +_LIBZFS_H boolean_t zpool_prop_align_right(zpool_prop_t); /* * Functions shared by zfs and zpool property management. */ -extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all, +_LIBZFS_H int zprop_iter(zprop_func func, void *cb, boolean_t show_all, boolean_t ordered, zfs_type_t type); -extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **, +_LIBZFS_H int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **, zfs_type_t); -extern void zprop_free_list(zprop_list_t *); +_LIBZFS_H void zprop_free_list(zprop_list_t *); #define ZFS_GET_NCOLS 5 @@ -603,7 +609,7 @@ typedef struct zprop_get_cbdata { zfs_type_t cb_type; } zprop_get_cbdata_t; -void zprop_print_one_property(const char *, zprop_get_cbdata_t *, +_LIBZFS_H void zprop_print_one_property(const char *, zprop_get_cbdata_t *, const char *, const char *, zprop_source_t, const char *, const char *); @@ -611,17 +617,19 @@ void zprop_print_one_property(const char *, zprop_get_cbdata_t *, * Iterator functions. */ typedef int (*zfs_iter_f)(zfs_handle_t *, void *); -extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); -extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, +_LIBZFS_H int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *); +_LIBZFS_H int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); +_LIBZFS_H int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, + void *); +_LIBZFS_H int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); +_LIBZFS_H int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, uint64_t, uint64_t); -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, +_LIBZFS_H int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, uint64_t, uint64_t); -extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); -extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_mounted(zfs_handle_t *, zfs_iter_f, void *); +_LIBZFS_H int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, + void *); +_LIBZFS_H int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); +_LIBZFS_H int zfs_iter_mounted(zfs_handle_t *, zfs_iter_f, void *); typedef struct get_all_cb { zfs_handle_t **cb_handles; @@ -629,24 +637,25 @@ typedef struct get_all_cb { size_t cb_used; } get_all_cb_t; -void zfs_foreach_mountpoint(libzfs_handle_t *, zfs_handle_t **, size_t, - zfs_iter_f, void *, boolean_t); -void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *); +_LIBZFS_H void zfs_foreach_mountpoint(libzfs_handle_t *, zfs_handle_t **, + size_t, zfs_iter_f, void *, boolean_t); +_LIBZFS_H void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *); /* * Functions to create and destroy datasets. */ -extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t, +_LIBZFS_H int zfs_create(libzfs_handle_t *, const char *, zfs_type_t, nvlist_t *); -extern int zfs_create_ancestors(libzfs_handle_t *, const char *); -extern int zfs_destroy(zfs_handle_t *, boolean_t); -extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t); -extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t); -extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); -extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); -extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, +_LIBZFS_H int zfs_create_ancestors(libzfs_handle_t *, const char *); +_LIBZFS_H int zfs_destroy(zfs_handle_t *, boolean_t); +_LIBZFS_H int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t); +_LIBZFS_H int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t); +_LIBZFS_H int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); +_LIBZFS_H int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, + nvlist_t *); +_LIBZFS_H int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, nvlist_t *props); -extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); +_LIBZFS_H int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); typedef struct renameflags { /* recursive rename */ @@ -659,7 +668,7 @@ typedef struct renameflags { int forceunmount : 1; } renameflags_t; -extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t); +_LIBZFS_H int zfs_rename(zfs_handle_t *, const char *, renameflags_t); typedef struct sendflags { /* Amount of extra information to print. */ @@ -716,34 +725,35 @@ typedef struct sendflags { typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); -extern int zfs_send(zfs_handle_t *, const char *, const char *, +_LIBZFS_H int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); -extern int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t *, +_LIBZFS_H int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t *, const char *); -extern int zfs_send_progress(zfs_handle_t *, int, uint64_t *, uint64_t *); -extern int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd, +_LIBZFS_H int zfs_send_progress(zfs_handle_t *, int, uint64_t *, uint64_t *); +_LIBZFS_H int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd, const char *); -extern int zfs_send_saved(zfs_handle_t *, sendflags_t *, int, const char *); -extern nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl, +_LIBZFS_H int zfs_send_saved(zfs_handle_t *, sendflags_t *, int, const char *); +_LIBZFS_H nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl, const char *token); -extern int zfs_promote(zfs_handle_t *); -extern int zfs_hold(zfs_handle_t *, const char *, const char *, +_LIBZFS_H int zfs_promote(zfs_handle_t *); +_LIBZFS_H int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t, int); -extern int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *); -extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t); -extern int zfs_get_holds(zfs_handle_t *, nvlist_t **); -extern uint64_t zvol_volsize_to_reservation(zpool_handle_t *, uint64_t, +_LIBZFS_H int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *); +_LIBZFS_H int zfs_release(zfs_handle_t *, const char *, const char *, + boolean_t); +_LIBZFS_H int zfs_get_holds(zfs_handle_t *, nvlist_t **); +_LIBZFS_H uint64_t zvol_volsize_to_reservation(zpool_handle_t *, uint64_t, nvlist_t *); typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain, uid_t rid, uint64_t space); -extern int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t, +_LIBZFS_H int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t, zfs_userspace_cb_t, void *); -extern int zfs_get_fsacl(zfs_handle_t *, nvlist_t **); -extern int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *); +_LIBZFS_H int zfs_get_fsacl(zfs_handle_t *, nvlist_t **); +_LIBZFS_H int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *); typedef struct recvflags { /* print informational messages (ie, -v was specified) */ @@ -792,7 +802,7 @@ typedef struct recvflags { boolean_t forceunmount; } recvflags_t; -extern int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *, +_LIBZFS_H int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *, recvflags_t *, int, avl_tree_t *); typedef enum diff_flags { @@ -801,71 +811,71 @@ typedef enum diff_flags { ZFS_DIFF_CLASSIFY = 0x4 } diff_flags_t; -extern int zfs_show_diffs(zfs_handle_t *, int, const char *, const char *, +_LIBZFS_H int zfs_show_diffs(zfs_handle_t *, int, const char *, const char *, int); /* * Miscellaneous functions. */ -extern const char *zfs_type_to_name(zfs_type_t); -extern void zfs_refresh_properties(zfs_handle_t *); -extern int zfs_name_valid(const char *, zfs_type_t); -extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, const char *, +_LIBZFS_H const char *zfs_type_to_name(zfs_type_t); +_LIBZFS_H void zfs_refresh_properties(zfs_handle_t *); +_LIBZFS_H int zfs_name_valid(const char *, zfs_type_t); +_LIBZFS_H zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, const char *, zfs_type_t); -extern int zfs_parent_name(zfs_handle_t *, char *, size_t); -extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *, +_LIBZFS_H int zfs_parent_name(zfs_handle_t *, char *, size_t); +_LIBZFS_H boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *, zfs_type_t); -extern int zfs_spa_version(zfs_handle_t *, int *); -extern boolean_t zfs_bookmark_exists(const char *path); +_LIBZFS_H int zfs_spa_version(zfs_handle_t *, int *); +_LIBZFS_H boolean_t zfs_bookmark_exists(const char *path); /* * Mount support functions. */ -extern boolean_t is_mounted(libzfs_handle_t *, const char *special, char **); -extern boolean_t zfs_is_mounted(zfs_handle_t *, char **); -extern int zfs_mount(zfs_handle_t *, const char *, int); -extern int zfs_mount_at(zfs_handle_t *, const char *, int, const char *); -extern int zfs_unmount(zfs_handle_t *, const char *, int); -extern int zfs_unmountall(zfs_handle_t *, int); -extern int zfs_mount_delegation_check(void); +_LIBZFS_H boolean_t is_mounted(libzfs_handle_t *, const char *special, char **); +_LIBZFS_H boolean_t zfs_is_mounted(zfs_handle_t *, char **); +_LIBZFS_H int zfs_mount(zfs_handle_t *, const char *, int); +_LIBZFS_H int zfs_mount_at(zfs_handle_t *, const char *, int, const char *); +_LIBZFS_H int zfs_unmount(zfs_handle_t *, const char *, int); +_LIBZFS_H int zfs_unmountall(zfs_handle_t *, int); +_LIBZFS_H int zfs_mount_delegation_check(void); #if defined(__linux__) -extern int zfs_parse_mount_options(char *mntopts, unsigned long *mntflags, +_LIBZFS_H int zfs_parse_mount_options(char *mntopts, unsigned long *mntflags, unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt); -extern void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint, +_LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint, char *mntopts, char *mtabopt); #endif /* * Share support functions. */ -extern boolean_t zfs_is_shared(zfs_handle_t *); -extern int zfs_share(zfs_handle_t *); -extern int zfs_unshare(zfs_handle_t *); +_LIBZFS_H boolean_t zfs_is_shared(zfs_handle_t *); +_LIBZFS_H int zfs_share(zfs_handle_t *); +_LIBZFS_H int zfs_unshare(zfs_handle_t *); /* * Protocol-specific share support functions. */ -extern boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **); -extern boolean_t zfs_is_shared_smb(zfs_handle_t *, char **); -extern int zfs_share_nfs(zfs_handle_t *); -extern int zfs_share_smb(zfs_handle_t *); -extern int zfs_shareall(zfs_handle_t *); -extern int zfs_unshare_nfs(zfs_handle_t *, const char *); -extern int zfs_unshare_smb(zfs_handle_t *, const char *); -extern int zfs_unshareall_nfs(zfs_handle_t *); -extern int zfs_unshareall_smb(zfs_handle_t *); -extern int zfs_unshareall_bypath(zfs_handle_t *, const char *); -extern int zfs_unshareall_bytype(zfs_handle_t *, const char *, const char *); -extern int zfs_unshareall(zfs_handle_t *); -extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *, +_LIBZFS_H boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **); +_LIBZFS_H boolean_t zfs_is_shared_smb(zfs_handle_t *, char **); +_LIBZFS_H int zfs_share_nfs(zfs_handle_t *); +_LIBZFS_H int zfs_share_smb(zfs_handle_t *); +_LIBZFS_H int zfs_shareall(zfs_handle_t *); +_LIBZFS_H int zfs_unshare_nfs(zfs_handle_t *, const char *); +_LIBZFS_H int zfs_unshare_smb(zfs_handle_t *, const char *); +_LIBZFS_H int zfs_unshareall_nfs(zfs_handle_t *); +_LIBZFS_H int zfs_unshareall_smb(zfs_handle_t *); +_LIBZFS_H int zfs_unshareall_bypath(zfs_handle_t *, const char *); +_LIBZFS_H int zfs_unshareall_bytype(zfs_handle_t *, const char *, const char *); +_LIBZFS_H int zfs_unshareall(zfs_handle_t *); +_LIBZFS_H int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *, void *, void *, int, zfs_share_op_t); -extern void zfs_commit_nfs_shares(void); -extern void zfs_commit_smb_shares(void); -extern void zfs_commit_all_shares(void); -extern void zfs_commit_shares(const char *); +_LIBZFS_H void zfs_commit_nfs_shares(void); +_LIBZFS_H void zfs_commit_smb_shares(void); +_LIBZFS_H void zfs_commit_all_shares(void); +_LIBZFS_H void zfs_commit_shares(const char *); -extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); +_LIBZFS_H int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); /* * Utility functions to run an external process. @@ -874,51 +884,52 @@ extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); #define STDERR_VERBOSE 0x02 #define NO_DEFAULT_PATH 0x04 /* Don't use $PATH to lookup the command */ -int libzfs_run_process(const char *, char **, int); -int libzfs_run_process_get_stdout(const char *, char *[], char *[], - char **[], int *); -int libzfs_run_process_get_stdout_nopath(const char *, char *[], char *[], +_LIBZFS_H int libzfs_run_process(const char *, char **, int); +_LIBZFS_H int libzfs_run_process_get_stdout(const char *, char *[], char *[], char **[], int *); +_LIBZFS_H int libzfs_run_process_get_stdout_nopath(const char *, char *[], + char *[], char **[], int *); -void libzfs_free_str_array(char **, int); +_LIBZFS_H void libzfs_free_str_array(char **, int); -int libzfs_envvar_is_set(char *); +_LIBZFS_H int libzfs_envvar_is_set(char *); /* * Utility functions for zfs version */ -extern void zfs_version_userland(char *, int); -extern int zfs_version_kernel(char *, int); -extern int zfs_version_print(void); +_LIBZFS_H void zfs_version_userland(char *, int); +_LIBZFS_H int zfs_version_kernel(char *, int); +_LIBZFS_H int zfs_version_print(void); /* * Given a device or file, determine if it is part of a pool. */ -extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **, +_LIBZFS_H int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **, boolean_t *); /* * Label manipulation. */ -extern int zpool_clear_label(int); -extern int zpool_set_bootenv(zpool_handle_t *, const nvlist_t *); -extern int zpool_get_bootenv(zpool_handle_t *, nvlist_t **); +_LIBZFS_H int zpool_clear_label(int); +_LIBZFS_H int zpool_set_bootenv(zpool_handle_t *, const nvlist_t *); +_LIBZFS_H int zpool_get_bootenv(zpool_handle_t *, nvlist_t **); /* * Management interfaces for SMB ACL files */ -int zfs_smb_acl_add(libzfs_handle_t *, char *, char *, char *); -int zfs_smb_acl_remove(libzfs_handle_t *, char *, char *, char *); -int zfs_smb_acl_purge(libzfs_handle_t *, char *, char *); -int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *); +_LIBZFS_H int zfs_smb_acl_add(libzfs_handle_t *, char *, char *, char *); +_LIBZFS_H int zfs_smb_acl_remove(libzfs_handle_t *, char *, char *, char *); +_LIBZFS_H int zfs_smb_acl_purge(libzfs_handle_t *, char *, char *); +_LIBZFS_H int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, + char *); /* * Enable and disable datasets within a pool by mounting/unmounting and * sharing/unsharing them. */ -extern int zpool_enable_datasets(zpool_handle_t *, const char *, int); -extern int zpool_disable_datasets(zpool_handle_t *, boolean_t); +_LIBZFS_H int zpool_enable_datasets(zpool_handle_t *, const char *, int); +_LIBZFS_H int zpool_disable_datasets(zpool_handle_t *, boolean_t); /* * Parse a features file for -o compatibility @@ -931,7 +942,7 @@ typedef enum { ZPOOL_COMPATIBILITY_NOFILES } zpool_compat_status_t; -extern zpool_compat_status_t zpool_load_compat(const char *, +_LIBZFS_H zpool_compat_status_t zpool_load_compat(const char *, boolean_t *, char *, size_t); #ifdef __FreeBSD__ @@ -939,12 +950,13 @@ extern zpool_compat_status_t zpool_load_compat(const char *, /* * Attach/detach the given filesystem to/from the given jail. */ -extern int zfs_jail(zfs_handle_t *zhp, int jailid, int attach); +_LIBZFS_H int zfs_jail(zfs_handle_t *zhp, int jailid, int attach); /* * Set loader options for next boot. */ -extern int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t, const char *); +_LIBZFS_H int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t, + const char *); #endif /* __FreeBSD__ */ diff --git a/include/libzutil.h b/include/libzutil.h index 82a802678..5b0927961 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -24,7 +24,7 @@ */ #ifndef _LIBZUTIL_H -#define _LIBZUTIL_H +#define _LIBZUTIL_H extern __attribute__((visibility("default"))) #include #include @@ -56,8 +56,8 @@ typedef const struct pool_config_ops { /* * An instance of pool_config_ops_t is expected in the caller's binary. */ -extern const pool_config_ops_t libzfs_config_ops; -extern const pool_config_ops_t libzpool_config_ops; +_LIBZUTIL_H const pool_config_ops_t libzfs_config_ops; +_LIBZUTIL_H const pool_config_ops_t libzpool_config_ops; typedef struct importargs { char **path; /* a list of paths to search */ @@ -70,21 +70,21 @@ typedef struct importargs { nvlist_t *policy; /* load policy (max txg, rewind, etc.) */ } importargs_t; -extern nvlist_t *zpool_search_import(void *, importargs_t *, - const pool_config_ops_t *); -extern int zpool_find_config(void *, const char *, nvlist_t **, importargs_t *, +_LIBZUTIL_H nvlist_t *zpool_search_import(void *, importargs_t *, const pool_config_ops_t *); +_LIBZUTIL_H int zpool_find_config(void *, const char *, nvlist_t **, + importargs_t *, const pool_config_ops_t *); -extern const char * const * zpool_default_search_paths(size_t *count); -extern int zpool_read_label(int, nvlist_t **, int *); -extern int zpool_label_disk_wait(const char *, int); +_LIBZUTIL_H const char * const * zpool_default_search_paths(size_t *count); +_LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *); +_LIBZUTIL_H int zpool_label_disk_wait(const char *, int); struct udev_device; -extern int zfs_device_get_devid(struct udev_device *, char *, size_t); -extern int zfs_device_get_physical(struct udev_device *, char *, size_t); +_LIBZUTIL_H int zfs_device_get_devid(struct udev_device *, char *, size_t); +_LIBZUTIL_H int zfs_device_get_physical(struct udev_device *, char *, size_t); -extern void update_vdev_config_dev_strs(nvlist_t *); +_LIBZUTIL_H void update_vdev_config_dev_strs(nvlist_t *); /* * Default device paths @@ -93,23 +93,24 @@ extern void update_vdev_config_dev_strs(nvlist_t *); #define UDISK_ROOT "/dev/disk" #define ZVOL_ROOT "/dev/zvol" -extern int zfs_append_partition(char *path, size_t max_len); -extern int zfs_resolve_shortname(const char *name, char *path, size_t pathlen); +_LIBZUTIL_H int zfs_append_partition(char *path, size_t max_len); +_LIBZUTIL_H int zfs_resolve_shortname(const char *name, char *path, + size_t pathlen); -extern char *zfs_strip_partition(char *); -extern char *zfs_strip_path(char *); +_LIBZUTIL_H char *zfs_strip_partition(char *); +_LIBZUTIL_H char *zfs_strip_path(char *); -extern int zfs_strcmp_pathname(const char *, const char *, int); +_LIBZUTIL_H int zfs_strcmp_pathname(const char *, const char *, int); -extern boolean_t zfs_dev_is_dm(const char *); -extern boolean_t zfs_dev_is_whole_disk(const char *); -extern int zfs_dev_flush(int); -extern char *zfs_get_underlying_path(const char *); -extern char *zfs_get_enclosure_sysfs_path(const char *); +_LIBZUTIL_H boolean_t zfs_dev_is_dm(const char *); +_LIBZUTIL_H boolean_t zfs_dev_is_whole_disk(const char *); +_LIBZUTIL_H int zfs_dev_flush(int); +_LIBZUTIL_H char *zfs_get_underlying_path(const char *); +_LIBZUTIL_H char *zfs_get_enclosure_sysfs_path(const char *); -extern boolean_t is_mpath_whole_disk(const char *); +_LIBZUTIL_H boolean_t is_mpath_whole_disk(const char *); -extern boolean_t zfs_isnumber(const char *); +_LIBZUTIL_H boolean_t zfs_isnumber(const char *); /* * Formats for iostat numbers. Examples: "12K", "30ms", "4B", "2321234", "-". @@ -131,21 +132,21 @@ enum zfs_nicenum_format { /* * Convert a number to a human-readable form. */ -extern void zfs_nicebytes(uint64_t, char *, size_t); -extern void zfs_nicenum(uint64_t, char *, size_t); -extern void zfs_nicenum_format(uint64_t, char *, size_t, +_LIBZUTIL_H void zfs_nicebytes(uint64_t, char *, size_t); +_LIBZUTIL_H void zfs_nicenum(uint64_t, char *, size_t); +_LIBZUTIL_H void zfs_nicenum_format(uint64_t, char *, size_t, enum zfs_nicenum_format); -extern void zfs_nicetime(uint64_t, char *, size_t); -extern void zfs_niceraw(uint64_t, char *, size_t); +_LIBZUTIL_H void zfs_nicetime(uint64_t, char *, size_t); +_LIBZUTIL_H void zfs_niceraw(uint64_t, char *, size_t); #define nicenum(num, buf, size) zfs_nicenum(num, buf, size) -extern void zpool_dump_ddt(const ddt_stat_t *, const ddt_histogram_t *); -extern int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***, +_LIBZUTIL_H void zpool_dump_ddt(const ddt_stat_t *, const ddt_histogram_t *); +_LIBZUTIL_H int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***, uint_t *); struct zfs_cmd; -int zfs_ioctl_fd(int fd, unsigned long request, struct zfs_cmd *zc); +_LIBZUTIL_H int zfs_ioctl_fd(int fd, unsigned long request, struct zfs_cmd *zc); /* * List of colors to use @@ -155,9 +156,9 @@ int zfs_ioctl_fd(int fd, unsigned long request, struct zfs_cmd *zc); #define ANSI_RESET "\033[0m" #define ANSI_BOLD "\033[1m" -void color_start(char *color); -void color_end(void); -int printf_color(char *color, char *format, ...); +_LIBZUTIL_H void color_start(char *color); +_LIBZUTIL_H void color_end(void); +_LIBZUTIL_H int printf_color(char *color, char *format, ...); #ifdef __cplusplus } diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index 254750642..5d4375059 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -32,7 +32,7 @@ */ #ifndef _SYS_FS_ZFS_H -#define _SYS_FS_ZFS_H +#define _SYS_FS_ZFS_H extern __attribute__((visibility("default"))) #include #include @@ -205,7 +205,7 @@ typedef enum { ZFS_NUM_USERQUOTA_PROPS } zfs_userquota_prop_t; -extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; +_SYS_FS_ZFS_H const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; /* * Pool properties are identified by these constants and must be added to the @@ -301,38 +301,41 @@ typedef int (*zprop_func)(int, void *); /* * Dataset property functions shared between libzfs and kernel. */ -const char *zfs_prop_default_string(zfs_prop_t); -uint64_t zfs_prop_default_numeric(zfs_prop_t); -boolean_t zfs_prop_readonly(zfs_prop_t); -boolean_t zfs_prop_visible(zfs_prop_t prop); -boolean_t zfs_prop_inheritable(zfs_prop_t); -boolean_t zfs_prop_setonce(zfs_prop_t); -boolean_t zfs_prop_encryption_key_param(zfs_prop_t); -boolean_t zfs_prop_valid_keylocation(const char *, boolean_t); -const char *zfs_prop_to_name(zfs_prop_t); -zfs_prop_t zfs_name_to_prop(const char *); -boolean_t zfs_prop_user(const char *); -boolean_t zfs_prop_userquota(const char *); -boolean_t zfs_prop_written(const char *); -int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); -int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); -uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed); -boolean_t zfs_prop_valid_for_type(int, zfs_type_t, boolean_t); +_SYS_FS_ZFS_H const char *zfs_prop_default_string(zfs_prop_t); +_SYS_FS_ZFS_H uint64_t zfs_prop_default_numeric(zfs_prop_t); +_SYS_FS_ZFS_H boolean_t zfs_prop_readonly(zfs_prop_t); +_SYS_FS_ZFS_H boolean_t zfs_prop_visible(zfs_prop_t prop); +_SYS_FS_ZFS_H boolean_t zfs_prop_inheritable(zfs_prop_t); +_SYS_FS_ZFS_H boolean_t zfs_prop_setonce(zfs_prop_t); +_SYS_FS_ZFS_H boolean_t zfs_prop_encryption_key_param(zfs_prop_t); +_SYS_FS_ZFS_H boolean_t zfs_prop_valid_keylocation(const char *, boolean_t); +_SYS_FS_ZFS_H const char *zfs_prop_to_name(zfs_prop_t); +_SYS_FS_ZFS_H zfs_prop_t zfs_name_to_prop(const char *); +_SYS_FS_ZFS_H boolean_t zfs_prop_user(const char *); +_SYS_FS_ZFS_H boolean_t zfs_prop_userquota(const char *); +_SYS_FS_ZFS_H boolean_t zfs_prop_written(const char *); +_SYS_FS_ZFS_H int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); +_SYS_FS_ZFS_H int zfs_prop_string_to_index(zfs_prop_t, const char *, + uint64_t *); +_SYS_FS_ZFS_H uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed); +_SYS_FS_ZFS_H boolean_t zfs_prop_valid_for_type(int, zfs_type_t, boolean_t); /* * Pool property functions shared between libzfs and kernel. */ -zpool_prop_t zpool_name_to_prop(const char *); -const char *zpool_prop_to_name(zpool_prop_t); -const char *zpool_prop_default_string(zpool_prop_t); -uint64_t zpool_prop_default_numeric(zpool_prop_t); -boolean_t zpool_prop_readonly(zpool_prop_t); -boolean_t zpool_prop_setonce(zpool_prop_t); -boolean_t zpool_prop_feature(const char *); -boolean_t zpool_prop_unsupported(const char *); -int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); -int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); -uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); +_SYS_FS_ZFS_H zpool_prop_t zpool_name_to_prop(const char *); +_SYS_FS_ZFS_H const char *zpool_prop_to_name(zpool_prop_t); +_SYS_FS_ZFS_H const char *zpool_prop_default_string(zpool_prop_t); +_SYS_FS_ZFS_H uint64_t zpool_prop_default_numeric(zpool_prop_t); +_SYS_FS_ZFS_H boolean_t zpool_prop_readonly(zpool_prop_t); +_SYS_FS_ZFS_H boolean_t zpool_prop_setonce(zpool_prop_t); +_SYS_FS_ZFS_H boolean_t zpool_prop_feature(const char *); +_SYS_FS_ZFS_H boolean_t zpool_prop_unsupported(const char *); +_SYS_FS_ZFS_H int zpool_prop_index_to_string(zpool_prop_t, uint64_t, + const char **); +_SYS_FS_ZFS_H int zpool_prop_string_to_index(zpool_prop_t, const char *, + uint64_t *); +_SYS_FS_ZFS_H uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); /* * Definitions for the Delegation. diff --git a/include/sys/zfs_sysfs.h b/include/sys/zfs_sysfs.h index 925d7ad54..14ba61fc4 100644 --- a/include/sys/zfs_sysfs.h +++ b/include/sys/zfs_sysfs.h @@ -23,7 +23,7 @@ */ #ifndef _SYS_ZFS_SYSFS_H -#define _SYS_ZFS_SYSFS_H +#define _SYS_ZFS_SYSFS_H extern __attribute__((visibility("default"))) #ifdef _KERNEL @@ -35,7 +35,7 @@ void zfs_sysfs_fini(void); #define zfs_sysfs_init() #define zfs_sysfs_fini() -boolean_t zfs_mod_supported(const char *, const char *); +_SYS_ZFS_SYSFS_H boolean_t zfs_mod_supported(const char *, const char *); #endif #define ZFS_SYSFS_POOL_PROPERTIES "properties.pool" diff --git a/include/sys/zio_checksum.h b/include/sys/zio_checksum.h index 45abd3bd3..9a73a6262 100644 --- a/include/sys/zio_checksum.h +++ b/include/sys/zio_checksum.h @@ -25,7 +25,7 @@ */ #ifndef _SYS_ZIO_CHECKSUM_H -#define _SYS_ZIO_CHECKSUM_H +#define _SYS_ZIO_CHECKSUM_H extern __attribute__((visibility("default"))) #include #include @@ -101,7 +101,8 @@ typedef struct zio_bad_cksum { uint8_t zbc_has_cksum; /* expected/actual valid */ } zio_bad_cksum_t; -extern zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS]; +_SYS_ZIO_CHECKSUM_H zio_checksum_info_t + zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS]; /* * Checksum routines. @@ -122,7 +123,7 @@ extern zio_checksum_t abd_checksum_edonr_byteswap; extern zio_checksum_tmpl_init_t abd_checksum_edonr_tmpl_init; extern zio_checksum_tmpl_free_t abd_checksum_edonr_tmpl_free; -extern zio_abd_checksum_func_t fletcher_4_abd_ops; +_SYS_ZIO_CHECKSUM_H zio_abd_checksum_func_t fletcher_4_abd_ops; extern zio_checksum_t abd_fletcher_4_native; extern zio_checksum_t abd_fletcher_4_byteswap; diff --git a/include/zfeature_common.h b/include/zfeature_common.h index 76dd7ed57..874cbd9ff 100644 --- a/include/zfeature_common.h +++ b/include/zfeature_common.h @@ -27,7 +27,7 @@ */ #ifndef _ZFEATURE_COMMON_H -#define _ZFEATURE_COMMON_H +#define _ZFEATURE_COMMON_H extern __attribute__((visibility("default"))) #include #include @@ -116,16 +116,17 @@ typedef int (zfeature_func_t)(zfeature_info_t *, void *); #define ZFS_FEATURE_DEBUG -extern zfeature_info_t spa_feature_table[SPA_FEATURES]; +_ZFEATURE_COMMON_H zfeature_info_t spa_feature_table[SPA_FEATURES]; +_ZFEATURE_COMMON_H boolean_t zfeature_checks_disable; -extern boolean_t zfeature_is_valid_guid(const char *); +_ZFEATURE_COMMON_H boolean_t zfeature_is_valid_guid(const char *); -extern boolean_t zfeature_is_supported(const char *); -extern int zfeature_lookup_guid(const char *, spa_feature_t *); -extern int zfeature_lookup_name(const char *, spa_feature_t *); -extern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); +_ZFEATURE_COMMON_H boolean_t zfeature_is_supported(const char *); +_ZFEATURE_COMMON_H int zfeature_lookup_guid(const char *, spa_feature_t *); +_ZFEATURE_COMMON_H int zfeature_lookup_name(const char *, spa_feature_t *); +_ZFEATURE_COMMON_H boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); -extern void zpool_feature_init(void); +_ZFEATURE_COMMON_H void zpool_feature_init(void); #ifdef __cplusplus } diff --git a/include/zfs_comutil.h b/include/zfs_comutil.h index 17b07d9e4..3e4716224 100644 --- a/include/zfs_comutil.h +++ b/include/zfs_comutil.h @@ -24,7 +24,7 @@ */ #ifndef _ZFS_COMUTIL_H -#define _ZFS_COMUTIL_H +#define _ZFS_COMUTIL_H extern __attribute__((visibility("default"))) #include #include @@ -33,17 +33,18 @@ extern "C" { #endif -extern boolean_t zfs_allocatable_devs(nvlist_t *); -extern boolean_t zfs_special_devs(nvlist_t *, char *); -extern void zpool_get_load_policy(nvlist_t *, zpool_load_policy_t *); +_ZFS_COMUTIL_H boolean_t zfs_allocatable_devs(nvlist_t *); +_ZFS_COMUTIL_H boolean_t zfs_special_devs(nvlist_t *, char *); +_ZFS_COMUTIL_H void zpool_get_load_policy(nvlist_t *, zpool_load_policy_t *); -extern int zfs_zpl_version_map(int spa_version); -extern int zfs_spa_version_map(int zpl_version); +_ZFS_COMUTIL_H int zfs_zpl_version_map(int spa_version); +_ZFS_COMUTIL_H int zfs_spa_version_map(int zpl_version); -extern boolean_t zfs_dataset_name_hidden(const char *); +_ZFS_COMUTIL_H boolean_t zfs_dataset_name_hidden(const char *); #define ZFS_NUM_LEGACY_HISTORY_EVENTS 41 -extern const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS]; +_ZFS_COMUTIL_H const char * + zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS]; #ifdef __cplusplus } diff --git a/include/zfs_deleg.h b/include/zfs_deleg.h index 5738b2a73..1ae08850f 100644 --- a/include/zfs_deleg.h +++ b/include/zfs_deleg.h @@ -25,7 +25,7 @@ */ #ifndef _ZFS_DELEG_H -#define _ZFS_DELEG_H +#define _ZFS_DELEG_H extern __attribute__((visibility("default"))) #include @@ -85,12 +85,12 @@ typedef struct zfs_deleg_perm_tab { zfs_deleg_note_t z_note; } zfs_deleg_perm_tab_t; -extern zfs_deleg_perm_tab_t zfs_deleg_perm_tab[]; +_ZFS_DELEG_H zfs_deleg_perm_tab_t zfs_deleg_perm_tab[]; -int zfs_deleg_verify_nvlist(nvlist_t *nvlist); -void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type, +_ZFS_DELEG_H int zfs_deleg_verify_nvlist(nvlist_t *nvlist); +_ZFS_DELEG_H void zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type, char checkflag, void *data); -const char *zfs_deleg_canonicalize_perm(const char *perm); +_ZFS_DELEG_H const char *zfs_deleg_canonicalize_perm(const char *perm); #ifdef __cplusplus } diff --git a/include/zfs_fletcher.h b/include/zfs_fletcher.h index 9e8b2cf7c..bb356c59a 100644 --- a/include/zfs_fletcher.h +++ b/include/zfs_fletcher.h @@ -27,7 +27,7 @@ */ #ifndef _ZFS_FLETCHER_H -#define _ZFS_FLETCHER_H +#define _ZFS_FLETCHER_H extern __attribute__((visibility("default"))) #include #include @@ -48,19 +48,24 @@ extern "C" { * checksum method is added. This method will ignore last (size % 4) bytes of * the data buffer. */ -void fletcher_init(zio_cksum_t *); -void fletcher_2_native(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_2_byteswap(const void *, uint64_t, const void *, zio_cksum_t *); -void fletcher_4_native(const void *, uint64_t, const void *, zio_cksum_t *); -int fletcher_2_incremental_native(void *, size_t, void *); -int fletcher_2_incremental_byteswap(void *, size_t, void *); -void fletcher_4_native_varsize(const void *, uint64_t, zio_cksum_t *); -void fletcher_4_byteswap(const void *, uint64_t, const void *, zio_cksum_t *); -int fletcher_4_incremental_native(void *, size_t, void *); -int fletcher_4_incremental_byteswap(void *, size_t, void *); -int fletcher_4_impl_set(const char *selector); -void fletcher_4_init(void); -void fletcher_4_fini(void); +_ZFS_FLETCHER_H void fletcher_init(zio_cksum_t *); +_ZFS_FLETCHER_H void fletcher_2_native(const void *, uint64_t, const void *, + zio_cksum_t *); +_ZFS_FLETCHER_H void fletcher_2_byteswap(const void *, uint64_t, const void *, + zio_cksum_t *); +_ZFS_FLETCHER_H void fletcher_4_native(const void *, uint64_t, const void *, + zio_cksum_t *); +_ZFS_FLETCHER_H int fletcher_2_incremental_native(void *, size_t, void *); +_ZFS_FLETCHER_H int fletcher_2_incremental_byteswap(void *, size_t, void *); +_ZFS_FLETCHER_H void fletcher_4_native_varsize(const void *, uint64_t, + zio_cksum_t *); +_ZFS_FLETCHER_H void fletcher_4_byteswap(const void *, uint64_t, const void *, + zio_cksum_t *); +_ZFS_FLETCHER_H int fletcher_4_incremental_native(void *, size_t, void *); +_ZFS_FLETCHER_H int fletcher_4_incremental_byteswap(void *, size_t, void *); +_ZFS_FLETCHER_H int fletcher_4_impl_set(const char *selector); +_ZFS_FLETCHER_H void fletcher_4_init(void); +_ZFS_FLETCHER_H void fletcher_4_fini(void); @@ -124,31 +129,31 @@ typedef struct fletcher_4_func { const char *name; } fletcher_4_ops_t; -extern const fletcher_4_ops_t fletcher_4_superscalar_ops; -extern const fletcher_4_ops_t fletcher_4_superscalar4_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_superscalar_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_superscalar4_ops; #if defined(HAVE_SSE2) -extern const fletcher_4_ops_t fletcher_4_sse2_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_sse2_ops; #endif #if defined(HAVE_SSE2) && defined(HAVE_SSSE3) -extern const fletcher_4_ops_t fletcher_4_ssse3_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_ssse3_ops; #endif #if defined(HAVE_AVX) && defined(HAVE_AVX2) -extern const fletcher_4_ops_t fletcher_4_avx2_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_avx2_ops; #endif #if defined(__x86_64) && defined(HAVE_AVX512F) -extern const fletcher_4_ops_t fletcher_4_avx512f_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_avx512f_ops; #endif #if defined(__x86_64) && defined(HAVE_AVX512BW) -extern const fletcher_4_ops_t fletcher_4_avx512bw_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_avx512bw_ops; #endif #if defined(__aarch64__) -extern const fletcher_4_ops_t fletcher_4_aarch64_neon_ops; +_ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_aarch64_neon_ops; #endif #ifdef __cplusplus diff --git a/include/zfs_namecheck.h b/include/zfs_namecheck.h index 197c40b56..4739b065c 100644 --- a/include/zfs_namecheck.h +++ b/include/zfs_namecheck.h @@ -27,7 +27,7 @@ */ #ifndef _ZFS_NAMECHECK_H -#define _ZFS_NAMECHECK_H +#define _ZFS_NAMECHECK_H extern __attribute__((visibility("default"))) #ifdef __cplusplus extern "C" { @@ -51,18 +51,22 @@ typedef enum { #define ZFS_PERMSET_MAXLEN 64 -extern int zfs_max_dataset_nesting; +_ZFS_NAMECHECK_H int zfs_max_dataset_nesting; -int get_dataset_depth(const char *); -int pool_namecheck(const char *, namecheck_err_t *, char *); -int entity_namecheck(const char *, namecheck_err_t *, char *); -int dataset_namecheck(const char *, namecheck_err_t *, char *); -int snapshot_namecheck(const char *, namecheck_err_t *, char *); -int bookmark_namecheck(const char *, namecheck_err_t *, char *); -int dataset_nestcheck(const char *); -int mountpoint_namecheck(const char *, namecheck_err_t *); -int zfs_component_namecheck(const char *, namecheck_err_t *, char *); -int permset_namecheck(const char *, namecheck_err_t *, char *); +_ZFS_NAMECHECK_H int get_dataset_depth(const char *); +_ZFS_NAMECHECK_H int pool_namecheck(const char *, namecheck_err_t *, char *); +_ZFS_NAMECHECK_H int entity_namecheck(const char *, namecheck_err_t *, char *); +_ZFS_NAMECHECK_H int dataset_namecheck(const char *, namecheck_err_t *, char *); +_ZFS_NAMECHECK_H int snapshot_namecheck(const char *, namecheck_err_t *, + char *); +_ZFS_NAMECHECK_H int bookmark_namecheck(const char *, namecheck_err_t *, + char *); +_ZFS_NAMECHECK_H int dataset_nestcheck(const char *); +_ZFS_NAMECHECK_H int mountpoint_namecheck(const char *, namecheck_err_t *); +_ZFS_NAMECHECK_H int zfs_component_namecheck(const char *, namecheck_err_t *, + char *); +_ZFS_NAMECHECK_H int permset_namecheck(const char *, namecheck_err_t *, + char *); #ifdef __cplusplus } diff --git a/include/zfs_prop.h b/include/zfs_prop.h index 89b6a2024..91b5032e7 100644 --- a/include/zfs_prop.h +++ b/include/zfs_prop.h @@ -24,7 +24,7 @@ */ #ifndef _ZFS_PROP_H -#define _ZFS_PROP_H +#define _ZFS_PROP_H extern __attribute__((visibility("default"))) #include #include @@ -87,44 +87,46 @@ typedef struct { /* * zfs dataset property functions */ -void zfs_prop_init(void); -zprop_type_t zfs_prop_get_type(zfs_prop_t); -boolean_t zfs_prop_delegatable(zfs_prop_t prop); -zprop_desc_t *zfs_prop_get_table(void); +_ZFS_PROP_H void zfs_prop_init(void); +_ZFS_PROP_H zprop_type_t zfs_prop_get_type(zfs_prop_t); +_ZFS_PROP_H boolean_t zfs_prop_delegatable(zfs_prop_t prop); +_ZFS_PROP_H zprop_desc_t *zfs_prop_get_table(void); /* * zpool property functions */ -void zpool_prop_init(void); -zprop_type_t zpool_prop_get_type(zpool_prop_t); -zprop_desc_t *zpool_prop_get_table(void); +_ZFS_PROP_H void zpool_prop_init(void); +_ZFS_PROP_H zprop_type_t zpool_prop_get_type(zpool_prop_t); +_ZFS_PROP_H zprop_desc_t *zpool_prop_get_table(void); /* * Common routines to initialize property tables */ -void zprop_register_impl(int, const char *, zprop_type_t, uint64_t, +_ZFS_PROP_H void zprop_register_impl(int, const char *, zprop_type_t, uint64_t, const char *, zprop_attr_t, int, const char *, const char *, boolean_t, boolean_t, const zprop_index_t *); -void zprop_register_string(int, const char *, const char *, +_ZFS_PROP_H void zprop_register_string(int, const char *, const char *, zprop_attr_t attr, int, const char *, const char *); -void zprop_register_number(int, const char *, uint64_t, zprop_attr_t, int, - const char *, const char *); -void zprop_register_index(int, const char *, uint64_t, zprop_attr_t, int, - const char *, const char *, const zprop_index_t *); -void zprop_register_hidden(int, const char *, zprop_type_t, zprop_attr_t, - int, const char *); +_ZFS_PROP_H void zprop_register_number(int, const char *, uint64_t, + zprop_attr_t, int, const char *, const char *); +_ZFS_PROP_H void zprop_register_index(int, const char *, uint64_t, zprop_attr_t, + int, const char *, const char *, const zprop_index_t *); +_ZFS_PROP_H void zprop_register_hidden(int, const char *, zprop_type_t, + zprop_attr_t, int, const char *); /* * Common routines for zfs and zpool property management */ -int zprop_iter_common(zprop_func, void *, boolean_t, boolean_t, zfs_type_t); -int zprop_name_to_prop(const char *, zfs_type_t); -int zprop_string_to_index(int, const char *, uint64_t *, zfs_type_t); -int zprop_index_to_string(int, uint64_t, const char **, zfs_type_t); -uint64_t zprop_random_value(int, uint64_t, zfs_type_t); -const char *zprop_values(int, zfs_type_t); -size_t zprop_width(int, boolean_t *, zfs_type_t); -boolean_t zprop_valid_for_type(int, zfs_type_t, boolean_t); +_ZFS_PROP_H int zprop_iter_common(zprop_func, void *, boolean_t, boolean_t, + zfs_type_t); +_ZFS_PROP_H int zprop_name_to_prop(const char *, zfs_type_t); +_ZFS_PROP_H int zprop_string_to_index(int, const char *, uint64_t *, + zfs_type_t); +_ZFS_PROP_H int zprop_index_to_string(int, uint64_t, const char **, zfs_type_t); +_ZFS_PROP_H uint64_t zprop_random_value(int, uint64_t, zfs_type_t); +_ZFS_PROP_H const char *zprop_values(int, zfs_type_t); +_ZFS_PROP_H size_t zprop_width(int, boolean_t *, zfs_type_t); +_ZFS_PROP_H boolean_t zprop_valid_for_type(int, zfs_type_t, boolean_t); #ifdef __cplusplus } diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 9385eb1aa..e3527ffe7 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -8,6 +8,7 @@ VPATH = \ # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) +AM_CFLAGS += -fvisibility=hidden pkgconfig_DATA = libzfs.pc diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 74465c365..3dd8b2b14 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -11,31 +11,13 @@ - - - - - - - - - - - - - - - - - - @@ -52,8 +34,6 @@ - - @@ -65,7 +45,6 @@ - @@ -76,19 +55,11 @@ - - - - - - - - @@ -96,28 +67,18 @@ - - - - - - - - - - @@ -138,9 +99,6 @@ - - - @@ -159,11 +117,9 @@ - - @@ -184,7 +140,6 @@ - @@ -223,7 +178,6 @@ - @@ -237,10 +191,8 @@ - - @@ -254,14 +206,11 @@ - - - @@ -270,7 +219,6 @@ - @@ -285,7 +233,7 @@ - + @@ -322,14 +270,11 @@ - - - @@ -352,18 +297,14 @@ - - - - @@ -380,14 +321,12 @@ - - @@ -411,10 +350,6 @@ - - - - @@ -424,45 +359,441 @@ - - + + + + + + + + + + + + + + + + + + + + + - - - - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -562,450 +893,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -1013,615 +902,571 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + - - - - + + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + - - - - - + + + + + - - - - - + + + + + - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - + + + + + + + + + + + + + - - - + + + + + - - - - - + + + - - - - + + + + - - - - - + + + + + - - - + + + + + + - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + - - - - - - - + + + + + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + - + - + - + - + - + - + - - - - + + + + @@ -1652,115 +1497,117 @@ - - - - - - + + + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + @@ -1797,623 +1644,616 @@ - - - + + + + + + + + + + + - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - + + + + + - - - - - - - + + + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - + + - - - - - - + + + + + + + + + + + + + - - - - - - - + + + - - + + + + + + + + + + + - - - - + + + - - - + + + - - - - + + + + + - - - - + + + + + - - - - + + - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + - - - + + + - - - + + + - - + + - - - + + + - - - - - + + + + + - - - + + + - - - - - - - - - + + @@ -2428,1063 +2268,1036 @@ - - - - - - + + + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - + - + - + - + - + - - - - - - + + + + + + - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + - - - - + + + - - - - - - + + + + - - - - + + + + + + - - - - + + + + - - - - - + + + + - - - - - - - - - - + + + + + - - - - - + + + + + + + + + + - - - - - - - + + + - + - + - + + + - + + + + + + + + + + + + + + + - + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + - - - + + + - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - - - - + + + + - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - + + + - - - - + + + + + - - - - - - - + + + - + + - - - - - + + + - - - + + + - - - - - - - + + + + - - - - - - - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + - + + + + + - + + - - + + + + + + - - - + + + - - - - + + + + - - - - - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - + - + - + - + - - - - - - + + + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + - - - + + + - + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + @@ -3499,315 +3312,315 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - - - - - - - + + + + + + + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - + + + + - + - + - + - - + + - - - - - - - - - + + + + + + + + + - - - - + + + + - - - + + + - - - + + + - + - + - + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + @@ -3817,672 +3630,581 @@ - - - - - - - - - + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - - + + - + - - + + - - - - - + + + + + - - - - + + + + - + - - - - - + + + + + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - + + + - - - + + + + + + + + + + - - - + + + + + - - - - + + + + - - - - + + + + + - - - + + + - - - + + + + - - - + + + - - - + + + + - - - - + + + + - - - - + + + - - - + + + - - - + + + + - - - - + + + - - - - - + + + + + + - - - + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - + + - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + - - - + + + - - - + + + - - + + @@ -4492,9 +4214,9 @@ - - - + + + @@ -4517,22 +4239,22 @@ - - - - - + + + + + - - - + + + - - - + + + - - + + @@ -4567,82 +4289,82 @@ - - + + - - - - - - + + + + + + - - - + + + - - - - - - - - + + + + + + + + - - - + + + - - - - - + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + @@ -4680,218 +4402,205 @@ - - - - - + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - - - - + + + + + - - - - - - + + + - - - - + + + + + + - - - + + + + + - - - - - - - + + + + - - - - - - + + + + - - - - + + + - - - + + + + + + + - - - + + + + + + - - - + + + + - - - + + + - - - - + + + - - - - - + + + - - - - + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - + - + - + - + - + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - - + + + + + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - - + + + - - + + @@ -4902,751 +4611,751 @@ - - - - - - + + + + + + - - - - - + + + + + - - + + - - + + - + - + - + - + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - - - + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - + - + - + - + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - + + + + - + - + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + - - - - + + + + - + - + - + - + - - + + @@ -5660,105 +5369,105 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + @@ -5835,862 +5544,756 @@ - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - - - - - - + + + + + + - - - - - - + + + + - - - - + + + + + - - - - + + - - - - - + + + + + - - + + + + - - - - - + + + + + + - - - - + + + + - - - - - - + + + + + - - - - + + + + + - - - - - + + + + + + + + - - - - - + + + + + + + - - - - - - - - + + + + - - - - - - - + + + - - - - + + + + - - - + + - - - - + + - - + + + + + + - - + + - - - - - - + + - - + + - - + + - - + + + - - + + - - - + + + + + - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - + + - + - + - - - - - - + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + - + - + - - + + - - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - - + + @@ -6698,651 +6301,508 @@ - + - - + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + - - - - - - + + + + - - - - + + + + - - - - + + + + + - - - - - + + + + + - - - - - + + + - - - + + + - - - + + + + + + + + - - - - - + + + + + + + + - - - - - - - - + + + + - - - - - - - - + + - - - - + + + + - - + + + - - - - + + - - - - - - - - - - + + + - + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + + - - - - - - - + + + + - - - - + + - - - - - + + - - - - - + + + - - - + + + - - - + + + + + - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - + - - - - - + + + + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + + + + - - + + - + - + - + - + - + - + - + - + - - - + + + - - - + + + - - - - + + + + - - + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - - + + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + - - - - + + + - - - - - - - - - - - + + + - + - + - + - - + + @@ -7376,34 +6836,34 @@ - - + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - + + @@ -7416,924 +6876,929 @@ - - - - - - - + + + + + + + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + - - + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + + + + - - - - - - - - - - + + + + - + - - + + - + - + - - - - + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - + + + + + + + + - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + - - - + + + + + - - - + + + + + + - - - + + + + - - - + + + + + - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - + - + - + - + - + - + - - + + - - - - - - - + + + + + + + - + - + - + - + - + - + - - - - + + + + - - - - - + + + + + diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c index 1592b75eb..4d90a511f 100644 --- a/lib/libzfs/libzfs_changelist.c +++ b/lib/libzfs/libzfs_changelist.c @@ -284,7 +284,7 @@ changelist_postfix(prop_changelist_t *clp) /* * Is this "dataset" a child of "parent"? */ -boolean_t +static boolean_t isa_child_of(const char *dataset, const char *parent) { int len; diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index de6730408..ce7373582 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -131,27 +131,31 @@ typedef struct zfs_uri_handler { #define CONFIG_BUF_MINSIZE 262144 -int zfs_error(libzfs_handle_t *, int, const char *); -int zfs_error_fmt(libzfs_handle_t *, int, const char *, ...); -void zfs_error_aux(libzfs_handle_t *, const char *, ...); -void *zfs_alloc(libzfs_handle_t *, size_t); -void *zfs_realloc(libzfs_handle_t *, void *, size_t, size_t); -char *zfs_asprintf(libzfs_handle_t *, const char *, ...); -char *zfs_strdup(libzfs_handle_t *, const char *); -int no_memory(libzfs_handle_t *); +extern int zfs_error(libzfs_handle_t *, int, const char *); +extern int zfs_error_fmt(libzfs_handle_t *, int, const char *, ...) + __attribute__((format(printf, 3, 4))); +extern void zfs_error_aux(libzfs_handle_t *, const char *, ...) + __attribute__((format(printf, 2, 3))); +extern void *zfs_alloc(libzfs_handle_t *, size_t); +extern void *zfs_realloc(libzfs_handle_t *, void *, size_t, size_t); +extern char *zfs_asprintf(libzfs_handle_t *, const char *, ...) + __attribute__((format(printf, 2, 3))); +extern char *zfs_strdup(libzfs_handle_t *, const char *); +extern int no_memory(libzfs_handle_t *); -int zfs_standard_error(libzfs_handle_t *, int, const char *); -int zfs_standard_error_fmt(libzfs_handle_t *, int, const char *, ...); -void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *); -int zpool_standard_error(libzfs_handle_t *, int, const char *); -int zpool_standard_error_fmt(libzfs_handle_t *, int, const char *, ...); +extern int zfs_standard_error_fmt(libzfs_handle_t *, int, const char *, ...) + __attribute__((format(printf, 3, 4))); +extern void zfs_setprop_error(libzfs_handle_t *, zfs_prop_t, int, char *); +extern int zpool_standard_error(libzfs_handle_t *, int, const char *); +extern int zpool_standard_error_fmt(libzfs_handle_t *, int, const char *, ...) + __attribute__((format(printf, 3, 4))); -zfs_handle_t *make_dataset_handle_zc(libzfs_handle_t *, zfs_cmd_t *); -zfs_handle_t *make_dataset_simple_handle_zc(zfs_handle_t *, zfs_cmd_t *); +extern zfs_handle_t *make_dataset_handle_zc(libzfs_handle_t *, zfs_cmd_t *); +extern zfs_handle_t *make_dataset_simple_handle_zc(zfs_handle_t *, zfs_cmd_t *); -int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t, +extern int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t, nvlist_t *, char **, uint64_t *, const char *); -int zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, +extern int zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type); /* @@ -171,44 +175,42 @@ int zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, typedef struct prop_changelist prop_changelist_t; -int zcmd_alloc_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, size_t); -int zcmd_write_src_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *); -int zcmd_write_conf_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *); -int zcmd_expand_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *); -int zcmd_read_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t **); -void zcmd_free_nvlists(zfs_cmd_t *); +extern int zcmd_alloc_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, size_t); +extern int zcmd_write_src_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *); +extern int zcmd_write_conf_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *); +extern int zcmd_expand_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *); +extern int zcmd_read_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t **); +extern void zcmd_free_nvlists(zfs_cmd_t *); -int changelist_prefix(prop_changelist_t *); -int changelist_postfix(prop_changelist_t *); -void changelist_rename(prop_changelist_t *, const char *, const char *); -void changelist_remove(prop_changelist_t *, const char *); -void changelist_free(prop_changelist_t *); -prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int, int); -int changelist_unshare(prop_changelist_t *, zfs_share_proto_t *); -int changelist_haszonedchild(prop_changelist_t *); +extern int changelist_prefix(prop_changelist_t *); +extern int changelist_postfix(prop_changelist_t *); +extern void changelist_rename(prop_changelist_t *, const char *, const char *); +extern void changelist_remove(prop_changelist_t *, const char *); +extern void changelist_free(prop_changelist_t *); +extern prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int, + int); +extern int changelist_unshare(prop_changelist_t *, zfs_share_proto_t *); +extern int changelist_haszonedchild(prop_changelist_t *); -void remove_mountpoint(zfs_handle_t *); -int create_parents(libzfs_handle_t *, char *, int); -boolean_t isa_child_of(const char *dataset, const char *parent); +extern void remove_mountpoint(zfs_handle_t *); +extern int create_parents(libzfs_handle_t *, char *, int); -zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *); -zfs_handle_t *make_bookmark_handle(zfs_handle_t *, const char *, +extern zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *); +extern zfs_handle_t *make_bookmark_handle(zfs_handle_t *, const char *, nvlist_t *props); -int zpool_open_silent(libzfs_handle_t *, const char *, zpool_handle_t **); +extern int zpool_open_silent(libzfs_handle_t *, const char *, + zpool_handle_t **); -boolean_t zpool_name_valid(libzfs_handle_t *, boolean_t, const char *); +extern boolean_t zpool_name_valid(libzfs_handle_t *, boolean_t, const char *); -int zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type, +extern int zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type, boolean_t modifying); -void namespace_clear(libzfs_handle_t *); +extern void namespace_clear(libzfs_handle_t *); extern int zfs_parse_options(char *, zfs_share_proto_t); -extern int zfs_unshare_proto(zfs_handle_t *, - const char *, zfs_share_proto_t *); - typedef struct { zfs_prop_t p_prop; char *p_name; @@ -243,6 +245,7 @@ extern int do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags); extern int do_unmount(const char *mntpt, int flags); extern int zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto); +extern int zfs_unshare_proto(zfs_handle_t *, const char *, zfs_share_proto_t *); extern int unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, zfs_share_proto_t proto); extern boolean_t zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 528ae4946..b074a6e6f 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -95,7 +95,7 @@ static int mount_tp_nthr = 512; /* tpool threads for multi-threaded mounting */ static void zfs_mount_task(void *); -zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **, +static zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **, zfs_share_proto_t); /* @@ -107,16 +107,16 @@ proto_table_t proto_table[PROTO_END] = { {ZFS_PROP_SHARESMB, "smb", EZFS_SHARESMBFAILED, EZFS_UNSHARESMBFAILED}, }; -zfs_share_proto_t nfs_only[] = { +static zfs_share_proto_t nfs_only[] = { PROTO_NFS, PROTO_END }; -zfs_share_proto_t smb_only[] = { +static zfs_share_proto_t smb_only[] = { PROTO_SMB, PROTO_END }; -zfs_share_proto_t share_all_proto[] = { +static zfs_share_proto_t share_all_proto[] = { PROTO_NFS, PROTO_SMB, PROTO_END @@ -818,7 +818,7 @@ zfs_unshare(zfs_handle_t *zhp) /* * Check to see if the filesystem is currently shared. */ -zfs_share_type_t +static zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *zhp, char **where, zfs_share_proto_t proto) { char *mountpoint; @@ -1451,7 +1451,6 @@ zfs_foreach_mountpoint(libzfs_handle_t *hdl, zfs_handle_t **handles, * Mount and share all datasets within the given pool. This assumes that no * datasets within the pool are currently mounted. */ -#pragma weak zpool_mount_datasets = zpool_enable_datasets int zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags) { @@ -1513,8 +1512,6 @@ mountpoint_compare(const void *a, const void *b) return (strcmp(mountb, mounta)); } -/* alias for 2002/240 */ -#pragma weak zpool_unmount_datasets = zpool_disable_datasets /* * Unshare and unmount all datasets within the given pool. We don't want to * rely on traversing the DSL to discover the filesystems within the pool,