[BACK]Return to patch-ar CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / sysutils / hal / patches

File: [cvs.NetBSD.org] / pkgsrc / sysutils / hal / patches / patch-ar (download)

Revision 1.1, Sat Jan 8 13:00:13 2011 UTC (8 years, 2 months ago) by obache
Branch: MAIN
CVS Tags: pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-, HEAD

Bring back DragonFly BSD support.
Based on PR#44338 from Rumko, also fixes PLIST.FreeBSD and self-tests by me.

$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 */