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

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

Revision 1.3, Sat Dec 20 21:11:05 2008 UTC (10 years, 3 months ago) by jmcneill
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-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3, pkgsrc-2009Q2-base, pkgsrc-2009Q2, pkgsrc-2009Q1-base, pkgsrc-2009Q1, pkgsrc-2008Q4-base, pkgsrc-2008Q4, pkgsrc-, HEAD
Changes since 1.2: +9 -9 lines

PR# pkg/40230: "libvolume_id" doesn't build under Mac OS X

Fix HAL build on OS X. Tested on 10.5.6 powerpc.

$NetBSD: patch-ab,v 1.3 2008/12/20 21:11:05 jmcneill Exp $

--- tools/hal-storage-shared.c.orig	2008-05-08 02:24:24 +0300
+++ tools/hal-storage-shared.c	2008-11-23 13:38:53 +0200
@@ -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>
@@ -42,6 +42,10 @@
 #include <fcntl.h>
 #include <sys/mnttab.h>
 #include <sys/vfstab.h>
+#elif __NetBSD__
+#include <fstab.h>
+#include <sys/param.h>
+#include <sys/mount.h>
 #else
 #include <mntent.h>
 #endif
@@ -53,20 +57,27 @@
 
 #include "hal-storage-shared.h"
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 struct mtab_handle
 {
   struct statfs	*mounts;
   int		n_mounts;
   int		iter;
 };
+#elif __NetBSD__
+struct mtab_handle
+{
+  struct statvfs *mounts;
+  int		n_mounts;
+  int		iter;
+};
 #endif
 
 
 gboolean
 mtab_open (gpointer *handle)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	struct mtab_handle *mtab;
 
 	mtab = g_new0 (struct mtab_handle, 1);
@@ -90,7 +101,7 @@ mtab_open (gpointer *handle)
 char *
 mtab_next (gpointer handle, char **mount_point)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	struct mtab_handle *mtab = handle;
 
 	if (mtab->iter < mtab->n_mounts) {
@@ -131,7 +142,7 @@ mtab_next (gpointer handle, char **mount
 void
 mtab_close (gpointer handle)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	g_free (handle);
 #else
 	fclose (handle);
@@ -143,7 +154,7 @@ mtab_close (gpointer handle)
 gboolean
 fstab_open (gpointer *handle)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	return setfsent () == 1;
 #elif sun
 	*handle = fopen (VFSTAB, "r");
@@ -157,7 +168,7 @@ fstab_open (gpointer *handle)
 char *
 fstab_next (gpointer handle, char **mount_point)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	struct fstab *fstab;
 
 	fstab = getfsent ();
@@ -188,14 +199,16 @@ fstab_next (gpointer handle, char **moun
 void
 fstab_close (gpointer handle)
 {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 	endfsent ();
 #else
 	fclose (handle);
 #endif
 }
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#define UMOUNT		"/sbin/umount"
+#elif __NetBSD__
 #define UMOUNT		"/sbin/umount"
 #elif sun
 #define UMOUNT		"/sbin/umount"
@@ -467,7 +480,7 @@ line_found:
 	/* construct arguments to /bin/umount */
 	na = 0;
 	args[na++] = UMOUNT;
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
 	if (option_lazy)
 		args[na++] = "-l";
 #endif
@@ -625,13 +638,18 @@ try_open_excl_again:
 	/* construct arguments to EJECT_PROGRAM (e.g. /usr/bin/eject) */
 	na = 0;
 	args[na++] = EJECT_PROGRAM;
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 	args[na++] = "-f";
 	args[na++] = (char *) device;
 	if (closetray)
 		args[na++] = "close";
 	else
 		args[na++] = "eject";
+#elif __NetBSD__
+	args[na++] = "-f";
+	if (closetray)
+		args[na++] = "-l";
+	args[na++] = (char *) device;
 #else
 	if (closetray) {
 		args[na++] = "-t";