Bug#635384: detection of ZFS volumes (ZVOL)
Package: parted
Version: 2.3-7
Severity: wishlist
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd
Please consider this patch to add detection of ZFS volumes to Parted.
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.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages parted depends on:
ii libblkid1 2.19.1-4 block device id library
ii libc0.1 2.13-10 Embedded GNU C Library: Shared lib
ii libncurses5 5.9-1 shared libraries for terminal hand
ii libparted0debian1 2.3-7 disk partition manipulator - share
ii libreadline6 6.2-2 GNU readline and history libraries
ii libuuid1 2.19.1-4 Universally Unique ID library
parted recommends no packages.
Versions of packages parted suggests:
pn parted-doc <none> (no description available)
-- no debconf information
=== modified file 'libparted/arch/freebsd.c'
--- libparted/arch/freebsd.c 2011-07-25 16:04:49 +0000
+++ libparted/arch/freebsd.c 2011-07-25 16:18:00 +0000
@@ -23,6 +23,7 @@
#include <parted/debug.h>
#include <ctype.h>
+#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
@@ -1096,12 +1097,51 @@
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*
Reply to: