pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/hal Initial import of NetBSD HAL backend. It ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/c25b68a6ec1a
branches: trunk
changeset: 550665:c25b68a6ec1a
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Tue Nov 25 23:10:23 2008 +0000
description:
Initial import of NetBSD HAL backend. It doesn't do much useful yet, but
keeping things here makes development easier. Bump PKGREVISION.
diffstat:
sysutils/hal/Makefile | 25 +-
sysutils/hal/PLIST.NetBSD | 4 +
sysutils/hal/distinfo | 6 +-
sysutils/hal/files/hald-netbsd/Makefile.am | 23 +
sysutils/hal/files/hald-netbsd/addons/Makefile.am | 17 +
sysutils/hal/files/hald-netbsd/addons/addon-storage.c | 332 +++
sysutils/hal/files/hald-netbsd/devinfo.c | 406 +++
sysutils/hal/files/hald-netbsd/devinfo.h | 72 +
sysutils/hal/files/hald-netbsd/devinfo_acpi.h | 44 +
sysutils/hal/files/hald-netbsd/devinfo_cpu.h | 19 +
sysutils/hal/files/hald-netbsd/devinfo_misc.c | 134 +
sysutils/hal/files/hald-netbsd/devinfo_misc.h | 21 +
sysutils/hal/files/hald-netbsd/devinfo_pci.c | 122 +
sysutils/hal/files/hald-netbsd/devinfo_pci.h | 21 +
sysutils/hal/files/hald-netbsd/devinfo_storage.c | 1671 ++++++++++++++++
sysutils/hal/files/hald-netbsd/devinfo_storage.h | 30 +
sysutils/hal/files/hald-netbsd/devinfo_usb.c | 229 ++
sysutils/hal/files/hald-netbsd/devinfo_usb.h | 23 +
sysutils/hal/files/hald-netbsd/drvctl.c | 265 ++
sysutils/hal/files/hald-netbsd/drvctl.h | 23 +
sysutils/hal/files/hald-netbsd/hal-file-monitor.c | 821 +++++++
sysutils/hal/files/hald-netbsd/hotplug.c | 204 +
sysutils/hal/files/hald-netbsd/hotplug.h | 58 +
sysutils/hal/files/hald-netbsd/osspec.c | 193 +
sysutils/hal/files/hald-netbsd/osspec_netbsd.h | 21 +
sysutils/hal/files/hald-netbsd/probing/Makefile.am | 20 +
sysutils/hal/files/hald-netbsd/probing/cdutils.c | 379 +++
sysutils/hal/files/hald-netbsd/probing/cdutils.h | 61 +
sysutils/hal/files/hald-netbsd/probing/fsutils.c | 217 ++
sysutils/hal/files/hald-netbsd/probing/fsutils.h | 25 +
sysutils/hal/files/hald-netbsd/probing/probe-storage.c | 403 +++
sysutils/hal/files/hald-netbsd/probing/probe-volume.c | 629 ++++++
sysutils/hal/patches/patch-ag | 14 +-
sysutils/hal/patches/patch-na | 41 +
sysutils/hal/patches/patch-nb | 12 +
35 files changed, 6570 insertions(+), 15 deletions(-)
diffs (truncated from 6772 to 300 lines):
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/Makefile
--- a/sysutils/hal/Makefile Tue Nov 25 22:54:17 2008 +0000
+++ b/sysutils/hal/Makefile Tue Nov 25 23:10:23 2008 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2008/11/24 21:13:19 hasso Exp $
+# $NetBSD: Makefile,v 1.5 2008/11/25 23:10:23 jmcneill Exp $
#
DISTNAME= hal-0.5.11
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= http://hal.freedesktop.org/releases/
EXTRACT_SUFX= .tar.bz2
@@ -20,6 +20,7 @@
USE_DIRS+= xdg-1.4
USE_PKGLOCALEDIR= YES
USE_TOOLS+= gmake intltool msgfmt perl pkg-config
+USE_TOOLS+= autoconf automake autoreconf
USE_LIBTOOL= YES
MAKE_DIRS= ${VARBASE}/cache/hald
@@ -43,6 +44,17 @@
PLIST_SRC= PLIST.FreeBSD PLIST
.endif
+.if !empty(MACHINE_PLATFORM:MNetBSD-[5-9]*)
+CONFIGURE_ARGS+= --with-backend=netbsd
+PLIST_SRC= PLIST.NetBSD PLIST
+.endif
+
+.if ${OPSYS} == "Linux"
+.include "../../devel/libusb/buildlink3.mk"
+.include "../../sysutils/pciutils/buildlink3.mk"
+CONFIGURE_ARGS+= --with-backend=linux
+.endif
+
REPLACE_INTERPRETER+= bash
REPLACE.bash.old= /bin/bash
REPLACE.bash.new= ${SH}
@@ -59,10 +71,11 @@
FILES_SUBST+= HAL_USER=${HAL_USER}
FILES_SUBST+= HAL_GROUP=${HAL_GROUP}
-.if ${OPSYS} == "Linux"
-.include "../../devel/libusb/buildlink3.mk"
-.include "../../sysutils/pciutils/buildlink3.mk"
-.endif
+post-extract:
+ ${CP} -r ${FILESDIR}/hald-netbsd ${WRKSRC}/hald/netbsd
+
+pre-configure:
+ cd ${WRKSRC} && autoreconf -vi
.include "../../devel/GConf/schemas.mk"
.include "../../devel/glib2/buildlink3.mk"
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/PLIST.NetBSD
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/PLIST.NetBSD Tue Nov 25 23:10:23 2008 +0000
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST.NetBSD,v 1.1 2008/11/25 23:10:23 jmcneill Exp $
+libexec/hald-addon-storage
+libexec/hald-probe-storage
+libexec/hald-probe-volume
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/distinfo
--- a/sysutils/hal/distinfo Tue Nov 25 22:54:17 2008 +0000
+++ b/sysutils/hal/distinfo Tue Nov 25 23:10:23 2008 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.4 2008/11/24 21:13:19 hasso Exp $
+$NetBSD: distinfo,v 1.5 2008/11/25 23:10:23 jmcneill Exp $
SHA1 (hal-0.5.11.tar.bz2) = 1ddb7895d2ddc2464b553ad11f7ba38860478ae9
RMD160 (hal-0.5.11.tar.bz2) = 741cfe82f0bc2d67106b24cfe526a754ab36e45f
@@ -9,7 +9,7 @@
SHA1 (patch-ad) = 2a2732f82a4fd8d7ffa311b4a0e747208dc9ad1c
SHA1 (patch-ae) = ebc98ede0b6e9535825434f2dc6185193d837f36
SHA1 (patch-af) = 161b59ee30d59dbc9e0c79f7f3162bcec5480d99
-SHA1 (patch-ag) = 39b79fbcd99f9172afd492772c120161bb63a378
+SHA1 (patch-ag) = 3fd8b7d10b1a43311541d2c6ad67a944e286c5ec
SHA1 (patch-ah) = 6d801a2c30cee6199b25acf46d7e9866f6004182
SHA1 (patch-ai) = 2e11ee437e778f540f401335b4f022fe6e8e8fee
SHA1 (patch-aj) = 533289d4e1328a89ad9e4ce6c1b28e32139b70db
@@ -18,3 +18,5 @@
SHA1 (patch-am) = 6a4940006e583300d9a983511bdcb05268f74b1a
SHA1 (patch-an) = 0307b2f0f6bb5e4a6d7bf837163e74749b7d24b2
SHA1 (patch-ao) = 9099fa4783921a0389b874b8f6d3f7b890810b34
+SHA1 (patch-na) = bbeb48b6fa909c8fcf7cbaf609019a0d4d4b8082
+SHA1 (patch-nb) = 1693b7a2faa5bee20a594f0b60b8ff6caea0efdc
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/files/hald-netbsd/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/hald-netbsd/Makefile.am Tue Nov 25 23:10:23 2008 +0000
@@ -0,0 +1,23 @@
+
+SUBDIRS = probing addons .
+
+AM_CPPFLAGS = \
+ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \
+ -I$(top_srcdir) -I.. \
+ @GLIB_CFLAGS@ @DBUS_CFLAGS@ @POLKIT_CFLAGS@
+
+if HALD_COMPILE_NETBSD
+noinst_LTLIBRARIES = libhald_netbsd.la
+endif
+
+libhald_netbsd_la_SOURCES = \
+ osspec.c drvctl.c \
+ devinfo.c devinfo_misc.c \
+ hotplug.c hal-file-monitor.c
+# devinfo_pci.c devinfo_storage.c devinfo_usb.c
+
+libhald_netbsd_la_LDFLAGS = -lprop
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/files/hald-netbsd/addons/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/hald-netbsd/addons/Makefile.am Tue Nov 25 23:10:23 2008 +0000
@@ -0,0 +1,17 @@
+
+AM_CPPFLAGS = \
+ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \
+ -I$(top_srcdir) -I$(top_srcdir)/hald -I$(top_srcdir)/libhal -I$(top_srcdir)/libhal-storage \
+ @GLIB_CFLAGS@ @DBUS_CFLAGS@
+
+if HALD_COMPILE_NETBSD
+libexec_PROGRAMS = hald-addon-storage
+endif
+
+hald_addon_storage_SOURCES = addon-storage.c ../../logger.c
+hald_addon_storage_LDADD = $(top_builddir)/libhal/libhal.la
+
diff -r 198854500e3c -r c25b68a6ec1a sysutils/hal/files/hald-netbsd/addons/addon-storage.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/hald-netbsd/addons/addon-storage.c Tue Nov 25 23:10:23 2008 +0000
@@ -0,0 +1,332 @@
+/***************************************************************************
+ *
+ * addon-storage.c : watch removable media state changes
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ **************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/statvfs.h>
+#include <sys/dkio.h>
+#include <dev/scsipi/scsi_spc.h>
+#include <dev/scsipi/scsipi_all.h>
+#include <dev/scsipi/scsipi_cd.h>
+#include <sys/scsiio.h>
+
+#include <libhal.h>
+
+#include <logger.h>
+
+#define SLEEP_PERIOD 5
+
+enum discstate {
+ DISC_INSERTED,
+ DISC_EJECTED,
+ DISC_NONE,
+ DISC_UNKNOWN
+};
+
+static enum discstate
+scsi_test_unit_ready (int fd)
+{
+ struct scsi_test_unit_ready tur;
+ scsireq_t req;
+
+ memset(&tur, 0, sizeof(tur));
+ tur.opcode = SCSI_TEST_UNIT_READY;
+
+ memset(&req, 0, sizeof(req));
+ memcpy(req.cmd, &tur, sizeof(tur));
+ req.cmdlen = sizeof(tur);
+ req.databuf = NULL;
+ req.datalen = 0;
+ req.timeout = 10000;
+ req.flags = 0;
+ req.senselen = SENSEBUFLEN;
+
+ if (ioctl(fd, SCIOCCOMMAND, &req) == -1)
+ return DISC_UNKNOWN;
+ if (req.retsts == SCCMD_OK)
+ return DISC_INSERTED;
+ return DISC_EJECTED;
+}
+
+static void
+my_dbus_error_free(DBusError *error)
+{
+ if (dbus_error_is_set(error)) {
+ dbus_error_free(error);
+ }
+}
+
+static void
+force_unmount (LibHalContext *ctx, const char *udi)
+{
+ DBusError error;
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ char **options = NULL;
+ unsigned int num_options = 0;
+ DBusConnection *dbus_connection;
+ char *device_file;
+
+ dbus_error_init (&error);
+
+ dbus_connection = libhal_ctx_get_dbus_connection (ctx);
+
+ msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
+ "org.freedesktop.Hal.Device.Volume",
+ "Unmount");
+ if (msg == NULL) {
+ HAL_DEBUG (("Could not create dbus message for %s", udi));
+ goto out;
+ }
+
+
+ options = calloc (1, sizeof (char *));
+ if (options == NULL) {
+ HAL_DEBUG (("Could not allocate options array"));
+ goto out;
+ }
+
+ device_file = libhal_device_get_property_string (ctx, udi, "block.device", &error);
+ if (device_file != NULL) {
+ libhal_free_string (device_file);
+ }
+ dbus_error_free (&error);
+
+ if (!dbus_message_append_args (msg,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &options, num_options,
+ DBUS_TYPE_INVALID)) {
+ HAL_DEBUG (("Could not append args to dbus message for %s", udi));
+ goto out;
+ }
+
+ if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, msg, -1, &error))) {
+ HAL_DEBUG (("Unmount failed for %s: %s : %s\n", udi, error.name, error.message));
+ goto out;
+ }
+
+ if (dbus_error_is_set (&error)) {
+ HAL_DEBUG (("Unmount failed for %s\n%s : %s\n", udi, error.name, error.message));
+ goto out;
+ }
+
+ HAL_DEBUG (("Succesfully unmounted udi '%s'", udi));
+
+out:
+ dbus_error_free (&error);
+ if (options != NULL)
+ free (options);
+ if (msg != NULL)
+ dbus_message_unref (msg);
+ if (reply != NULL)
+ dbus_message_unref (reply);
+}
+
+static void
+unmount_childs (LibHalContext *ctx, const char *udi)
+{
+ DBusError error;
+ int num_volumes;
+ char **volumes;
+
+ dbus_error_init (&error);
+
+ /* need to force unmount all partitions */
+ if ((volumes = libhal_manager_find_device_string_match (
+ ctx, "block.storage_device", udi, &num_volumes, &error)) != NULL) {
+ dbus_error_free (&error);
+ int i;
+
Home |
Main Index |
Thread Index |
Old Index