summaryrefslogtreecommitdiffstats
path: root/debian/patches/freebsd-zvol.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/freebsd-zvol.patch')
-rw-r--r--debian/patches/freebsd-zvol.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/patches/freebsd-zvol.patch b/debian/patches/freebsd-zvol.patch
new file mode 100644
index 0000000..b7826bc
--- /dev/null
+++ b/debian/patches/freebsd-zvol.patch
@@ -0,0 +1,83 @@
+From 3b19f4af4398d71eb3dd58041d4aff94e05efb6d Mon Sep 17 00:00:00 2001
+From: Robert Millan <rmh@debian.org>
+Date: Fri, 28 Mar 2014 17:09:50 +0000
+Subject: Detection of ZFS volumes (ZVOL)
+
+ZFS volumes (ZVOL) are the ZFS equivalent of Logical Volumes in LVM.
+
+They implement a block device which can be used for swap or legacy
+filesystems.
+
+Bug-Debian: http://bugs.debian.org/635384
+Forwarded: no
+Last-Update: 2011-07-30
+
+Patch-Name: freebsd-zvol.patch
+---
+ libparted/arch/freebsd.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/libparted/arch/freebsd.c b/libparted/arch/freebsd.c
+index 4c690e5f..a60b43f8 100644
+--- a/libparted/arch/freebsd.c
++++ b/libparted/arch/freebsd.c
+@@ -23,6 +23,7 @@
+ #include <parted/debug.h>
+
+ #include <ctype.h>
++#include <dirent.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdint.h>
+@@ -1134,12 +1135,51 @@ _probe_kern_disks ()
+ return 1;
+ }
+
++static int
++_probe_zfs_volumes ()
++{
++ DIR* pool_dir;
++ DIR* zvol_dir;
++ struct dirent* pool_dent;
++ struct dirent* zvol_dent;
++ char buf[PATH_MAX];
++ struct stat st;
++
++ pool_dir = opendir ("/dev/zvol");
++ if (!pool_dir)
++ return 0;
++
++ while ((pool_dent = readdir (pool_dir))) {
++ if (strcmp (pool_dent->d_name, ".") == 0 || strcmp (pool_dent->d_name, "..") == 0)
++ continue;
++
++ snprintf (buf, sizeof (buf), "/dev/zvol/%s", pool_dent->d_name);
++ zvol_dir = opendir (buf);
++
++ while ((zvol_dent = readdir (zvol_dir))) {
++ if (strcmp (zvol_dent->d_name, ".") == 0 || strcmp (zvol_dent->d_name, "..") == 0)
++ continue;
++
++ snprintf (buf, sizeof (buf), "/dev/zvol/%s/%s", pool_dent->d_name, zvol_dent->d_name);
++ if (stat (buf, &st) != 0)
++ continue;
++ _ped_device_probe (buf);
++ }
++ closedir (zvol_dir);
++ }
++ closedir (pool_dir);
++
++ return 1;
++}
++
+ static void
+ freebsd_probe_all ()
+ {
+ _probe_standard_devices ();
+
+ _probe_kern_disks ();
++
++ _probe_zfs_volumes ();
+ }
+
+ static char*