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

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

Revision 1.6, Sun Dec 26 20:59:31 2010 UTC (8 years, 2 months ago) by markd
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
Changes since 1.5: +11 -11 lines

Update to 0.5.14.

Many bugfixes and support for new features.

$NetBSD: patch-aa,v 1.6 2010/12/26 20:59:31 markd Exp $

--- tools/hal-storage-mount.c.orig	2009-05-27 20:26:03.000000000 +0000
+++ tools/hal-storage-mount.c
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <glib.h>
 #include <glib/gstdio.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 #include <fstab.h>
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -41,6 +41,14 @@
 #elif sun
 #include <sys/mnttab.h>
 #include <sys/vfstab.h>
+#elif __NetBSD__
+#include <fstab.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <pwd.h>
 #else
 #include <mntent.h>
 #endif
@@ -54,10 +62,14 @@
 
 #include "hal-storage-shared.h"
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #define MOUNT		"/sbin/mount"
 #define MOUNT_OPTIONS	"noexec,nosuid"
 #define MOUNT_TYPE_OPT	"-t"
+#elif __NetBSD__
+#define MOUNT		"/sbin/mount"
+#define MOUNT_OPTIONS	"noexec,nosuid,nodev"
+#define	MOUNT_TYPE_OPT	"-t"
 #elif sun
 #define MOUNT		"/sbin/mount"
 #define MOUNT_OPTIONS	"noexec,nosuid"
@@ -421,7 +433,7 @@ device_is_mounted (const char *device, c
 static const char *
 map_fstype (const char *fstype)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 	if (! strcmp (fstype, "iso9660"))
 		return "cd9660";
 	else if (! strcmp (fstype, "ext2"))
@@ -430,6 +442,13 @@ map_fstype (const char *fstype)
 		return "ext2fs";
 	else if (! strcmp (fstype, "vfat"))
 		return "msdosfs";
+#elif __NetBSD__
+	if (! strcmp (fstype, "iso9660"))
+		return "cd9660";
+	else if (! strcmp (fstype, "ext2"))
+		return "ext2fs";
+	else if (! strcmp (fstype, "vfat"))
+		return "msdos";
 #elif sun
 	if (! strcmp (fstype, "iso9660"))
 		return "hsfs";
@@ -471,11 +490,16 @@ handle_mount (LibHalContext *hal_ctx, 
 	gboolean explicit_mount_point_given;
 	gboolean found_alternative_fstype = FALSE;
 	const char *end;
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 	struct passwd *pw;
 	uid_t calling_uid;
 	gid_t calling_gid;
 #endif
+	gboolean have_rump = FALSE;
+#ifdef __NetBSD__
+	char *rump_cmd;
+	struct stat st;
+#endif
 	const char *label;
 	const char *uuid;
 
@@ -646,8 +670,6 @@ handle_mount (LibHalContext *hal_ctx, 
 	/* construct arguments to mount */
 	na = 0;
 	
-	args[na++] = MOUNT;
-
 	if (strlen (mount_fstype) > 0) {
 		mount_do_fstype = (char *) map_fstype (mount_fstype);
 		if (volume && strcmp(mount_do_fstype, mount_fstype) == 0) {
@@ -797,8 +819,28 @@ handle_mount (LibHalContext *hal_ctx, 
 		}
 	}
 
-	args[na++] = MOUNT_TYPE_OPT;
-	args[na++] = mount_do_fstype;
+#ifdef __NetBSD__
+	rump_cmd = g_strdup_printf ("/usr/sbin/rump_%s", mount_do_fstype);
+	if (stat (rump_cmd, &st) == 0) {
+		int rump_fd = open ("/dev/puffs", O_RDONLY);
+		if (rump_fd >= 0) {
+			have_rump = TRUE;
+			close (rump_fd);
+		}
+	}
+
+	/* XXX rump_* option handling is different, disable for now */
+	have_rump = FALSE;
+
+	if (have_rump == TRUE)
+		args[na++] = rump_cmd;
+	else
+#endif
+	{
+		args[na++] = MOUNT;
+		args[na++] = MOUNT_TYPE_OPT;
+		args[na++] = mount_do_fstype;
+	}
 
 	args[na++] = "-o";
 #ifdef HAVE_UMOUNT_HAL
@@ -869,7 +911,7 @@ handle_mount (LibHalContext *hal_ctx, 
 			unknown_error ("Cannot create mount directory");
 		}
 		
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 		calling_uid = (uid_t) strtol (invoked_by_uid, (char **) NULL, 10);
 		pw = getpwuid (calling_uid);
 		if (pw != NULL) {