Rework the mount/unmount functions.

Remove useless patches while here.
This commit is contained in:
ajacoutot 2011-06-28 09:40:13 +00:00
parent 047258332b
commit 52866d0dcb
4 changed files with 40 additions and 55 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.125 2011/06/15 12:41:33 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.126 2011/06/28 09:40:13 ajacoutot Exp $
COMMENT-main= general-purpose utility library
COMMENT-docs= glib2 documentation
@ -8,6 +8,8 @@ DISTNAME= glib-${VERSION}
PKGNAME-main= glib2-${VERSION}
PKGNAME-docs= glib2-docs-${VERSION}
REVISION-main= 0
CATEGORIES= devel
HOMEPAGE= http://www.gtk.org/

View File

@ -1,14 +1,16 @@
$OpenBSD: patch-gio_gunixmount_c,v 1.3 2011/03/07 19:17:14 ajacoutot Exp $
$OpenBSD: patch-gio_gunixmount_c,v 1.4 2011/06/28 09:40:13 ajacoutot Exp $
Removable device needs to be unmounted before it is ejected.
https://bugzilla.gnome.org/show_bug.cgi?id=653553
https://bugzilla.gnome.org/show_bug.cgi?id=653555
--- gio/gunixmount.c.orig Sun Nov 14 20:34:22 2010
+++ gio/gunixmount.c Mon Jan 31 10:14:44 2011
@@ -29,6 +29,11 @@
--- gio/gunixmount.c.orig Sat Nov 6 16:38:54 2010
+++ gio/gunixmount.c Tue Jun 28 10:18:02 2011
@@ -29,6 +29,12 @@
#include <sys/wait.h>
#include <unistd.h>
+#ifdef __OpenBSD__
+#include <errno.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
@ -16,19 +18,41 @@ Removable device needs to be unmounted before it is ejected.
#include <glib.h>
#include "gunixvolumemonitor.h"
#include "gunixmount.h"
@@ -451,10 +456,15 @@ g_unix_mount_eject (GMount *mount,
@@ -423,8 +429,14 @@ g_unix_mount_unmount (GMount *mount,
gpointer user_data)
{
GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
- char *argv[] = {"umount", NULL, NULL};
+ gchar *umount;
+ umount = g_find_program_in_path("umount");
+ if (!umount)
+ umount = "/sbin/umount";
+
+ char *argv[] = {umount, NULL, NULL};
+
if (unix_mount->mount_path != NULL)
argv[1] = unix_mount->mount_path;
else
@@ -451,10 +463,21 @@ g_unix_mount_eject (GMount *mount,
GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
char *argv[] = {"eject", NULL, NULL};
+/*
+ * eject(1) on OpenBSD does not try to unmount first and only works on
+ * devices, not mount points.
+ */
+#ifdef __OpenBSD__
+ if (unmount(unix_mount->mount_path, MNT_FORCE) == 0)
+ argv[1] = unix_mount->device_path;
+ if (unmount(unix_mount->mount_path, MNT_FORCE) < 0)
+ g_warning ("%s unmount failed: %s\n", unix_mount->mount_path, strerror(errno));
+
+ argv[1] = unix_mount->device_path;
+#else
if (unix_mount->mount_path != NULL)
argv[1] = unix_mount->mount_path;
else
argv[1] = unix_mount->device_path;
+#endif // __OpenBSD__
+#endif
eject_unmount_do (mount, cancellable, callback, user_data, argv);
}

View File

@ -1,15 +1,7 @@
$OpenBSD: patch-glib_gmacros_h,v 1.13 2010/09/30 07:17:19 ajacoutot Exp $
--- glib/gmacros.h.orig Mon Aug 9 15:34:46 2010
+++ glib/gmacros.h Mon Sep 27 14:42:36 2010
@@ -38,6 +38,7 @@
/* We include stddef.h to get the system's definition of NULL
*/
#include <stddef.h>
+#include <sys/param.h>
/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
* where this is valid. This allows for warningless compilation of
@@ -86,8 +87,13 @@
$OpenBSD: patch-glib_gmacros_h,v 1.14 2011/06/28 09:40:13 ajacoutot Exp $
--- glib/gmacros.h.orig Mon Jun 6 01:18:49 2011
+++ glib/gmacros.h Mon Jun 27 15:46:33 2011
@@ -86,8 +86,13 @@
__attribute__((__noreturn__))
#define G_GNUC_CONST \
__attribute__((__const__))
@ -23,19 +15,3 @@ $OpenBSD: patch-glib_gmacros_h,v 1.13 2010/09/30 07:17:19 ajacoutot Exp $
#define G_GNUC_NO_INSTRUMENT \
__attribute__((__no_instrument_function__))
#else /* !__GNUC__ */
@@ -194,11 +200,13 @@
#define TRUE (!FALSE)
#endif
-#undef MAX
+#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
-#undef MIN
+#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
#undef ABS
#define ABS(a) (((a) < 0) ? -(a) : (a))

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-glib_gslice_c,v 1.1 2011/04/28 13:07:53 ajacoutot Exp $
Redefinition of ALIGN in /usr/include/machine/param.h.
--- glib/gslice.c.orig Wed Apr 27 18:55:44 2011
+++ glib/gslice.c Wed Apr 27 18:58:27 2011
@@ -53,6 +53,10 @@
#include "gthreadprivate.h"
#include "glib_trace.h"
+#ifdef ALIGN
+#undef ALIGN
+#endif
+
/* the GSlice allocator is split up into 4 layers, roughly modelled after the slab
* allocator and magazine extensions as outlined in:
* + [Bonwick94] Jeff Bonwick, The slab allocator: An object-caching kernel