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

Factor Linux specific functionality out of libzutil #9356

Merged
merged 1 commit into from
Oct 3, 2019
Merged
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
10 changes: 5 additions & 5 deletions cmd/zed/agents/zfs_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
char rawpath[PATH_MAX], fullpath[PATH_MAX];
char devpath[PATH_MAX];
int ret;
int is_dm = 0;
int is_sd = 0;
boolean_t is_dm = B_FALSE;
boolean_t is_sd = B_FALSE;
uint_t c;
vdev_stat_t *vs;

Expand Down Expand Up @@ -220,8 +220,8 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)

is_dm = zfs_dev_is_dm(path);
zed_log_msg(LOG_INFO, "zfs_process_add: pool '%s' vdev '%s', phys '%s'"
" wholedisk %d, dm %d (%llu)", zpool_get_name(zhp), path,
physpath ? physpath : "NULL", wholedisk, is_dm,
" wholedisk %d, %s dm (guid %llu)", zpool_get_name(zhp), path,
physpath ? physpath : "NULL", wholedisk, is_dm ? "is" : "not",
(long long unsigned int)guid);

/*
Expand Down Expand Up @@ -266,7 +266,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
* testing)
*/
if (physpath != NULL && strcmp("scsidebug", physpath) == 0)
is_sd = 1;
is_sd = B_TRUE;

/*
* If the pool doesn't have the autoreplace property set, then use
Expand Down
13 changes: 2 additions & 11 deletions include/libzutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,10 @@ 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);

#ifdef HAVE_LIBUDEV
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);
#else
#define zfs_device_get_devid(dev, bufptr, buflen) (ENODATA)
#define zfs_device_get_physical(dev, bufptr, buflen) (ENODATA)
#endif

extern void update_vdev_config_dev_strs(nvlist_t *);

Expand All @@ -106,16 +101,12 @@ extern char *zfs_strip_partition_path(char *);

extern int zfs_strcmp_pathname(const char *, const char *, int);

extern int zfs_dev_is_dm(const char *);
extern int zfs_dev_is_whole_disk(const char *);
extern boolean_t zfs_dev_is_dm(const char *);
extern boolean_t zfs_dev_is_whole_disk(const char *);
extern char *zfs_get_underlying_path(const char *);
extern char *zfs_get_enclosure_sysfs_path(const char *);

#ifdef HAVE_LIBUDEV
extern boolean_t is_mpath_whole_disk(const char *);
#else
#define is_mpath_whole_disk(path) (B_FALSE)
#endif

extern boolean_t zfs_isnumber(const char *);

Expand Down
9 changes: 9 additions & 0 deletions lib/libzutil/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ include $(top_srcdir)/config/Rules.am
# Suppress unused but set variable warnings often due to ASSERTs
AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)

DEFAULT_INCLUDES += -I.

noinst_LTLIBRARIES = libzutil.la

USER_C = \
zutil_device_path.c \
zutil_import.c \
zutil_import.h \
zutil_nicenum.c \
zutil_pool.c

if BUILD_LINUX
USER_C += \
os/linux/zutil_device_path_os.c \
os/linux/zutil_import_os.c
endif

nodist_libzutil_la_SOURCES = $(USER_C)

libzutil_la_LIBADD = \
Expand Down
Loading