pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/44338: [PATCH] sysutils/hal: bring back DragonFly BSD support



>Number:         44338
>Category:       pkg
>Synopsis:       [PATCH] sysutils/hal: bring back DragonFly BSD support
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 07 15:05:00 +0000 2011
>Originator:     Rumko
>Release:        /
>Organization:
/
>Environment:
DragonFly rumko.rumko.net 2.9-DEVELOPMENT DragonFly 
v2.9.1.351.ga55d7-DEVELOPMENT #2: Thu Dec 30 09:30:14 CET 2010     
root%rumko.rumko.net@localhost:/usr/obj/usr/src/sys/MYPRECIOUS  i386
>Description:
Latest update broke hal on DragonFly:
  CC     hald_probe_storage-probe-storage.o
In file included from probe-storage.c:35:
/usr/include/sys/disk.h:49:2: error: #error "This file should not be included 
by userland programs."
In file included from probe-storage.c:35:
/usr/include/sys/disk.h:131: error: expected specifier-qualifier-list before 
'cdev_t'
probe-storage.c: In function 'main':
probe-storage.c:224: error: 'DIOCGMEDIASIZE' undeclared (first use in this 
function)
probe-storage.c:224: error: (Each undeclared identifier is reported only once
probe-storage.c:224: error: for each function it appears in.)
gmake[5]: *** [hald_probe_storage-probe-storage.o] Error 1
gmake[5]: Leaving directory 
`/home/dcvs/sysutils/hal/work/hal-0.5.14/hald/freebsd/probing'
>How-To-Repeat:

>Fix:
The patch at 
http://www.rumko.net/pkgsrc/0001-sysutils-hal-bring-in-support-for-DragonFly-BSD.patch
 (also inlined below) makes the package build again and introduces a few 
additional changes regarding the freebsd backend (tested on a FreeBSD machine 
that it still compiles after the patch):
* restored behaviour regarding usb probing from previous hal versions (in 
previous versions if it could not open /dev/usb, it still continued working on 
/dev/usbX, while the new version stopped probing when it couldn't open /dev/usb 
... since usbd(8) usually takes over /dev/usb, it meant that no usb device was 
ever detected)
* previously probe-volume was linked to -lufs nonconditionally, now a check has 
been added to configure to check for the existance of libufs (needed since e.g. 
dragonfly does not have libufs)


patch:
From 98b6a123c6203f12bf3f6ed004f76d318b3bec49 Mon Sep 17 00:00:00 2001
From: Rumko <rumcic%gmail.com@localhost>
Date: Fri, 7 Jan 2011 00:58:31 +0100
Subject: [PATCH] sysutils/hal: bring in support for DragonFly BSD

* also changed the static inclusion of -lufs on FreeBSD to a check
 if the lib actually exists (which it does not on DragonFly)
* restored the behaviour in freebsd/hf-usb.c of usb device probing
 to what it was in previous versions ... if hald cannot open
 /dev/usb, continue probing /dev/usbX
---
 sysutils/hal/distinfo         |   10 +++-
 sysutils/hal/patches/patch-ai |   44 +++++++++++++++++++
 sysutils/hal/patches/patch-ak |   94 ++++++++++++++++++++++++++++++++++------
 sysutils/hal/patches/patch-ao |   12 +++++
 sysutils/hal/patches/patch-ar |   14 ++++++
 sysutils/hal/patches/patch-as |   16 +++++++
 sysutils/hal/patches/patch-at |   11 +++++
 sysutils/hal/patches/patch-na |   31 ++++++++++----
 8 files changed, 207 insertions(+), 25 deletions(-)
 create mode 100644 sysutils/hal/patches/patch-ai
 create mode 100644 sysutils/hal/patches/patch-ar
 create mode 100644 sysutils/hal/patches/patch-as
 create mode 100644 sysutils/hal/patches/patch-at

diff --git a/sysutils/hal/distinfo b/sysutils/hal/distinfo
index 0e4dc4a..9a72617 100644
--- a/sysutils/hal/distinfo
+++ b/sysutils/hal/distinfo
@@ -11,15 +11,19 @@ SHA1 (patch-ae) = ebc98ede0b6e9535825434f2dc6185193d837f36
 SHA1 (patch-af) = 161b59ee30d59dbc9e0c79f7f3162bcec5480d99
 SHA1 (patch-ag) = 3fd8b7d10b1a43311541d2c6ad67a944e286c5ec
 SHA1 (patch-ah) = 6d801a2c30cee6199b25acf46d7e9866f6004182
+SHA1 (patch-ai) = 81a056d5ad12c1aa8e30f09db10ddaba42eb0739
 SHA1 (patch-aj) = f20e4b1286d177e53a550b2ba1608d22e4b5c609
-SHA1 (patch-ak) = f4ba0655a452fc13e83a7b93703b4da417e8597f
+SHA1 (patch-ak) = e4da84cffc632f8b5af4e1d71f1eda17d19bba95
 SHA1 (patch-al) = fe567d7504e961cb623e492f8dc155ef2f3b4c9e
 SHA1 (patch-am) = 6a4940006e583300d9a983511bdcb05268f74b1a
 SHA1 (patch-an) = 0307b2f0f6bb5e4a6d7bf837163e74749b7d24b2
-SHA1 (patch-ao) = e450f8d5fd4705cf9f4eb3e827a61179b4148646
+SHA1 (patch-ao) = 7848a9e9e619f7a1f8a29971120ccbc90421f39e
 SHA1 (patch-ap) = 9051ced9c00911b993198c98c6d02f5846c16728
 SHA1 (patch-aq) = 7d0b224b4b1e6052983a6512217eee4f530e0720
+SHA1 (patch-ar) = b9fda37dfb9d5d3cbd927d9f29638d5136045552
+SHA1 (patch-as) = 48d38332a603a72ef31def653076b1abe91143cc
+SHA1 (patch-at) = bd40da7c9966b03e74b9845174f3c5e0c336ab8c
 SHA1 (patch-ax) = 278cbf10dd288f7a4aeedd7545b325c1a82715db
-SHA1 (patch-na) = 127bd8aa2c837a525685e4ab8ef0429059130b2b
+SHA1 (patch-na) = 2b36b6fa96573e06738f30a4041c36ee7d25e783
 SHA1 (patch-nb) = 1693b7a2faa5bee20a594f0b60b8ff6caea0efdc
 SHA1 (patch-nc) = 32453e49734902749ce24eb4364fc7f531986227
diff --git a/sysutils/hal/patches/patch-ai b/sysutils/hal/patches/patch-ai
new file mode 100644
index 0000000..0e18cf4
--- /dev/null
+++ b/sysutils/hal/patches/patch-ai
@@ -0,0 +1,44 @@
+$NetBSD$
+
+--- hald/freebsd/probing/probe-storage.c       2011-01-06 20:48:55 +0100
++++ hald/freebsd/probing/probe-storage.c       2011-01-06 21:02:29 +0100
+@@ -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 @@
+ 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 @@
+         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 */
diff --git a/sysutils/hal/patches/patch-ak b/sysutils/hal/patches/patch-ak
index 551db2b..0966e34 100644
--- a/sysutils/hal/patches/patch-ak
+++ b/sysutils/hal/patches/patch-ak
@@ -2,42 +2,108 @@ $NetBSD$
 
 --- hald/freebsd/probing/probe-volume.c.orig   2009-09-17 13:45:09.000000000 
+0000
 +++ hald/freebsd/probing/probe-volume.c
-@@ -33,7 +33,9 @@
+@@ -33,7 +33,11 @@
  #include <fcntl.h>
  #include <unistd.h>
  #include <sys/ioctl.h>
-+#ifndef __DragonFly__
++#ifdef __DragonFly__
++#include <sys/diskslice.h>
++#else
  #include <sys/disk.h>
 +#endif
  #include <sys/cdio.h>
  #include <sys/param.h>
  #include <sys/mount.h>
-@@ -371,6 +373,7 @@ main (int argc, char **argv)
+@@ -41,7 +45,11 @@
+ #include <ufs/ufs/ufsmount.h>
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
++#ifdef __DragonFly__
++#include <ufs/ufs/ufs_types.h>
++#else
+ #include <libufs.h>
++#endif
+ #include <isofs/cd9660/iso.h>
+ #include <glib.h>
+ #include <libvolume_id.h>
+@@ -332,6 +340,9 @@
+   gboolean is_blank = FALSE;
+   const char *usage;
+   char *label;
++#ifdef __DragonFly__
++  struct partinfo device_info;
++#endif
+   unsigned int sector_size = 0;
+   off_t media_size = 0;
+ 
+@@ -371,7 +382,12 @@
        is_blank = (! has_audio && ! has_data);
      }
  
-+#ifndef __DragonFly__
++#ifdef __DragonFly__
++  ioctl(fd, DIOCGPART, &device_info);
++  media_size = device_info.media_size;
++#else
    ioctl(fd, DIOCGMEDIASIZE, &media_size);
++#endif
  
    /*
-@@ -396,6 +399,7 @@ main (int argc, char **argv)
+    * We only check for filesystems if the volume has no children,
+@@ -563,16 +579,35 @@
+ 
+   if (vid && ! strcmp (vid->type, "ufs"))
+     {
++#ifdef __DragonFly__
++      struct fs fs;
++      int rfd;
++      ssize_t nr;
++      
++      if ((rfd = open(device_file, O_RDONLY)) >= 0) {
++          lseek(rfd, (off_t) SBOFF, SEEK_SET);
++          
++          nr = read(rfd, &fs, (size_t) SBSIZE);
++          close(rfd);
++      }
++          
++      if (nr == (ssize_t) SBSIZE)
++#else
+       struct uufsd ufsdisk;
+ 
+       if (ufs_disk_fillout(&ufsdisk, device_file) == 0)
++#endif
+         {
+         char ufsid[64];
+         char **ufs_devs = NULL;
+         int num_udis;
+         int i;
+ 
++#ifdef __DragonFly__
++          snprintf(ufsid, sizeof(ufsid), "%08x%08x", fs.fs_id[0], 
fs.fs_id[1]);
++#else
+         snprintf(ufsid, sizeof(ufsid), "%08x%08x", ufsdisk.d_fs.fs_id[0], 
ufsdisk.d_fs.fs_id[1]);
++#endif
+         libhal_device_set_property_string(hfp_ctx, hfp_udi, 
"volume.freebsd.ufsid", ufsid, &hfp_error);
+         ufs_devs = libhal_manager_find_device_string_match(hfp_ctx,
+                                                            
"volume.freebsd.ufsid",
+@@ -597,7 +632,9 @@
            }
+         if (ufs_devs)
+           libhal_free_string_array(ufs_devs);
++#ifndef __DragonFly__
+         ufs_disk_close(&ufsdisk);
++#endif
        }
      }
-+#endif
  
-   if (! has_children && ! is_swap && ! has_audio && ! has_data && ! is_blank)
-     goto end;
-@@ -628,10 +632,12 @@ main (int argc, char **argv)
+@@ -628,7 +665,11 @@
  
    libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.uuid", vid ? 
vid->uuid : "", &hfp_error);
  
-+#ifndef __DragonFly__
++#ifdef __DragonFly__
++  sector_size = device_info.media_blksize;
++#else
    ioctl(fd, DIOCGSECTORSIZE, &sector_size);
++#endif
  
    if (sector_size != 0)
      libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "volume.block_size", 
sector_size, &hfp_error);
-+#endif
-   if (media_size != 0)
-     libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "volume.size", 
media_size, &hfp_error);
-   if (sector_size != 0 && media_size != 0)
diff --git a/sysutils/hal/patches/patch-ao b/sysutils/hal/patches/patch-ao
index bb9c42c..7657668 100644
--- a/sysutils/hal/patches/patch-ao
+++ b/sysutils/hal/patches/patch-ao
@@ -1,5 +1,9 @@
 $NetBSD$
 
+On DragonFly /dev/usb will be taken by usbd(8), but that does not
+mean that one cannot check usbX devices. The same behaviour was present
+in older versions of hald(8).
+
 --- hald/freebsd/hf-usb.c.orig 2009-09-17 13:49:46.000000000 +0000
 +++ hald/freebsd/hf-usb.c
 @@ -36,9 +36,13 @@
@@ -16,3 +20,11 @@ $NetBSD$
  
  #include "../logger.h"
  #include "../osspec.h"
+@@ -613,7 +617,6 @@
+   if (hf_usb_fd < 0)
+     {
+       HAL_INFO(("unable to open %s: %s", HF_USB_DEVICE, g_strerror(errno)));
+-      return;
+     }
+ 
+   for (i = 0; i < 16; i++)
diff --git a/sysutils/hal/patches/patch-ar b/sysutils/hal/patches/patch-ar
new file mode 100644
index 0000000..9ac21cb
--- /dev/null
+++ b/sysutils/hal/patches/patch-ar
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- hald/freebsd/addons/addon-mouse.c.orig     2011-01-06 22:56:06 +0100
++++ hald/freebsd/addons/addon-mouse.c  2011-01-06 22:56:35 +0100
+@@ -29,7 +29,9 @@
+ #include <sys/types.h>
+ #include <sys/event.h>
+ #include <sys/time.h>
++#ifdef __FreeBSD__
+ #include <sys/proc.h>
++#endif
+ #if __FreeBSD_version >= 800058
+ #include <sys/types.h>
+ #include <sys/user.h>
diff --git a/sysutils/hal/patches/patch-as b/sysutils/hal/patches/patch-as
new file mode 100644
index 0000000..117d1b3
--- /dev/null
+++ b/sysutils/hal/patches/patch-as
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- hald/freebsd/hf-pci.c.orig 2011-01-06 23:02:23 +0100
++++ hald/freebsd/hf-pci.c      2011-01-06 23:02:49 +0100
+@@ -27,7 +27,11 @@
+ 
+ #include <stdio.h>
+ #include <string.h>
++#ifdef __DragonFly__
++#include <bitstring.h>
++#else
+ #include <sys/bitstring.h>
++#endif
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <unistd.h>
diff --git a/sysutils/hal/patches/patch-at b/sysutils/hal/patches/patch-at
new file mode 100644
index 0000000..6173798
--- /dev/null
+++ b/sysutils/hal/patches/patch-at
@@ -0,0 +1,11 @@
+$NetBSD$
+
+--- hald/freebsd/probing/Makefile.am.orig      2009-08-24 14:42:29 +0200
++++ hald/freebsd/probing/Makefile.am   2011-01-07 00:02:35 +0100
+@@ -67,5 +67,5 @@
+ hald_probe_volume_LDADD = \
+       @GLIB_LIBS@                                                     \
+       @VOLUME_ID_LIBS@                                                \
+-      -lufs                                                           \
++      @LIBUFS_LIBS@                                                   \
+       $(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la
diff --git a/sysutils/hal/patches/patch-na b/sysutils/hal/patches/patch-na
index 249d705..9578f25 100644
--- a/sysutils/hal/patches/patch-na
+++ b/sysutils/hal/patches/patch-na
@@ -2,8 +2,11 @@ $NetBSD: patch-na,v 1.7 2010/12/27 22:26:17 tron Exp $
 
 --- configure.in.orig  2009-08-24 13:42:29.000000000 +0100
 +++ configure.in       2010-12-29 00:07:13.000000000 +0000
-@@ -484,7 +484,7 @@
+@@ -482,9 +482,10 @@
+ USE_LIBUSB20=no
+ USE_LIBUSB=no
  LIBUSB20_LIBS=""
++LIBUFS_LIBS=""
  AC_ARG_WITH([backend],
            AS_HELP_STRING([--with-backend=<name>],
 -                         [backend to use (linux/solaris/freebsd/dummy)]),
@@ -11,7 +14,7 @@ $NetBSD: patch-na,v 1.7 2010/12/27 22:26:17 tron Exp $
            [backend=$withval])
  if ! test -z "$with_backend" ; then
      HALD_BACKEND="$with_backend"
-@@ -493,6 +493,9 @@
+@@ -493,6 +494,9 @@
          *-*-solaris*)
                   HALD_BACKEND="solaris"
                   ;;
@@ -21,24 +24,36 @@ $NetBSD: patch-na,v 1.7 2010/12/27 22:26:17 tron Exp $
          *-*-freebsd* | *-*-kfreebsd*-gnu)
                     HALD_BACKEND="freebsd"
                     ;;
-@@ -508,6 +511,7 @@
+@@ -508,8 +512,10 @@
  AM_CONDITIONAL(HALD_COMPILE_LINUX, [test x$HALD_BACKEND = xlinux], [Compiling 
for Linux])
  AM_CONDITIONAL(HALD_COMPILE_FREEBSD, [test x$HALD_BACKEND = xfreebsd], 
[Compiling for FreeBSD])
  AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], 
[Compiling for Solaris])
 +AM_CONDITIONAL(HALD_COMPILE_NETBSD, [test x$HALD_BACKEND = xnetbsd], 
[Compiling for NetBSD])
  AC_SUBST(HALD_BACKEND)
  if test "x$HALD_BACKEND" = "xfreebsd"; then
++    AC_SEARCH_LIBS([ufs_disk_fillout], [ufs], [LIBUFS_LIBS="-lufs"], [])
      AC_CHECK_LIB([usb20], [libusb20_dev_get_info], [USE_LIBUSB20=yes], 
[USE_LIBUSB20=no])
-@@ -707,7 +711,7 @@
+ fi
+ if test "x$USE_LIBUSB20" = "xno"; then
+@@ -526,6 +532,8 @@
+ fi
+ AC_SUBST(LIBUSB20_LIBS)
+ 
++AC_SUBST(LIBUFS_LIBS)
++
+ dnl DBUS API is subject to changes
+ AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, [], [DBUS API is subject to 
change])
+ 
+@@ -707,7 +715,7 @@
  AC_MSG_RESULT($have_glib_2_14)
  
  case "$host" in
 -    *-*-freebsd*)
-+    *-*-freebsd* | *-*-netbsd*)
++    *-*-freebsd* | *-*-netbsd* | *-*-dragonfly*)
          PKG_CHECK_MODULES(VOLUME_ID, [$volume_id_module])
        AC_SUBST(VOLUME_ID_CFLAGS)
        AC_SUBST(VOLUME_ID_LIBS)
-@@ -718,14 +722,13 @@
+@@ -718,14 +726,13 @@
  
  # blkid (util-linux-ng)
  case "$host" in
@@ -57,7 +72,7 @@ $NetBSD: patch-na,v 1.7 2010/12/27 22:26:17 tron Exp $
  esac
  
  # OS specific libs
-@@ -1086,6 +1089,9 @@
+@@ -1086,6 +1093,9 @@
  hald/solaris/Makefile
  hald/solaris/probing/Makefile
  hald/solaris/addons/Makefile
@@ -67,7 +82,7 @@ $NetBSD: patch-na,v 1.7 2010/12/27 22:26:17 tron Exp $
  hald/freebsd/Makefile
  hald/freebsd/probing/Makefile
  hald/freebsd/libprobe/Makefile
-@@ -1096,6 +1102,7 @@
+@@ -1096,6 +1106,7 @@
  tools/Makefile
  tools/freebsd/Makefile
  tools/linux/Makefile
-- 
1.7.3.4



Home | Main Index | Thread Index | Old Index