From 56ed73d6e0046620cb443a15e9de5aca3ead769b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:26:25 -0800 Subject: [PATCH 1/3] 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); } From c72d6b30e86ba2e95a417092c06697e3d036491f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 22 Dec 2008 10:07:53 -0800 Subject: [PATCH 2/3] Remove one more header --- cmd/zpool/zpool_vdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 519ff62e47..835b9017d3 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -64,7 +64,9 @@ #include #include #include +#ifdef HAVE_LIBDISKMGT #include +#endif #include #include #include From 73db9f622c5c5179b46f36edb63c30e1a82c5269 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 11 Mar 2009 23:05:42 -0700 Subject: [PATCH 3/3] Pull unused err variable under HAVE_DM_INUSE_SWAP ifdef. --- cmd/zpool/zpool_vdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 835b9017d3..3971e489e9 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -287,11 +287,11 @@ check_file(const char *file, boolean_t force, boolean_t isspare) char *name; int fd; int ret = 0; - int err; pool_state_t state; boolean_t inuse; - #ifdef HAVE_DM_INUSE_SWAP + int err; + if (dm_inuse_swap(file, &err)) { if (err) libdiskmgt_error(err);