Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libzfs: -fvisibility=hidden #12048

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/zhack/zhack.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@
#include <sys/zio_compress.h>
#include <sys/zfeature.h>
#include <sys/dmu_tx.h>
#include <zfeature_common.h>
#include <libzutil.h>

extern boolean_t zfeature_checks_disable;

const char cmdname[] = "zhack";
static importargs_t g_importargs;
static char *g_pool;
Expand Down
2 changes: 1 addition & 1 deletion config/Abigail.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ USER_H = \
libzfs.h \
libzfsbootenv.h \
libzfs_core.h \
libzfs_impl.h \
libzutil.h \
thread_pool.h

Expand Down
4 changes: 2 additions & 2 deletions include/cityhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
*/

#ifndef _SYS_CITYHASH_H
#define _SYS_CITYHASH_H
#define _SYS_CITYHASH_H extern __attribute__((visibility("default")))

#include <sys/zfs_context.h>

#ifdef __cplusplus
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
}
Expand Down
512 changes: 262 additions & 250 deletions include/libzfs.h

Large diffs are not rendered by default.

71 changes: 36 additions & 35 deletions include/libzutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#ifndef _LIBZUTIL_H
#define _LIBZUTIL_H
#define _LIBZUTIL_H extern __attribute__((visibility("default")))

#include <sys/nvpair.h>
#include <sys/fs/zfs.h>
Expand Down Expand Up @@ -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 */
Expand All @@ -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
Expand All @@ -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", "-".
Expand All @@ -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
Expand All @@ -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
}
Expand Down
63 changes: 33 additions & 30 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

#ifndef _SYS_FS_ZFS_H
#define _SYS_FS_ZFS_H
#define _SYS_FS_ZFS_H extern __attribute__((visibility("default")))

#include <sys/time.h>
#include <sys/zio_priority.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions include/sys/zfs_sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions include/sys/zio_checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

#ifndef _SYS_ZIO_CHECKSUM_H
#define _SYS_ZIO_CHECKSUM_H
#define _SYS_ZIO_CHECKSUM_H extern __attribute__((visibility("default")))

#include <sys/zio.h>
#include <zfeature_common.h>
Expand Down Expand Up @@ -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.
Expand All @@ -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;

Expand Down
17 changes: 9 additions & 8 deletions include/zfeature_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

#ifndef _ZFEATURE_COMMON_H
#define _ZFEATURE_COMMON_H
#define _ZFEATURE_COMMON_H extern __attribute__((visibility("default")))

#include <sys/fs/zfs.h>
#include <sys/inttypes.h>
Expand Down Expand Up @@ -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
}
Expand Down
17 changes: 9 additions & 8 deletions include/zfs_comutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#ifndef _ZFS_COMUTIL_H
#define _ZFS_COMUTIL_H
#define _ZFS_COMUTIL_H extern __attribute__((visibility("default")))

#include <sys/fs/zfs.h>
#include <sys/types.h>
Expand All @@ -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
}
Expand Down
Loading