From 02601d8aa41df597556ec18c0a1769201fc44851 Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Tue, 27 Jul 2021 08:34:11 +0900 Subject: [PATCH] Move check_file to os/$platform section Keep check_file_generic() in shared code base, and allow special case code in check_file() in os section. In future, macOS will have additional checks in check_file(). Linux and FreeBSD wrappers just calls check_file_generic(). Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Jorgen Lundman Closes #12385 --- cmd/zpool/os/freebsd/zpool_vdev_os.c | 6 ++++++ cmd/zpool/os/linux/zpool_vdev_os.c | 6 ++++++ cmd/zpool/zpool_util.h | 1 + cmd/zpool/zpool_vdev.c | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/zpool/os/freebsd/zpool_vdev_os.c b/cmd/zpool/os/freebsd/zpool_vdev_os.c index aa66d29fa6..66bfe28f13 100644 --- a/cmd/zpool/os/freebsd/zpool_vdev_os.c +++ b/cmd/zpool/os/freebsd/zpool_vdev_os.c @@ -116,3 +116,9 @@ after_zpool_upgrade(zpool_handle_t *zhp) "details.\n"), zpool_get_name(zhp)); } } + +int +check_file(const char *file, boolean_t force, boolean_t isspare) +{ + return (check_file_generic(file, force, isspare)); +} diff --git a/cmd/zpool/os/linux/zpool_vdev_os.c b/cmd/zpool/os/linux/zpool_vdev_os.c index da87aa79f3..10929fa65a 100644 --- a/cmd/zpool/os/linux/zpool_vdev_os.c +++ b/cmd/zpool/os/linux/zpool_vdev_os.c @@ -410,3 +410,9 @@ void after_zpool_upgrade(zpool_handle_t *zhp) { } + +int +check_file(const char *file, boolean_t force, boolean_t isspare) +{ + return (check_file_generic(file, force, isspare)); +} diff --git a/cmd/zpool/zpool_util.h b/cmd/zpool/zpool_util.h index 60e8ea873b..4002e57940 100644 --- a/cmd/zpool/zpool_util.h +++ b/cmd/zpool/zpool_util.h @@ -131,6 +131,7 @@ boolean_t check_sector_size_database(char *path, int *sector_size); void vdev_error(const char *fmt, ...) __attribute__((format(printf, 1, 2))); int check_file(const char *file, boolean_t force, boolean_t isspare); void after_zpool_upgrade(zpool_handle_t *zhp); +int check_file_generic(const char *file, boolean_t force, boolean_t isspare); #ifdef __cplusplus } diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 57d41e5eaa..dcc67e7e20 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -112,7 +112,7 @@ vdev_error(const char *fmt, ...) * not in use by another pool, and not in use by swap. */ int -check_file(const char *file, boolean_t force, boolean_t isspare) +check_file_generic(const char *file, boolean_t force, boolean_t isspare) { char *name; int fd;