pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/hal hald-netbsd: add basic support for automo...
details: https://anonhg.NetBSD.org/pkgsrc/rev/7f12e8ff130c
branches: trunk
changeset: 550843:7f12e8ff130c
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Mon Dec 01 02:02:33 2008 +0000
description:
hald-netbsd: add basic support for automounting non-optical media. Still
some bugs to work out, but it's a start.
Bump PKGREVISION.
diffstat:
sysutils/hal/Makefile | 17 +-
sysutils/hal/distinfo | 4 +-
sysutils/hal/files/hald-netbsd/Makefile.am | 7 +-
sysutils/hal/files/hald-netbsd/devinfo.c | 2 +
sysutils/hal/files/hald-netbsd/devinfo_mass.c | 341 ++++++++++++++++++++++++++
sysutils/hal/files/hald-netbsd/devinfo_mass.h | 37 ++
sysutils/hal/files/hald-netbsd/osspec.c | 20 +-
sysutils/hal/files/hald-netbsd/vfsstat.c | 157 +++++++++++
sysutils/hal/files/hald-netbsd/vfsstat.h | 36 ++
sysutils/hal/patches/patch-aa | 71 ++++-
10 files changed, 656 insertions(+), 36 deletions(-)
diffs (truncated from 860 to 300 lines):
diff -r 1990095b3745 -r 7f12e8ff130c sysutils/hal/Makefile
--- a/sysutils/hal/Makefile Sun Nov 30 23:58:51 2008 +0000
+++ b/sysutils/hal/Makefile Mon Dec 01 02:02:33 2008 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.14 2008/11/27 22:19:10 jmcneill Exp $
+# $NetBSD: Makefile,v 1.15 2008/12/01 02:02:33 jmcneill Exp $
#
DISTNAME= hal-0.5.11
-PKGREVISION= 10
+PKGREVISION= 11
CATEGORIES= sysutils
MASTER_SITES= http://hal.freedesktop.org/releases/
EXTRACT_SUFX= .tar.bz2
@@ -13,9 +13,6 @@
BUILD_DEFS+= VARBASE
-HAL_USER?= haldaemon
-HAL_GROUP?= haldaemon
-
GNU_CONFIGURE= YES
USE_DIRS+= xdg-1.4
USE_PKGLOCALEDIR= YES
@@ -33,8 +30,6 @@
CONFIGURE_ARGS+= --localstatedir=${VARBASE}
CONFIGURE_ARGS+= --with-pci-ids=${PREFIX}/share/pciids
CONFIGURE_ARGS+= --with-usb-ids=${PREFIX}/share/usbids
-CONFIGURE_ARGS+= --with-hal-user=${HAL_USER}
-CONFIGURE_ARGS+= --with-hal-group=${HAL_GROUP}
.include "../../mk/bsd.prefs.mk"
@@ -47,6 +42,7 @@
.if !empty(MACHINE_PLATFORM:MNetBSD-[5-9]*)
CONFIGURE_ARGS+= --with-backend=netbsd
PLIST_SRC= PLIST.NetBSD PLIST
+HAL_GROUP= operator
.elif ${OPSYS} == "NetBSD"
# Pull in the dummy backend for older NetBSD
CONFIGURE_ARGS+= --with-backend=dummy
@@ -65,9 +61,16 @@
REPLACE_FILES.bash+= tools/hal-${halscript}
.endfor
+HAL_USER?= haldaemon
+HAL_GROUP?= haldaemon
+CONFIGURE_ARGS+= --with-hal-user=${HAL_USER}
+CONFIGURE_ARGS+= --with-hal-group=${HAL_GROUP}
+
RCD_SCRIPTS= hal
+.if ${HAL_GROUP} != "operator"
PKG_GROUPS= ${HAL_GROUP}
+.endif
PKG_USERS= ${HAL_USER}:${HAL_GROUP}
PKG_HOME.haldaemon= ${VARBASE}/run/hal
diff -r 1990095b3745 -r 7f12e8ff130c sysutils/hal/distinfo
--- a/sysutils/hal/distinfo Sun Nov 30 23:58:51 2008 +0000
+++ b/sysutils/hal/distinfo Mon Dec 01 02:02:33 2008 +0000
@@ -1,9 +1,9 @@
-$NetBSD: distinfo,v 1.6 2008/11/27 03:32:19 jmcneill Exp $
+$NetBSD: distinfo,v 1.7 2008/12/01 02:02:33 jmcneill Exp $
SHA1 (hal-0.5.11.tar.bz2) = 1ddb7895d2ddc2464b553ad11f7ba38860478ae9
RMD160 (hal-0.5.11.tar.bz2) = 741cfe82f0bc2d67106b24cfe526a754ab36e45f
Size (hal-0.5.11.tar.bz2) = 1281251 bytes
-SHA1 (patch-aa) = 120079700424a3c199b58f87bb3f160263f84ce1
+SHA1 (patch-aa) = 1380aca775e5be6b21f755bc36656163394a9c32
SHA1 (patch-ab) = 8712f8bd3ab5d4f7f6d4ea2c30c11f8384615772
SHA1 (patch-ac) = cffdb9caa947366ff88310a750ab502bd2d98db8
SHA1 (patch-ad) = 2a2732f82a4fd8d7ffa311b4a0e747208dc9ad1c
diff -r 1990095b3745 -r 7f12e8ff130c sysutils/hal/files/hald-netbsd/Makefile.am
--- a/sysutils/hal/files/hald-netbsd/Makefile.am Sun Nov 30 23:58:51 2008 +0000
+++ b/sysutils/hal/files/hald-netbsd/Makefile.am Mon Dec 01 02:02:33 2008 +0000
@@ -8,16 +8,17 @@
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
-DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \
-I$(top_srcdir) -I.. \
- @GLIB_CFLAGS@ @DBUS_CFLAGS@ @POLKIT_CFLAGS@
+ @GLIB_CFLAGS@ @DBUS_CFLAGS@ @POLKIT_CFLAGS@ @VOLUME_ID_CFLAGS@
if HALD_COMPILE_NETBSD
noinst_LTLIBRARIES = libhald_netbsd.la
endif
libhald_netbsd_la_SOURCES = \
- osspec.c drvctl.c envsys.c \
+ osspec.c drvctl.c envsys.c vfsstat.c \
devinfo.c devinfo_misc.c devinfo_audio.c devinfo_video.c \
+ devinfo_mass.c \
hotplug.c hal-file-monitor.c
# devinfo_pci.c devinfo_storage.c devinfo_usb.c
-libhald_netbsd_la_LDFLAGS = -lprop
+libhald_netbsd_la_LDFLAGS = -lprop @VOLUME_ID_LIBS@
diff -r 1990095b3745 -r 7f12e8ff130c sysutils/hal/files/hald-netbsd/devinfo.c
--- a/sysutils/hal/files/hald-netbsd/devinfo.c Sun Nov 30 23:58:51 2008 +0000
+++ b/sysutils/hal/files/hald-netbsd/devinfo.c Mon Dec 01 02:02:33 2008 +0000
@@ -32,6 +32,7 @@
#include "devinfo_video.h"
#include "devinfo_pci.h"
#include "devinfo_storage.h"
+#include "devinfo_mass.h"
#include "devinfo_usb.h"
#include "devinfo_misc.h"
#include "devinfo_cpu.h"
@@ -153,6 +154,7 @@
&devinfo_audio_mixer_handler,
&devinfo_audio_dsp_handler,
&devinfo_video_handler,
+ &devinfo_mass_handler,
&devinfo_default_handler,
NULL
};
diff -r 1990095b3745 -r 7f12e8ff130c sysutils/hal/files/hald-netbsd/devinfo_mass.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/hald-netbsd/devinfo_mass.c Mon Dec 01 02:02:33 2008 +0000
@@ -0,0 +1,341 @@
+/* $NetBSD: devinfo_mass.c,v 1.1 2008/12/01 02:02:33 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2008 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/disklabel.h>
+#include <sys/bootblock.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <paths.h>
+#include <unistd.h>
+
+#include "../osspec.h"
+#include "../logger.h"
+#include "../hald.h"
+#include "../hald_dbus.h"
+#include "../device_info.h"
+#include "../util.h"
+#include "../ids.h"
+#include "hotplug.h"
+#include "devinfo.h"
+#include "devinfo_mass.h"
+#include "drvctl.h"
+
+#include <libvolume_id.h>
+
+HalDevice *devinfo_mass_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type);
+HalDevice *devinfo_mass_disklabel_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type);
+
+DevinfoDevHandler devinfo_mass_handler = {
+ devinfo_mass_add,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+DevinfoDevHandler devinfo_mass_disklabel_handler = {
+ devinfo_mass_disklabel_add,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+static const char *
+devinfo_mass_get_fstype(uint8_t fstype)
+{
+ switch (fstype) {
+ case FS_BSDFFS:
+ return "ffs";
+ case FS_MSDOS:
+ return "vfat";
+ case FS_EX2FS:
+ return "ext2";
+ case FS_NTFS:
+ return "ntfs";
+ default:
+ return NULL;
+ }
+}
+
+static uint8_t
+devinfo_mass_get_mbrtype(uint8_t fstype)
+{
+ switch (fstype) {
+ case FS_BSDFFS:
+ return MBR_PTYPE_NETBSD;
+ case FS_MSDOS:
+ return MBR_PTYPE_FAT32; /* XXX */
+ case FS_EX2FS:
+ return MBR_PTYPE_LNXEXT2;
+ case FS_NTFS:
+ return MBR_PTYPE_NTFS;
+ default:
+ return MBR_PTYPE_UNUSED;
+ }
+}
+
+HalDevice *
+devinfo_mass_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type)
+{
+ HalDevice *d = NULL;
+ prop_dictionary_t dict;
+ struct disklabel label;
+ struct stat st;
+ const char *driver;
+ char *rdevpath, *devpath;
+ char *childnode;
+ char *parent_devnode;
+ int16_t unit;
+ int i, fd;
+
+ if (drvctl_find_device (devnode, &dict) == FALSE || dict == NULL)
+ return NULL;
+
+ if (prop_dictionary_get_int16 (dict, "device-unit", &unit) == false ||
+ prop_dictionary_get_cstring_nocopy (dict, "device-driver", &driver) == false) {
+ prop_object_release (dict);
+ return NULL;
+ }
+
+ if (strcmp (driver, "wd") != 0 && strcmp (driver, "sd") != 0) {
+ prop_object_release (dict);
+ return NULL;
+ }
+
+ sleep (1);
+
+ devpath = g_strdup_printf ("/dev/%s%c", devnode, RAW_PART + 'a');
+ rdevpath = g_strdup_printf ("/dev/r%s%c", devnode, RAW_PART + 'a');
+ HAL_INFO ((" going to open %s", rdevpath));
+ fd = open (rdevpath, O_RDONLY);
+ if (fd < 0) {
+ HAL_WARNING (("couldn't open %s: %s", rdevpath, strerror (errno)));
+ g_free (rdevpath);
+ g_free (devpath);
+ return NULL;
+ }
+
+ HAL_INFO ((" going to DIOCGDINFO %s", rdevpath));
+ if (ioctl (fd, DIOCGDINFO, &label) == -1) {
+ HAL_WARNING (("DIOCGDINFO failed on %s: %s", rdevpath, strerror (errno)));
+ g_free (rdevpath);
+ g_free (devpath);
+ close (fd);
+ return NULL;
+ }
+
+ close (fd);
+
+ d = hal_device_new ();
+
+ devinfo_set_default_properties (d, parent, devnode, devfs_path);
+
+ hal_device_add_capability (d, "block");
+ hal_device_property_set_string (d, "info.subsystem", "block");
+ hal_device_property_set_string (d, "block.device", devpath);
+ if (stat (devpath, &st) == 0) {
+ hal_device_property_set_int (d, "block.major", major (st.st_rdev));
+ hal_device_property_set_int (d, "block.minor", minor (st.st_rdev));
+ }
+ hal_device_property_set_bool (d, "block.is_volume", FALSE);
+ hal_device_property_set_bool (d, "block.no_partitions", FALSE);
+ hal_device_property_set_bool (d, "block.have_scanned", TRUE);
+
+ hal_device_add_capability (d, "storage");
+ hal_device_property_set_string (d, "info.category", "storage");
+ parent_devnode = hal_device_property_get_string (parent, "netbsd.device");
Home |
Main Index |
Thread Index |
Old Index