From 56ed73d6e0046620cb443a15e9de5aca3ead769b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:26:25 -0800 Subject: [PATCH] Refresh linux-have-libdiskmgt --- .topdeps | 4 +--- .topmsg | 17 ++--------------- zfs/zcmd/zpool/zpool_vdev.c | 8 ++++++++ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..af2af320e8 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux have libdiskmgt -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. +Use libdiskmgt if HAVE_LIBDISKMGT defined Signed-off-by: Brian Behlendorf diff --git a/zfs/zcmd/zpool/zpool_vdev.c b/zfs/zcmd/zpool/zpool_vdev.c index 10007c1492..519ff62e47 100644 --- a/zfs/zcmd/zpool/zpool_vdev.c +++ b/zfs/zcmd/zpool/zpool_vdev.c @@ -111,6 +111,7 @@ vdev_error(const char *fmt, ...) va_end(ap); } +#ifdef HAVE_LIBDISKMGT static void libdiskmgt_error(int error) { @@ -272,6 +273,7 @@ check_device(const char *path, boolean_t force, boolean_t isspare) return (check_slice(path, force, B_FALSE, isspare)); } +#endif /* * Check that a file is valid. All we can do in this case is check that it's @@ -287,6 +289,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare) pool_state_t state; boolean_t inuse; +#ifdef HAVE_DM_INUSE_SWAP if (dm_inuse_swap(file, &err)) { if (err) libdiskmgt_error(err); @@ -295,6 +298,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare) "Please see swap(1M).\n"), file); return (-1); } +#endif if ((fd = open(file, O_RDONLY)) < 0) return (0); @@ -1061,11 +1065,15 @@ check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing, return (0); } +#ifdef HAVE_LIBDISKMGT if (strcmp(type, VDEV_TYPE_DISK) == 0) ret = check_device(path, force, isspare); if (strcmp(type, VDEV_TYPE_FILE) == 0) ret = check_file(path, force, isspare); +#else + ret = check_file(path, force, isspare); +#endif return (ret); }