1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
$NetBSD: patch-aa,v 1.1.1.1 2008/11/22 17:54:42 jmcneill Exp $
--- src/gnome-mount-properties-view.c.orig 2008-02-25 16:55:05.000000000 -0500
+++ src/gnome-mount-properties-view.c
@@ -35,7 +35,7 @@
#include <string.h>
#include <gconf/gconf-client.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <fstab.h>
#include <sys/param.h>
#include <sys/ucred.h>
@@ -59,6 +59,30 @@ struct _GnomeMountPropertiesViewClass {
GtkVBoxClass base_class;
};
+#ifdef __NetBSD__
+static struct opt {
+ int o_opt;
+ const char *o_name;
+} optnames[] = {
+ { MNT_ASYNC, "async" },
+ { MNT_NOCOREDUMP, "nocoredump" },
+ { MNT_NODEV, "nodev" },
+ { MNT_NODEVMTIME, "nodevmtime" },
+ { MNT_NOEXEC, "noexec" },
+ { MNT_NOSUID, "nosuid" },
+ { MNT_RDONLY, "rdonly" },
+ { MNT_SYNCHRONOUS, "sync" },
+ { MNT_UNION, "union" },
+ { MNT_NOATIME, "noatime" },
+ { MNT_SYMPERM, "symperm" },
+ { MNT_SOFTDEP, "softdep" },
+#ifdef MNT_LOG
+ { MNT_LOG, "log" },
+#endif
+ { MNT_IGNORE, "hidden" },
+ { 0, NULL }
+};
+#endif
#ifdef __FreeBSD__
static struct opt {
int o_opt;
@@ -345,6 +369,14 @@ struct mtab_handle
int iter;
};
#endif
+#ifdef __NetBSD__
+struct mtab_handle
+{
+ struct statvfs *mounts;
+ int n_mounts;
+ int iter;
+};
+#endif
/* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */
static void
@@ -454,7 +486,7 @@ out:
static gboolean
mtab_open (gpointer *handle)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
struct mtab_handle *mtab;
mtab = g_new0 (struct mtab_handle, 1);
@@ -475,7 +507,7 @@ mtab_open (gpointer *handle)
static gboolean
mtab_next (gpointer handle, char **device_file, char **mount_options, char **mount_fstype)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
struct mtab_handle *mtab = handle;
if (mtab->iter < mtab->n_mounts) {
@@ -484,7 +516,11 @@ mtab_next (gpointer handle, char **devic
GString *optstr;
optstr = g_string_new("");
+#if defined(__NetBSD__)
+ flags = mtab->mounts[mtab->iter].f_flag & MNT_VISFLAGMASK;
+#else
flags = mtab->mounts[mtab->iter].f_flags & MNT_VISFLAGMASK;
+#endif
for (o = optnames; flags && o->o_opt; o++) {
if (flags & o->o_opt) {
@@ -517,7 +553,7 @@ mtab_next (gpointer handle, char **devic
static void
mtab_close (gpointer handle)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
g_free (handle);
#else
fclose (handle);
|