pkgsrc/sysutils/hal/patches/patch-ar
obache 04e9a8f3e4 Bring back DragonFly BSD support.
Based on PR#44338 from Rumko, also fixes PLIST.FreeBSD and self-tests by me.
2011-01-08 13:00:13 +00:00

44 lines
1.3 KiB
Text

$NetBSD: patch-ar,v 1.1 2011/01/08 13:00:13 obache Exp $
--- hald/freebsd/probing/probe-storage.c.orig 2009-08-24 12:42:29.000000000 +0000
+++ hald/freebsd/probing/probe-storage.c
@@ -32,7 +32,11 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#ifdef __DragonFly__
+#include <sys/diskslice.h>
+#else
#include <sys/disk.h>
+#endif
#include <netinet/in.h>
#include <glib.h>
#include <libvolume_id.h>
@@ -171,6 +175,9 @@ int
main (int argc, char **argv)
{
char *device_file;
+#ifdef __DragonFly__
+ struct partinfo device_info;
+#endif
char *drive_type;
char *parent;
int ret = 0; /* no media/filesystem */
@@ -221,10 +228,17 @@ main (int argc, char **argv)
fd = open(device_file, O_RDONLY | O_NONBLOCK);
if (fd > -1)
{
+#ifdef __DragonFly__
+ if (ioctl (fd, DIOCGPART, &device_info) == 0)
+ {
+ libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "storage.removable.media_size", device_info.media_size, &hfp_error);
+ }
+#else
if (ioctl (fd, DIOCGMEDIASIZE, &size) == 0)
{
libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "storage.removable.media_size", size, &hfp_error);
}
+#endif
close(fd);
}
ret = 2; /* has media */