diff options
author | Andreas Müller <schnitzeltony@googlemail.com> | 2013-05-03 12:31:04 +0000 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-05-03 16:12:13 +0200 |
commit | 985fb27d51ecb948a195af5b27a3a3f6b5ab3f45 (patch) | |
tree | 7bd3644805fedb4cb7b2a36c5fe305eaef673200 /meta-gnome | |
parent | 285dbc0c2c8634d8a9aa4e7abe24bbebf0f0c549 (diff) | |
download | meta-openembedded-985fb27d51ecb948a195af5b27a3a3f6b5ab3f45.tar.gz |
gvfs: slightly update to 1.10.1 and backport patches to build with glib 2.36
This is a bit of a bad hack but as long as we are sitting on gnome2 we cannot
follow to latest mainline because it would require gnome-disk-utility 3.x which
relies on libnotify 0.7.x. For libnotify 0.6.x / 0.7.x API-conflict there is
no solution available yet.
The following tests were performed:
* build my standard xfce-image from scratch
* test automount
* test trash
* test network browsing
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-gnome')
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/files/0001-Revert-Respect-UDISKS_AUTOMOUNT_HINT-available-in-re.patch | 57 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/files/0001-gvfsfusedaemon.c-fix-glib-build.patch | 31 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/files/0002-Adapt-to-GLib-2.31-deprecations-and-thread-API-chang.patch | 599 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/files/0003-Adapt-to-glib-mutex-API-changes.patch | 2454 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/files/0004-Adapt-to-glib-thread-API-changes.patch | 44 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.10.1.bb (renamed from meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.8.2.bb) | 2 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/gvfs.inc | 15 | ||||
-rw-r--r-- | meta-gnome/recipes-gnome/gvfs/gvfs_1.10.1.bb (renamed from meta-gnome/recipes-gnome/gvfs/gvfs_1.8.2.bb) | 2 |
8 files changed, 3167 insertions, 37 deletions
diff --git a/meta-gnome/recipes-gnome/gvfs/files/0001-Revert-Respect-UDISKS_AUTOMOUNT_HINT-available-in-re.patch b/meta-gnome/recipes-gnome/gvfs/files/0001-Revert-Respect-UDISKS_AUTOMOUNT_HINT-available-in-re.patch new file mode 100644 index 000000000..a5c655671 --- /dev/null +++ b/meta-gnome/recipes-gnome/gvfs/files/0001-Revert-Respect-UDISKS_AUTOMOUNT_HINT-available-in-re.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 1b9ceef87405296adccdadc9528d4cbb2bc51b76 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
3 | Date: Thu, 2 May 2013 13:27:16 +0200 | ||
4 | Subject: [PATCH] Revert "Respect UDISKS_AUTOMOUNT_HINT available in recent | ||
5 | udisks and gnome-disk-utility" | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | This reverts commit 493ee806eba214a748d064b43c10882d76ee1492. | ||
11 | |||
12 | AFAICS was the requirement for gnome-disk-utility V3 for a minor functionality change. | ||
13 | |||
14 | Upstream-Status: Inappropriate [related to missing gnome3 support] | ||
15 | |||
16 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
17 | --- | ||
18 | configure.ac | 2 +- | ||
19 | monitor/gdu/ggduvolume.c | 9 --------- | ||
20 | 2 files changed, 1 insertions(+), 10 deletions(-) | ||
21 | |||
22 | diff --git a/configure.ac b/configure.ac | ||
23 | index 601e994..377770e 100644 | ||
24 | --- a/configure.ac | ||
25 | +++ b/configure.ac | ||
26 | @@ -205,7 +205,7 @@ AC_ARG_ENABLE(gdu, AS_HELP_STRING([--disable-gdu],[build without GDU volume moni | ||
27 | msg_gdu=no | ||
28 | GDU_LIBS= | ||
29 | GDU_CFLAGS= | ||
30 | -GDU_REQUIRED=3.0.2 | ||
31 | +GDU_REQUIRED=2.29.0 | ||
32 | |||
33 | if test "x$enable_gdu" != "xno"; then | ||
34 | PKG_CHECK_EXISTS([gdu >= $GDU_REQUIRED], msg_gdu=yes) | ||
35 | diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c | ||
36 | index eb15d22..0665b7a 100644 | ||
37 | --- a/monitor/gdu/ggduvolume.c | ||
38 | +++ b/monitor/gdu/ggduvolume.c | ||
39 | @@ -429,15 +429,6 @@ update_volume (GGduVolume *volume) | ||
40 | g_free (activation_uri); | ||
41 | } | ||
42 | |||
43 | - /* if there's an automount hint, use it */ | ||
44 | - if (device != NULL) | ||
45 | - { | ||
46 | - if (g_strcmp0 (gdu_device_get_automount_hint (device), "always") == 0) | ||
47 | - volume->should_automount = TRUE; | ||
48 | - else if (g_strcmp0 (gdu_device_get_automount_hint (device), "never") == 0) | ||
49 | - volume->should_automount = FALSE; | ||
50 | - } | ||
51 | - | ||
52 | if (pool != NULL) | ||
53 | g_object_unref (pool); | ||
54 | if (device != NULL) | ||
55 | -- | ||
56 | 1.7.6.5 | ||
57 | |||
diff --git a/meta-gnome/recipes-gnome/gvfs/files/0001-gvfsfusedaemon.c-fix-glib-build.patch b/meta-gnome/recipes-gnome/gvfs/files/0001-gvfsfusedaemon.c-fix-glib-build.patch deleted file mode 100644 index 95d193e1f..000000000 --- a/meta-gnome/recipes-gnome/gvfs/files/0001-gvfsfusedaemon.c-fix-glib-build.patch +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | From c339eaaa514b8edcfe8de5c9610b8f2591ec221a Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
3 | Date: Mon, 14 May 2012 17:36:37 +0200 | ||
4 | Subject: [PATCH] gvfsfusedaemon.c: fix glib build | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | Upstream-Status: Applied but we can not use it because newer versions depend | ||
9 | on gnome-disk-utiltity >= V3.02 which depends on gtk+ V3 | ||
10 | |||
11 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
12 | --- | ||
13 | client/gvfsfusedaemon.c | 2 -- | ||
14 | 1 files changed, 0 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c | ||
17 | index bc3090d..f2e708e 100644 | ||
18 | --- a/client/gvfsfusedaemon.c | ||
19 | +++ b/client/gvfsfusedaemon.c | ||
20 | @@ -41,8 +41,6 @@ | ||
21 | #include <glib/gprintf.h> | ||
22 | #include <gio/gio.h> | ||
23 | |||
24 | -#include <glib/gurifuncs.h> | ||
25 | - | ||
26 | /* stuff from common/ */ | ||
27 | #include <gdaemonmount.h> | ||
28 | #include <gvfsdaemonprotocol.h> | ||
29 | -- | ||
30 | 1.7.6.5 | ||
31 | |||
diff --git a/meta-gnome/recipes-gnome/gvfs/files/0002-Adapt-to-GLib-2.31-deprecations-and-thread-API-chang.patch b/meta-gnome/recipes-gnome/gvfs/files/0002-Adapt-to-GLib-2.31-deprecations-and-thread-API-chang.patch new file mode 100644 index 000000000..0aa927115 --- /dev/null +++ b/meta-gnome/recipes-gnome/gvfs/files/0002-Adapt-to-GLib-2.31-deprecations-and-thread-API-chang.patch | |||
@@ -0,0 +1,599 @@ | |||
1 | From bd014bd8a442cae12aace7deb6e6a4d21ac3dd0e Mon Sep 17 00:00:00 2001 | ||
2 | From: Matthias Clasen <mclasen@redhat.com> | ||
3 | Date: Fri, 21 Oct 2011 14:15:09 +0200 | ||
4 | Subject: [PATCH] Adapt to GLib 2.31 deprecations and thread API changes | ||
5 | |||
6 | GStaticMutex and GStaticRWLock have been replaced by GMutex | ||
7 | and GRWLock, and g_thread_init() is no longer needed. | ||
8 | |||
9 | https://bugzilla.gnome.org/show_bug.cgi?id=661148 | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | |||
13 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
14 | --- | ||
15 | client/gdaemonvfs.c | 5 +- | ||
16 | client/gvfsdaemondbus.c | 15 ++++--- | ||
17 | client/gvfsfusedaemon.c | 1 - | ||
18 | common/gmounttracker.c | 43 ++++++------------ | ||
19 | configure.ac | 2 +- | ||
20 | daemon/daemon-main.c | 1 - | ||
21 | daemon/gvfsdaemonutils.c | 8 ++-- | ||
22 | daemon/main.c | 2 - | ||
23 | metadata/metatree.c | 60 +++++++++++++------------- | ||
24 | monitor/proxy/gvfsproxyvolumemonitordaemon.c | 1 - | ||
25 | 10 files changed, 60 insertions(+), 78 deletions(-) | ||
26 | |||
27 | diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c | ||
28 | index 0f021b9..ae17c3c 100644 | ||
29 | --- a/client/gdaemonvfs.c | ||
30 | +++ b/client/gdaemonvfs.c | ||
31 | @@ -298,9 +298,8 @@ g_daemon_vfs_init (GDaemonVfs *vfs) | ||
32 | |||
33 | bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR); | ||
34 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); | ||
35 | - | ||
36 | - if (g_thread_supported ()) | ||
37 | - dbus_threads_init_default (); | ||
38 | + | ||
39 | + dbus_threads_init_default (); | ||
40 | |||
41 | vfs->async_bus = dbus_bus_get_private (DBUS_BUS_SESSION, NULL); | ||
42 | |||
43 | diff --git a/client/gvfsdaemondbus.c b/client/gvfsdaemondbus.c | ||
44 | index f32a6f8..2cfd2e6 100644 | ||
45 | --- a/client/gvfsdaemondbus.c | ||
46 | +++ b/client/gvfsdaemondbus.c | ||
47 | @@ -53,7 +53,10 @@ typedef struct { | ||
48 | static gint32 vfs_data_slot = -1; | ||
49 | static GOnce once_init_dbus = G_ONCE_INIT; | ||
50 | |||
51 | -static GStaticPrivate local_connections = G_STATIC_PRIVATE_INIT; | ||
52 | +typedef struct _ThreadLocalConnections ThreadLocalConnections; | ||
53 | +static void free_local_connections (ThreadLocalConnections *local); | ||
54 | + | ||
55 | +static GPrivate local_connections = G_PRIVATE_INIT((GDestroyNotify)free_local_connections); | ||
56 | |||
57 | /* dbus id -> async connection */ | ||
58 | static GHashTable *async_map = NULL; | ||
59 | @@ -862,10 +865,10 @@ _g_vfs_daemon_call_sync (DBusMessage *message, | ||
60 | * get per-thread synchronous dbus connections * | ||
61 | *************************************************************************/ | ||
62 | |||
63 | -typedef struct { | ||
64 | +struct _ThreadLocalConnections { | ||
65 | GHashTable *connections; | ||
66 | DBusConnection *session_bus; | ||
67 | -} ThreadLocalConnections; | ||
68 | +}; | ||
69 | |||
70 | static void | ||
71 | free_mount_connection (DBusConnection *conn) | ||
72 | @@ -891,7 +894,7 @@ invalidate_local_connection (const char *dbus_id, | ||
73 | |||
74 | _g_daemon_vfs_invalidate_dbus_id (dbus_id); | ||
75 | |||
76 | - local = g_static_private_get (&local_connections); | ||
77 | + local = g_private_get (&local_connections); | ||
78 | if (local) | ||
79 | g_hash_table_remove (local->connections, dbus_id); | ||
80 | |||
81 | @@ -916,13 +919,13 @@ _g_dbus_connection_get_sync (const char *dbus_id, | ||
82 | |||
83 | g_once (&once_init_dbus, vfs_dbus_init, NULL); | ||
84 | |||
85 | - local = g_static_private_get (&local_connections); | ||
86 | + local = g_private_get (&local_connections); | ||
87 | if (local == NULL) | ||
88 | { | ||
89 | local = g_new0 (ThreadLocalConnections, 1); | ||
90 | local->connections = g_hash_table_new_full (g_str_hash, g_str_equal, | ||
91 | g_free, (GDestroyNotify)free_mount_connection); | ||
92 | - g_static_private_set (&local_connections, local, (GDestroyNotify)free_local_connections); | ||
93 | + g_private_set (&local_connections, local); | ||
94 | } | ||
95 | |||
96 | if (dbus_id == NULL) | ||
97 | diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c | ||
98 | index a4ba32c..7cfa81c 100644 | ||
99 | --- a/client/gvfsfusedaemon.c | ||
100 | +++ b/client/gvfsfusedaemon.c | ||
101 | @@ -2425,7 +2425,6 @@ gint | ||
102 | main (gint argc, gchar *argv []) | ||
103 | { | ||
104 | g_type_init (); | ||
105 | - g_thread_init (NULL); | ||
106 | |||
107 | return fuse_main (argc, argv, &vfs_oper, NULL /* user data */); | ||
108 | } | ||
109 | diff --git a/common/gmounttracker.c b/common/gmounttracker.c | ||
110 | index 519cd47..135a2b2 100644 | ||
111 | --- a/common/gmounttracker.c | ||
112 | +++ b/common/gmounttracker.c | ||
113 | @@ -49,7 +49,7 @@ struct _GMountTracker | ||
114 | { | ||
115 | GObject parent_instance; | ||
116 | |||
117 | - GMutex *lock; | ||
118 | + GMutex lock; | ||
119 | GList *mounts; | ||
120 | DBusConnection *connection; | ||
121 | }; | ||
122 | @@ -258,8 +258,7 @@ g_mount_tracker_finalize (GObject *object) | ||
123 | |||
124 | tracker = G_MOUNT_TRACKER (object); | ||
125 | |||
126 | - if (tracker->lock) | ||
127 | - g_mutex_free (tracker->lock); | ||
128 | + g_mutex_clear (&tracker->lock); | ||
129 | |||
130 | g_list_foreach (tracker->mounts, | ||
131 | (GFunc)g_mount_info_unref, NULL); | ||
132 | @@ -382,21 +381,18 @@ static void | ||
133 | g_mount_tracker_add_mount (GMountTracker *tracker, | ||
134 | GMountInfo *info) | ||
135 | { | ||
136 | - if (tracker->lock) | ||
137 | - g_mutex_lock (tracker->lock); | ||
138 | + g_mutex_lock (&tracker->lock); | ||
139 | |||
140 | /* Don't add multiple times */ | ||
141 | if (g_mount_tracker_find (tracker, info)) | ||
142 | { | ||
143 | - if (tracker->lock) | ||
144 | - g_mutex_unlock (tracker->lock); | ||
145 | + g_mutex_unlock (&tracker->lock); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | tracker->mounts = g_list_prepend (tracker->mounts, g_mount_info_ref (info)); | ||
150 | |||
151 | - if (tracker->lock) | ||
152 | - g_mutex_unlock (tracker->lock); | ||
153 | + g_mutex_unlock (&tracker->lock); | ||
154 | |||
155 | g_signal_emit (tracker, signals[MOUNTED], 0, info); | ||
156 | } | ||
157 | @@ -408,16 +404,14 @@ g_mount_tracker_remove_mount (GMountTracker *tracker, | ||
158 | GList *l; | ||
159 | GMountInfo *old_info; | ||
160 | |||
161 | - if (tracker->lock) | ||
162 | - g_mutex_lock (tracker->lock); | ||
163 | + g_mutex_lock (&tracker->lock); | ||
164 | |||
165 | l = g_mount_tracker_find (tracker, info); | ||
166 | |||
167 | /* Don't remove multiple times */ | ||
168 | if (l == NULL) | ||
169 | { | ||
170 | - if (tracker->lock) | ||
171 | - g_mutex_unlock (tracker->lock); | ||
172 | + g_mutex_unlock (&tracker->lock); | ||
173 | return; | ||
174 | } | ||
175 | |||
176 | @@ -425,8 +419,7 @@ g_mount_tracker_remove_mount (GMountTracker *tracker, | ||
177 | |||
178 | tracker->mounts = g_list_delete_link (tracker->mounts, l); | ||
179 | |||
180 | - if (tracker->lock) | ||
181 | - g_mutex_unlock (tracker->lock); | ||
182 | + g_mutex_unlock (&tracker->lock); | ||
183 | |||
184 | g_signal_emit (tracker, signals[UNMOUNTED], 0, old_info); | ||
185 | g_mount_info_unref (old_info); | ||
186 | @@ -548,8 +541,6 @@ init_connection (GMountTracker *tracker) | ||
187 | static void | ||
188 | g_mount_tracker_init (GMountTracker *tracker) | ||
189 | { | ||
190 | - if (g_thread_supported ()) | ||
191 | - tracker->lock = g_mutex_new (); | ||
192 | } | ||
193 | |||
194 | |||
195 | @@ -588,8 +579,7 @@ g_mount_tracker_list_mounts (GMountTracker *tracker) | ||
196 | GList *res, *l; | ||
197 | GMountInfo *copy; | ||
198 | |||
199 | - if (tracker->lock) | ||
200 | - g_mutex_lock (tracker->lock); | ||
201 | + g_mutex_lock (&tracker->lock); | ||
202 | |||
203 | res = NULL; | ||
204 | for (l = tracker->mounts; l != NULL; l = l->next) | ||
205 | @@ -598,8 +588,7 @@ g_mount_tracker_list_mounts (GMountTracker *tracker) | ||
206 | res = g_list_prepend (res, copy); | ||
207 | } | ||
208 | |||
209 | - if (tracker->lock) | ||
210 | - g_mutex_unlock (tracker->lock); | ||
211 | + g_mutex_unlock (&tracker->lock); | ||
212 | |||
213 | return g_list_reverse (res); | ||
214 | } | ||
215 | @@ -611,8 +600,7 @@ g_mount_tracker_find_by_mount_spec (GMountTracker *tracker, | ||
216 | GList *l; | ||
217 | GMountInfo *info, *found; | ||
218 | |||
219 | - if (tracker->lock) | ||
220 | - g_mutex_lock (tracker->lock); | ||
221 | + g_mutex_lock (&tracker->lock); | ||
222 | |||
223 | found = NULL; | ||
224 | for (l = tracker->mounts; l != NULL; l = l->next) | ||
225 | @@ -626,8 +614,7 @@ g_mount_tracker_find_by_mount_spec (GMountTracker *tracker, | ||
226 | } | ||
227 | } | ||
228 | |||
229 | - if (tracker->lock) | ||
230 | - g_mutex_unlock (tracker->lock); | ||
231 | + g_mutex_unlock (&tracker->lock); | ||
232 | |||
233 | return found; | ||
234 | } | ||
235 | @@ -641,8 +628,7 @@ g_mount_tracker_has_mount_spec (GMountTracker *tracker, | ||
236 | GMountInfo *info; | ||
237 | gboolean found; | ||
238 | |||
239 | - if (tracker->lock) | ||
240 | - g_mutex_lock (tracker->lock); | ||
241 | + g_mutex_lock (&tracker->lock); | ||
242 | |||
243 | found = FALSE; | ||
244 | for (l = tracker->mounts; l != NULL; l = l->next) | ||
245 | @@ -656,8 +642,7 @@ g_mount_tracker_has_mount_spec (GMountTracker *tracker, | ||
246 | } | ||
247 | } | ||
248 | |||
249 | - if (tracker->lock) | ||
250 | - g_mutex_unlock (tracker->lock); | ||
251 | + g_mutex_unlock (&tracker->lock); | ||
252 | |||
253 | return found; | ||
254 | } | ||
255 | diff --git a/configure.ac b/configure.ac | ||
256 | index ee2f90f..be0c6a1 100644 | ||
257 | --- a/configure.ac | ||
258 | +++ b/configure.ac | ||
259 | @@ -46,7 +46,7 @@ GTK_DOC_CHECK | ||
260 | DISTCHECK_CONFIGURE_FLAGS="--enable-gtk-doc" | ||
261 | AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) | ||
262 | |||
263 | -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.29.14 gthread-2.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0 ) | ||
264 | +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.31.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0 ) | ||
265 | |||
266 | PKG_CHECK_MODULES(DBUS, dbus-1) | ||
267 | |||
268 | diff --git a/daemon/daemon-main.c b/daemon/daemon-main.c | ||
269 | index ef9025c..ff2bfde 100644 | ||
270 | --- a/daemon/daemon-main.c | ||
271 | +++ b/daemon/daemon-main.c | ||
272 | @@ -63,7 +63,6 @@ daemon_init (void) | ||
273 | textdomain (GETTEXT_PACKAGE); | ||
274 | |||
275 | dbus_threads_init_default (); | ||
276 | - g_thread_init (NULL); | ||
277 | g_type_init (); | ||
278 | |||
279 | g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, log_debug, NULL); | ||
280 | diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c | ||
281 | index f03d4b2..1efcf87 100644 | ||
282 | --- a/daemon/gvfsdaemonutils.c | ||
283 | +++ b/daemon/gvfsdaemonutils.c | ||
284 | @@ -41,7 +41,7 @@ | ||
285 | #include "gvfsdaemonprotocol.h" | ||
286 | |||
287 | static gint32 extra_fd_slot = -1; | ||
288 | -static GStaticMutex extra_lock = G_STATIC_MUTEX_INIT; | ||
289 | +static GMutex extra_lock; | ||
290 | |||
291 | typedef struct { | ||
292 | int extra_fd; | ||
293 | @@ -93,7 +93,7 @@ dbus_connection_send_fd (DBusConnection *connection, | ||
294 | return FALSE; | ||
295 | } | ||
296 | |||
297 | - g_static_mutex_lock (&extra_lock); | ||
298 | + g_mutex_lock (&extra_lock); | ||
299 | |||
300 | if (_g_socket_send_fd (extra->extra_fd, fd) == -1) | ||
301 | { | ||
302 | @@ -103,13 +103,13 @@ dbus_connection_send_fd (DBusConnection *connection, | ||
303 | g_io_error_from_errno (errsv), | ||
304 | _("Error sending file descriptor: %s"), | ||
305 | g_strerror (errsv)); | ||
306 | - g_static_mutex_unlock (&extra_lock); | ||
307 | + g_mutex_unlock (&extra_lock); | ||
308 | return FALSE; | ||
309 | } | ||
310 | |||
311 | *fd_id = extra->fd_count++; | ||
312 | |||
313 | - g_static_mutex_unlock (&extra_lock); | ||
314 | + g_mutex_unlock (&extra_lock); | ||
315 | |||
316 | return TRUE; | ||
317 | } | ||
318 | diff --git a/daemon/main.c b/daemon/main.c | ||
319 | index 4703562..2b2d549 100644 | ||
320 | --- a/daemon/main.c | ||
321 | +++ b/daemon/main.c | ||
322 | @@ -52,8 +52,6 @@ main (int argc, char *argv[]) | ||
323 | bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR); | ||
324 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); | ||
325 | textdomain (GETTEXT_PACKAGE); | ||
326 | - | ||
327 | - g_thread_init (NULL); | ||
328 | |||
329 | #ifdef SIGPIPE | ||
330 | signal (SIGPIPE, SIG_IGN); | ||
331 | diff --git a/metadata/metatree.c b/metadata/metatree.c | ||
332 | index 3420ad0..850866e 100644 | ||
333 | --- a/metadata/metatree.c | ||
334 | +++ b/metadata/metatree.c | ||
335 | @@ -68,7 +68,7 @@ | ||
336 | |||
337 | #define KEY_IS_LIST_MASK (1<<31) | ||
338 | |||
339 | -static GStaticRWLock metatree_lock = G_STATIC_RW_LOCK_INIT; | ||
340 | +static GRWLock metatree_lock; | ||
341 | |||
342 | typedef enum { | ||
343 | JOURNAL_OP_SET_KEY, | ||
344 | @@ -591,7 +591,7 @@ meta_tree_lookup_by_name (const char *name, | ||
345 | MetaTree * | ||
346 | meta_tree_ref (MetaTree *tree) | ||
347 | { | ||
348 | - g_atomic_int_exchange_and_add ((int *)&tree->ref_count, 1); | ||
349 | + g_atomic_int_inc ((int *)&tree->ref_count); | ||
350 | return tree; | ||
351 | } | ||
352 | |||
353 | @@ -672,17 +672,17 @@ meta_tree_refresh (MetaTree *tree) | ||
354 | { | ||
355 | gboolean needs_refresh; | ||
356 | |||
357 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
358 | + g_rw_lock_reader_lock (&metatree_lock); | ||
359 | needs_refresh = | ||
360 | meta_tree_needs_rereading (tree) || | ||
361 | meta_tree_has_new_journal_entries (tree); | ||
362 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
363 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
364 | |||
365 | if (needs_refresh) | ||
366 | { | ||
367 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
368 | + g_rw_lock_writer_lock (&metatree_lock); | ||
369 | meta_tree_refresh_locked (tree); | ||
370 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
371 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
372 | } | ||
373 | } | ||
374 | |||
375 | @@ -1468,7 +1468,7 @@ meta_tree_lookup_key_type (MetaTree *tree, | ||
376 | MetaKeyType type; | ||
377 | gpointer value; | ||
378 | |||
379 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
380 | + g_rw_lock_reader_lock (&metatree_lock); | ||
381 | |||
382 | new_path = meta_journal_reverse_map_path_and_key (tree->journal, | ||
383 | path, | ||
384 | @@ -1492,7 +1492,7 @@ meta_tree_lookup_key_type (MetaTree *tree, | ||
385 | type = META_KEY_TYPE_STRING; | ||
386 | |||
387 | out: | ||
388 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
389 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
390 | return type; | ||
391 | } | ||
392 | |||
393 | @@ -1506,7 +1506,7 @@ meta_tree_get_last_changed (MetaTree *tree, | ||
394 | gpointer value; | ||
395 | guint64 res, mtime; | ||
396 | |||
397 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
398 | + g_rw_lock_reader_lock (&metatree_lock); | ||
399 | |||
400 | new_path = meta_journal_reverse_map_path_and_key (tree->journal, | ||
401 | path, | ||
402 | @@ -1526,7 +1526,7 @@ meta_tree_get_last_changed (MetaTree *tree, | ||
403 | g_free (new_path); | ||
404 | |||
405 | out: | ||
406 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
407 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
408 | |||
409 | return res; | ||
410 | } | ||
411 | @@ -1543,7 +1543,7 @@ meta_tree_lookup_string (MetaTree *tree, | ||
412 | char *new_path; | ||
413 | char *res; | ||
414 | |||
415 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
416 | + g_rw_lock_reader_lock (&metatree_lock); | ||
417 | |||
418 | new_path = meta_journal_reverse_map_path_and_key (tree->journal, | ||
419 | path, | ||
420 | @@ -1572,7 +1572,7 @@ meta_tree_lookup_string (MetaTree *tree, | ||
421 | res = g_strdup (verify_string (tree, ent->value)); | ||
422 | |||
423 | out: | ||
424 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
425 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
426 | |||
427 | return res; | ||
428 | } | ||
429 | @@ -1621,7 +1621,7 @@ meta_tree_lookup_stringv (MetaTree *tree, | ||
430 | char **res; | ||
431 | guint32 num_strings, i; | ||
432 | |||
433 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
434 | + g_rw_lock_reader_lock (&metatree_lock); | ||
435 | |||
436 | new_path = meta_journal_reverse_map_path_and_key (tree->journal, | ||
437 | path, | ||
438 | @@ -1658,7 +1658,7 @@ meta_tree_lookup_stringv (MetaTree *tree, | ||
439 | } | ||
440 | |||
441 | out: | ||
442 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
443 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
444 | |||
445 | return res; | ||
446 | } | ||
447 | @@ -1876,7 +1876,7 @@ meta_tree_enumerate_dir (MetaTree *tree, | ||
448 | MetaFileDir *dir; | ||
449 | char *res_path; | ||
450 | |||
451 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
452 | + g_rw_lock_reader_lock (&metatree_lock); | ||
453 | |||
454 | data.children = children = | ||
455 | g_hash_table_new_full (g_str_hash, | ||
456 | @@ -1922,7 +1922,7 @@ meta_tree_enumerate_dir (MetaTree *tree, | ||
457 | out: | ||
458 | g_free (res_path); | ||
459 | g_hash_table_destroy (children); | ||
460 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
461 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
462 | } | ||
463 | |||
464 | typedef struct { | ||
465 | @@ -2116,7 +2116,7 @@ meta_tree_enumerate_keys (MetaTree *tree, | ||
466 | GHashTableIter iter; | ||
467 | char *res_path; | ||
468 | |||
469 | - g_static_rw_lock_reader_lock (&metatree_lock); | ||
470 | + g_rw_lock_reader_lock (&metatree_lock); | ||
471 | |||
472 | keydata.keys = keys = | ||
473 | g_hash_table_new_full (g_str_hash, | ||
474 | @@ -2170,7 +2170,7 @@ meta_tree_enumerate_keys (MetaTree *tree, | ||
475 | out: | ||
476 | g_free (res_path); | ||
477 | g_hash_table_destroy (keys); | ||
478 | - g_static_rw_lock_reader_unlock (&metatree_lock); | ||
479 | + g_rw_lock_reader_unlock (&metatree_lock); | ||
480 | } | ||
481 | |||
482 | |||
483 | @@ -2371,9 +2371,9 @@ meta_tree_flush (MetaTree *tree) | ||
484 | { | ||
485 | gboolean res; | ||
486 | |||
487 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
488 | + g_rw_lock_writer_lock (&metatree_lock); | ||
489 | res = meta_tree_flush_locked (tree); | ||
490 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
491 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
492 | return res; | ||
493 | } | ||
494 | |||
495 | @@ -2386,7 +2386,7 @@ meta_tree_unset (MetaTree *tree, | ||
496 | guint64 mtime; | ||
497 | gboolean res; | ||
498 | |||
499 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
500 | + g_rw_lock_writer_lock (&metatree_lock); | ||
501 | |||
502 | if (tree->journal == NULL || | ||
503 | !tree->journal->journal_valid) | ||
504 | @@ -2412,7 +2412,7 @@ meta_tree_unset (MetaTree *tree, | ||
505 | g_string_free (entry, TRUE); | ||
506 | |||
507 | out: | ||
508 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
509 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
510 | return res; | ||
511 | } | ||
512 | |||
513 | @@ -2426,7 +2426,7 @@ meta_tree_set_string (MetaTree *tree, | ||
514 | guint64 mtime; | ||
515 | gboolean res; | ||
516 | |||
517 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
518 | + g_rw_lock_writer_lock (&metatree_lock); | ||
519 | |||
520 | if (tree->journal == NULL || | ||
521 | !tree->journal->journal_valid) | ||
522 | @@ -2452,7 +2452,7 @@ meta_tree_set_string (MetaTree *tree, | ||
523 | g_string_free (entry, TRUE); | ||
524 | |||
525 | out: | ||
526 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
527 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
528 | return res; | ||
529 | } | ||
530 | |||
531 | @@ -2466,7 +2466,7 @@ meta_tree_set_stringv (MetaTree *tree, | ||
532 | guint64 mtime; | ||
533 | gboolean res; | ||
534 | |||
535 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
536 | + g_rw_lock_writer_lock (&metatree_lock); | ||
537 | |||
538 | if (tree->journal == NULL || | ||
539 | !tree->journal->journal_valid) | ||
540 | @@ -2492,7 +2492,7 @@ meta_tree_set_stringv (MetaTree *tree, | ||
541 | g_string_free (entry, TRUE); | ||
542 | |||
543 | out: | ||
544 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
545 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
546 | return res; | ||
547 | } | ||
548 | |||
549 | @@ -2504,7 +2504,7 @@ meta_tree_remove (MetaTree *tree, | ||
550 | guint64 mtime; | ||
551 | gboolean res; | ||
552 | |||
553 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
554 | + g_rw_lock_writer_lock (&metatree_lock); | ||
555 | |||
556 | if (tree->journal == NULL || | ||
557 | !tree->journal->journal_valid) | ||
558 | @@ -2530,7 +2530,7 @@ meta_tree_remove (MetaTree *tree, | ||
559 | g_string_free (entry, TRUE); | ||
560 | |||
561 | out: | ||
562 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
563 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
564 | return res; | ||
565 | } | ||
566 | |||
567 | @@ -2543,7 +2543,7 @@ meta_tree_copy (MetaTree *tree, | ||
568 | guint64 mtime; | ||
569 | gboolean res; | ||
570 | |||
571 | - g_static_rw_lock_writer_lock (&metatree_lock); | ||
572 | + g_rw_lock_writer_lock (&metatree_lock); | ||
573 | |||
574 | if (tree->journal == NULL || | ||
575 | !tree->journal->journal_valid) | ||
576 | @@ -2569,7 +2569,7 @@ meta_tree_copy (MetaTree *tree, | ||
577 | g_string_free (entry, TRUE); | ||
578 | |||
579 | out: | ||
580 | - g_static_rw_lock_writer_unlock (&metatree_lock); | ||
581 | + g_rw_lock_writer_unlock (&metatree_lock); | ||
582 | return res; | ||
583 | } | ||
584 | |||
585 | diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c | ||
586 | index 4be64e0..fe2f1a7 100644 | ||
587 | --- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c | ||
588 | +++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c | ||
589 | @@ -2050,7 +2050,6 @@ g_vfs_proxy_volume_monitor_daemon_init (void) | ||
590 | textdomain (GETTEXT_PACKAGE); | ||
591 | |||
592 | dbus_threads_init_default (); | ||
593 | - g_thread_init (NULL); | ||
594 | g_type_init (); | ||
595 | } | ||
596 | |||
597 | -- | ||
598 | 1.7.6.5 | ||
599 | |||
diff --git a/meta-gnome/recipes-gnome/gvfs/files/0003-Adapt-to-glib-mutex-API-changes.patch b/meta-gnome/recipes-gnome/gvfs/files/0003-Adapt-to-glib-mutex-API-changes.patch new file mode 100644 index 000000000..bb5d9c23d --- /dev/null +++ b/meta-gnome/recipes-gnome/gvfs/files/0003-Adapt-to-glib-mutex-API-changes.patch | |||
@@ -0,0 +1,2454 @@ | |||
1 | From 185c4ac9c83aac035d2b49ecd95130aa5167e7c2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tomas Bzatek <tbzatek@redhat.com> | ||
3 | Date: Tue, 25 Oct 2011 18:41:47 +0200 | ||
4 | Subject: [PATCH 1/2] Adapt to glib mutex API changes | ||
5 | |||
6 | A continuation to https://bugzilla.gnome.org/show_bug.cgi?id=661148 | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | |||
10 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
11 | --- | ||
12 | client/gvfsfusedaemon.c | 80 ++++++++--------- | ||
13 | common/gmountsource.c | 60 ++++++------- | ||
14 | daemon/gvfsbackendafc.c | 22 ++--- | ||
15 | daemon/gvfsbackendftp.c | 12 +-- | ||
16 | daemon/gvfsbackendftp.h | 4 +- | ||
17 | daemon/gvfsbackendgphoto2.c | 112 +++++++++++------------- | ||
18 | daemon/gvfsbackendnetwork.c | 10 +-- | ||
19 | daemon/gvfsbackendobexftp.c | 187 ++++++++++++++++++++-------------------- | ||
20 | daemon/gvfsbackendsmbbrowse.c | 39 ++++----- | ||
21 | daemon/gvfsdaemon.c | 33 ++++---- | ||
22 | daemon/gvfsftpdircache.c | 21 ++--- | ||
23 | daemon/gvfsftptask.c | 33 ++++---- | ||
24 | daemon/trashlib/trashexpunge.c | 33 ++++---- | ||
25 | daemon/trashlib/trashitem.c | 36 ++++---- | ||
26 | 14 files changed, 325 insertions(+), 357 deletions(-) | ||
27 | |||
28 | diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c | ||
29 | index 7cfa81c..c986f69 100644 | ||
30 | --- a/client/gvfsfusedaemon.c | ||
31 | +++ b/client/gvfsfusedaemon.c | ||
32 | @@ -69,7 +69,7 @@ typedef enum { | ||
33 | typedef struct { | ||
34 | gint refcount; | ||
35 | |||
36 | - GMutex *mutex; | ||
37 | + GMutex mutex; | ||
38 | gchar *path; | ||
39 | FileOp op; | ||
40 | gpointer stream; | ||
41 | @@ -84,13 +84,13 @@ static GVolumeMonitor *volume_monitor = NULL; | ||
42 | |||
43 | /* Contains pointers to MountRecord */ | ||
44 | static GList *mount_list = NULL; | ||
45 | -static GMutex *mount_list_mutex; | ||
46 | +static GMutex mount_list_mutex = {NULL}; | ||
47 | |||
48 | static time_t daemon_creation_time; | ||
49 | static uid_t daemon_uid; | ||
50 | static gid_t daemon_gid; | ||
51 | |||
52 | -static GStaticMutex global_mutex = G_STATIC_MUTEX_INIT; | ||
53 | +static GMutex global_mutex = {NULL}; | ||
54 | static GHashTable *global_path_to_fh_map = NULL; | ||
55 | static GHashTable *global_active_fh_map = NULL; | ||
56 | |||
57 | @@ -212,7 +212,6 @@ file_handle_new (const gchar *path) | ||
58 | |||
59 | file_handle = g_new0 (FileHandle, 1); | ||
60 | file_handle->refcount = 1; | ||
61 | - file_handle->mutex = g_mutex_new (); | ||
62 | file_handle->op = FILE_OP_NONE; | ||
63 | file_handle->path = g_strdup (path); | ||
64 | |||
65 | @@ -235,7 +234,7 @@ file_handle_unref (FileHandle *file_handle) | ||
66 | { | ||
67 | gint refs; | ||
68 | |||
69 | - g_static_mutex_lock (&global_mutex); | ||
70 | + g_mutex_lock (&global_mutex); | ||
71 | |||
72 | /* Test again, since e.g. get_file_handle_for_path() might have | ||
73 | * snatched the global mutex and revived the file handle between | ||
74 | @@ -246,7 +245,7 @@ file_handle_unref (FileHandle *file_handle) | ||
75 | if (refs == 0) | ||
76 | g_hash_table_remove (global_path_to_fh_map, file_handle->path); | ||
77 | |||
78 | - g_static_mutex_unlock (&global_mutex); | ||
79 | + g_mutex_unlock (&global_mutex); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | @@ -283,7 +282,7 @@ file_handle_free (FileHandle *file_handle) | ||
84 | g_hash_table_remove (global_active_fh_map, file_handle); | ||
85 | |||
86 | file_handle_close_stream (file_handle); | ||
87 | - g_mutex_free (file_handle->mutex); | ||
88 | + g_mutex_clear (&file_handle->mutex); | ||
89 | g_free (file_handle->path); | ||
90 | g_free (file_handle); | ||
91 | } | ||
92 | @@ -293,14 +292,14 @@ get_file_handle_for_path (const gchar *path) | ||
93 | { | ||
94 | FileHandle *fh; | ||
95 | |||
96 | - g_static_mutex_lock (&global_mutex); | ||
97 | + g_mutex_lock (&global_mutex); | ||
98 | |||
99 | fh = g_hash_table_lookup (global_path_to_fh_map, path); | ||
100 | |||
101 | if (fh) | ||
102 | file_handle_ref (fh); | ||
103 | |||
104 | - g_static_mutex_unlock (&global_mutex); | ||
105 | + g_mutex_unlock (&global_mutex); | ||
106 | return fh; | ||
107 | } | ||
108 | |||
109 | @@ -309,7 +308,7 @@ get_or_create_file_handle_for_path (const gchar *path) | ||
110 | { | ||
111 | FileHandle *fh; | ||
112 | |||
113 | - g_static_mutex_lock (&global_mutex); | ||
114 | + g_mutex_lock (&global_mutex); | ||
115 | |||
116 | fh = g_hash_table_lookup (global_path_to_fh_map, path); | ||
117 | |||
118 | @@ -323,7 +322,7 @@ get_or_create_file_handle_for_path (const gchar *path) | ||
119 | g_hash_table_insert (global_path_to_fh_map, fh->path, fh); | ||
120 | } | ||
121 | |||
122 | - g_static_mutex_unlock (&global_mutex); | ||
123 | + g_mutex_unlock (&global_mutex); | ||
124 | return fh; | ||
125 | } | ||
126 | |||
127 | @@ -332,7 +331,7 @@ get_file_handle_from_info (struct fuse_file_info *fi) | ||
128 | { | ||
129 | FileHandle *fh; | ||
130 | |||
131 | - g_static_mutex_lock (&global_mutex); | ||
132 | + g_mutex_lock (&global_mutex); | ||
133 | |||
134 | fh = GET_FILE_HANDLE (fi); | ||
135 | |||
136 | @@ -343,7 +342,7 @@ get_file_handle_from_info (struct fuse_file_info *fi) | ||
137 | if (fh) | ||
138 | file_handle_ref (fh); | ||
139 | |||
140 | - g_static_mutex_unlock (&global_mutex); | ||
141 | + g_mutex_unlock (&global_mutex); | ||
142 | return fh; | ||
143 | } | ||
144 | |||
145 | @@ -353,7 +352,7 @@ reindex_file_handle_for_path (const gchar *old_path, const gchar *new_path) | ||
146 | gchar *old_path_internal; | ||
147 | FileHandle *fh; | ||
148 | |||
149 | - g_static_mutex_lock (&global_mutex); | ||
150 | + g_mutex_lock (&global_mutex); | ||
151 | |||
152 | if (!g_hash_table_lookup_extended (global_path_to_fh_map, old_path, | ||
153 | (gpointer *) &old_path_internal, | ||
154 | @@ -368,7 +367,7 @@ reindex_file_handle_for_path (const gchar *old_path, const gchar *new_path) | ||
155 | g_hash_table_insert (global_path_to_fh_map, fh->path, fh); | ||
156 | |||
157 | out: | ||
158 | - g_static_mutex_unlock (&global_mutex); | ||
159 | + g_mutex_unlock (&global_mutex); | ||
160 | } | ||
161 | |||
162 | static MountRecord * | ||
163 | @@ -405,13 +404,13 @@ mount_record_free (MountRecord *mount_record) | ||
164 | static void | ||
165 | mount_list_lock (void) | ||
166 | { | ||
167 | - g_mutex_lock (mount_list_mutex); | ||
168 | + g_mutex_lock (&mount_list_mutex); | ||
169 | } | ||
170 | |||
171 | static void | ||
172 | mount_list_unlock (void) | ||
173 | { | ||
174 | - g_mutex_unlock (mount_list_mutex); | ||
175 | + g_mutex_unlock (&mount_list_mutex); | ||
176 | } | ||
177 | |||
178 | static void | ||
179 | @@ -866,9 +865,9 @@ vfs_getattr (const gchar *path, struct stat *sbuf) | ||
180 | |||
181 | if (fh != NULL) | ||
182 | { | ||
183 | - g_mutex_lock (fh->mutex); | ||
184 | + g_mutex_lock (&fh->mutex); | ||
185 | getattr_for_file_handle (fh, sbuf); | ||
186 | - g_mutex_unlock (fh->mutex); | ||
187 | + g_mutex_unlock (&fh->mutex); | ||
188 | |||
189 | file_handle_unref (fh); | ||
190 | result = 0; | ||
191 | @@ -995,7 +994,7 @@ open_common (const gchar *path, struct fuse_file_info *fi, GFile *file, int outp | ||
192 | gint result; | ||
193 | FileHandle *fh = get_or_create_file_handle_for_path (path); | ||
194 | |||
195 | - g_mutex_lock (fh->mutex); | ||
196 | + g_mutex_lock (&fh->mutex); | ||
197 | |||
198 | SET_FILE_HANDLE (fi, fh); | ||
199 | |||
200 | @@ -1009,7 +1008,7 @@ open_common (const gchar *path, struct fuse_file_info *fi, GFile *file, int outp | ||
201 | else | ||
202 | result = setup_input_stream (file, fh); | ||
203 | |||
204 | - g_mutex_unlock (fh->mutex); | ||
205 | + g_mutex_unlock (&fh->mutex); | ||
206 | |||
207 | /* The added reference to the file handle is released in vfs_release() */ | ||
208 | return result; | ||
209 | @@ -1121,7 +1120,7 @@ vfs_create (const gchar *path, mode_t mode, struct fuse_file_info *fi) | ||
210 | |||
211 | /* Success */ | ||
212 | |||
213 | - g_mutex_lock (fh->mutex); | ||
214 | + g_mutex_lock (&fh->mutex); | ||
215 | |||
216 | SET_FILE_HANDLE (fi, fh); | ||
217 | |||
218 | @@ -1129,7 +1128,7 @@ vfs_create (const gchar *path, mode_t mode, struct fuse_file_info *fi) | ||
219 | fh->stream = file_output_stream; | ||
220 | fh->op = FILE_OP_WRITE; | ||
221 | |||
222 | - g_mutex_unlock (fh->mutex); | ||
223 | + g_mutex_unlock (&fh->mutex); | ||
224 | |||
225 | /* The reference added to the file handle is released in vfs_release() */ | ||
226 | } | ||
227 | @@ -1285,7 +1284,7 @@ vfs_read (const gchar *path, gchar *buf, size_t size, | ||
228 | |||
229 | if (fh) | ||
230 | { | ||
231 | - g_mutex_lock (fh->mutex); | ||
232 | + g_mutex_lock (&fh->mutex); | ||
233 | |||
234 | result = setup_input_stream (file, fh); | ||
235 | |||
236 | @@ -1298,7 +1297,7 @@ vfs_read (const gchar *path, gchar *buf, size_t size, | ||
237 | debug_print ("vfs_read: failed to setup input_stream!\n"); | ||
238 | } | ||
239 | |||
240 | - g_mutex_unlock (fh->mutex); | ||
241 | + g_mutex_unlock (&fh->mutex); | ||
242 | file_handle_unref (fh); | ||
243 | } | ||
244 | else | ||
245 | @@ -1413,7 +1412,7 @@ vfs_write (const gchar *path, const gchar *buf, size_t len, off_t offset, | ||
246 | |||
247 | if (fh) | ||
248 | { | ||
249 | - g_mutex_lock (fh->mutex); | ||
250 | + g_mutex_lock (&fh->mutex); | ||
251 | |||
252 | result = setup_output_stream (file, fh, 0); | ||
253 | if (result == 0) | ||
254 | @@ -1421,7 +1420,7 @@ vfs_write (const gchar *path, const gchar *buf, size_t len, off_t offset, | ||
255 | result = write_stream (fh, buf, len, offset); | ||
256 | } | ||
257 | |||
258 | - g_mutex_unlock (fh->mutex); | ||
259 | + g_mutex_unlock (&fh->mutex); | ||
260 | file_handle_unref (fh); | ||
261 | } | ||
262 | else | ||
263 | @@ -1453,9 +1452,9 @@ vfs_flush (const gchar *path, struct fuse_file_info *fi) | ||
264 | |||
265 | if (fh) | ||
266 | { | ||
267 | - g_mutex_lock (fh->mutex); | ||
268 | + g_mutex_lock (&fh->mutex); | ||
269 | file_handle_close_stream (fh); | ||
270 | - g_mutex_unlock (fh->mutex); | ||
271 | + g_mutex_unlock (&fh->mutex); | ||
272 | |||
273 | /* get_file_handle_from_info () adds a "working ref", so release that. */ | ||
274 | file_handle_unref (fh); | ||
275 | @@ -1474,9 +1473,9 @@ vfs_fsync (const gchar *path, gint sync_data_only, struct fuse_file_info *fi) | ||
276 | |||
277 | if (fh) | ||
278 | { | ||
279 | - g_mutex_lock (fh->mutex); | ||
280 | + g_mutex_lock (&fh->mutex); | ||
281 | file_handle_close_stream (fh); | ||
282 | - g_mutex_unlock (fh->mutex); | ||
283 | + g_mutex_unlock (&fh->mutex); | ||
284 | |||
285 | /* get_file_handle_from_info () adds a "working ref", so release that. */ | ||
286 | file_handle_unref (fh); | ||
287 | @@ -1625,7 +1624,7 @@ vfs_rename (const gchar *old_path, const gchar *new_path) | ||
288 | |||
289 | if (fh) | ||
290 | { | ||
291 | - g_mutex_lock (fh->mutex); | ||
292 | + g_mutex_lock (&fh->mutex); | ||
293 | file_handle_close_stream (fh); | ||
294 | } | ||
295 | |||
296 | @@ -1645,7 +1644,7 @@ vfs_rename (const gchar *old_path, const gchar *new_path) | ||
297 | |||
298 | if (fh) | ||
299 | { | ||
300 | - g_mutex_unlock (fh->mutex); | ||
301 | + g_mutex_unlock (&fh->mutex); | ||
302 | file_handle_unref (fh); | ||
303 | } | ||
304 | |||
305 | @@ -1687,7 +1686,7 @@ vfs_unlink (const gchar *path) | ||
306 | |||
307 | if (fh) | ||
308 | { | ||
309 | - g_mutex_lock (fh->mutex); | ||
310 | + g_mutex_lock (&fh->mutex); | ||
311 | file_handle_close_stream (fh); | ||
312 | } | ||
313 | |||
314 | @@ -1695,7 +1694,7 @@ vfs_unlink (const gchar *path) | ||
315 | |||
316 | if (fh) | ||
317 | { | ||
318 | - g_mutex_unlock (fh->mutex); | ||
319 | + g_mutex_unlock (&fh->mutex); | ||
320 | file_handle_unref (fh); | ||
321 | } | ||
322 | |||
323 | @@ -1864,7 +1863,7 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi) | ||
324 | |||
325 | if (fh) | ||
326 | { | ||
327 | - g_mutex_lock (fh->mutex); | ||
328 | + g_mutex_lock (&fh->mutex); | ||
329 | |||
330 | result = setup_output_stream (file, fh, 0); | ||
331 | |||
332 | @@ -1909,7 +1908,7 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi) | ||
333 | } | ||
334 | } | ||
335 | |||
336 | - g_mutex_unlock (fh->mutex); | ||
337 | + g_mutex_unlock (&fh->mutex); | ||
338 | file_handle_unref (fh); | ||
339 | } | ||
340 | else | ||
341 | @@ -1948,7 +1947,7 @@ vfs_truncate (const gchar *path, off_t size) | ||
342 | /* Get a file handle just to lock the path while we're working */ | ||
343 | fh = get_file_handle_for_path (path); | ||
344 | if (fh) | ||
345 | - g_mutex_lock (fh->mutex); | ||
346 | + g_mutex_lock (&fh->mutex); | ||
347 | |||
348 | if (size == 0) | ||
349 | { | ||
350 | @@ -1975,7 +1974,7 @@ vfs_truncate (const gchar *path, off_t size) | ||
351 | |||
352 | if (fh) | ||
353 | { | ||
354 | - g_mutex_unlock (fh->mutex); | ||
355 | + g_mutex_unlock (&fh->mutex); | ||
356 | file_handle_unref (fh); | ||
357 | } | ||
358 | |||
359 | @@ -2315,7 +2314,6 @@ vfs_init (struct fuse_conn_info *conn) | ||
360 | daemon_uid = getuid (); | ||
361 | daemon_gid = getgid (); | ||
362 | |||
363 | - mount_list_mutex = g_mutex_new (); | ||
364 | global_path_to_fh_map = g_hash_table_new_full (g_str_hash, g_str_equal, | ||
365 | NULL, (GDestroyNotify) file_handle_free); | ||
366 | global_active_fh_map = g_hash_table_new_full (g_direct_hash, g_direct_equal, | ||
367 | @@ -2374,7 +2372,7 @@ vfs_destroy (gpointer param) | ||
368 | mount_list_free (); | ||
369 | if (subthread_main_loop != NULL) | ||
370 | g_main_loop_quit (subthread_main_loop); | ||
371 | - g_mutex_free (mount_list_mutex); | ||
372 | + g_mutex_clear (&mount_list_mutex); | ||
373 | g_object_unref (gvfs); | ||
374 | } | ||
375 | |||
376 | diff --git a/common/gmountsource.c b/common/gmountsource.c | ||
377 | index d228726..af89ed2 100644 | ||
378 | --- a/common/gmountsource.c | ||
379 | +++ b/common/gmountsource.c | ||
380 | @@ -27,6 +27,8 @@ | ||
381 | #include <gio/gio.h> | ||
382 | #include <gvfsdaemonprotocol.h> | ||
383 | |||
384 | +#include <string.h> | ||
385 | + | ||
386 | struct _GMountSource | ||
387 | { | ||
388 | GObject parent_instance; | ||
389 | @@ -137,8 +139,8 @@ typedef struct AskSyncData AskSyncData; | ||
390 | struct AskSyncData { | ||
391 | |||
392 | /* For sync calls */ | ||
393 | - GMutex *mutex; | ||
394 | - GCond *cond; | ||
395 | + GMutex mutex; | ||
396 | + GCond cond; | ||
397 | |||
398 | /* results: */ | ||
399 | GAsyncResult *result; | ||
400 | @@ -356,9 +358,9 @@ ask_reply_sync (GObject *source_object, | ||
401 | data->result = g_object_ref (res); | ||
402 | |||
403 | /* Wake up sync call thread */ | ||
404 | - g_mutex_lock (data->mutex); | ||
405 | - g_cond_signal (data->cond); | ||
406 | - g_mutex_unlock (data->mutex); | ||
407 | + g_mutex_lock (&data->mutex); | ||
408 | + g_cond_signal (&data->cond); | ||
409 | + g_mutex_unlock (&data->mutex); | ||
410 | } | ||
411 | |||
412 | gboolean | ||
413 | @@ -375,12 +377,10 @@ g_mount_source_ask_password (GMountSource *source, | ||
414 | GPasswordSave *password_save_out) | ||
415 | { | ||
416 | gboolean handled; | ||
417 | - AskSyncData data = {NULL}; | ||
418 | - | ||
419 | - data.mutex = g_mutex_new (); | ||
420 | - data.cond = g_cond_new (); | ||
421 | + AskSyncData data; | ||
422 | |||
423 | - g_mutex_lock (data.mutex); | ||
424 | + memset (&data, 0, sizeof (data)); | ||
425 | + g_mutex_lock (&data.mutex); | ||
426 | |||
427 | |||
428 | g_mount_source_ask_password_async (source, | ||
429 | @@ -391,11 +391,11 @@ g_mount_source_ask_password (GMountSource *source, | ||
430 | ask_reply_sync, | ||
431 | &data); | ||
432 | |||
433 | - g_cond_wait(data.cond, data.mutex); | ||
434 | - g_mutex_unlock (data.mutex); | ||
435 | + g_cond_wait (&data.cond, &data.mutex); | ||
436 | + g_mutex_unlock (&data.mutex); | ||
437 | |||
438 | - g_cond_free (data.cond); | ||
439 | - g_mutex_free (data.mutex); | ||
440 | + g_cond_clear (&data.cond); | ||
441 | + g_mutex_clear (&data.mutex); | ||
442 | |||
443 | |||
444 | handled = g_mount_source_ask_password_finish (source, | ||
445 | @@ -546,12 +546,10 @@ g_mount_source_ask_question (GMountSource *source, | ||
446 | { | ||
447 | gint choice; | ||
448 | gboolean handled, aborted; | ||
449 | - AskSyncData data = {NULL}; | ||
450 | + AskSyncData data; | ||
451 | |||
452 | - data.mutex = g_mutex_new (); | ||
453 | - data.cond = g_cond_new (); | ||
454 | - | ||
455 | - g_mutex_lock (data.mutex); | ||
456 | + memset (&data, 0, sizeof (data)); | ||
457 | + g_mutex_lock (&data.mutex); | ||
458 | |||
459 | g_mount_source_ask_question_async (source, | ||
460 | message, | ||
461 | @@ -560,11 +558,11 @@ g_mount_source_ask_question (GMountSource *source, | ||
462 | ask_reply_sync, | ||
463 | &data); | ||
464 | |||
465 | - g_cond_wait(data.cond, data.mutex); | ||
466 | - g_mutex_unlock (data.mutex); | ||
467 | + g_cond_wait (&data.cond, &data.mutex); | ||
468 | + g_mutex_unlock (&data.mutex); | ||
469 | |||
470 | - g_cond_free (data.cond); | ||
471 | - g_mutex_free (data.mutex); | ||
472 | + g_cond_clear (&data.cond); | ||
473 | + g_mutex_clear (&data.mutex); | ||
474 | |||
475 | handled = g_mount_source_ask_question_finish (source, | ||
476 | data.result, | ||
477 | @@ -841,12 +839,10 @@ g_mount_source_show_processes (GMountSource *source, | ||
478 | { | ||
479 | gint choice; | ||
480 | gboolean handled, aborted; | ||
481 | - AskSyncData data = {NULL}; | ||
482 | - | ||
483 | - data.mutex = g_mutex_new (); | ||
484 | - data.cond = g_cond_new (); | ||
485 | + AskSyncData data; | ||
486 | |||
487 | - g_mutex_lock (data.mutex); | ||
488 | + memset (&data, 0, sizeof (data)); | ||
489 | + g_mutex_lock (&data.mutex); | ||
490 | |||
491 | g_mount_source_show_processes_async (source, | ||
492 | message, | ||
493 | @@ -856,11 +852,11 @@ g_mount_source_show_processes (GMountSource *source, | ||
494 | ask_reply_sync, | ||
495 | &data); | ||
496 | |||
497 | - g_cond_wait (data.cond, data.mutex); | ||
498 | - g_mutex_unlock (data.mutex); | ||
499 | + g_cond_wait (&data.cond, &data.mutex); | ||
500 | + g_mutex_unlock (&data.mutex); | ||
501 | |||
502 | - g_cond_free (data.cond); | ||
503 | - g_mutex_free (data.mutex); | ||
504 | + g_cond_clear (&data.cond); | ||
505 | + g_mutex_clear (&data.mutex); | ||
506 | |||
507 | handled = g_mount_source_show_processes_finish (source, | ||
508 | data.result, | ||
509 | diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c | ||
510 | index 16c8a23..84227ed 100644 | ||
511 | --- a/daemon/gvfsbackendafc.c | ||
512 | +++ b/daemon/gvfsbackendafc.c | ||
513 | @@ -87,7 +87,7 @@ struct _GVfsBackendAfc { | ||
514 | GHashTable *apps; /* hash table of AppInfo */ | ||
515 | instproxy_client_t inst; | ||
516 | sbservices_client_t sbs; | ||
517 | - GMutex *apps_lock; | ||
518 | + GMutex apps_lock; | ||
519 | }; | ||
520 | |||
521 | struct afc_error_mapping { | ||
522 | @@ -182,11 +182,7 @@ g_vfs_backend_afc_close_connection (GVfsBackendAfc *self) | ||
523 | sbservices_client_free (self->sbs); | ||
524 | self->sbs = NULL; | ||
525 | } | ||
526 | - if (self->apps_lock) | ||
527 | - { | ||
528 | - g_mutex_free (self->apps_lock); | ||
529 | - self->apps_lock = NULL; | ||
530 | - } | ||
531 | + g_mutex_clear (&self->apps_lock); | ||
532 | } | ||
533 | g_free (self->model); | ||
534 | self->model = NULL; | ||
535 | @@ -1910,14 +1906,14 @@ g_vfs_backend_afc_enumerate (GVfsBackend *backend, | ||
536 | { | ||
537 | char *app; | ||
538 | |||
539 | - g_mutex_lock (self->apps_lock); | ||
540 | + g_mutex_lock (&self->apps_lock); | ||
541 | if (g_vfs_backend_load_apps (self) == FALSE) | ||
542 | { | ||
543 | g_vfs_backend_afc_check (AFC_E_INTERNAL_ERROR, G_VFS_JOB (job)); | ||
544 | - g_mutex_unlock (self->apps_lock); | ||
545 | + g_mutex_unlock (&self->apps_lock); | ||
546 | return; | ||
547 | } | ||
548 | - g_mutex_unlock (self->apps_lock); | ||
549 | + g_mutex_unlock (&self->apps_lock); | ||
550 | |||
551 | app = g_vfs_backend_parse_house_arrest_path (self, TRUE, path, &new_path); | ||
552 | |||
553 | @@ -2039,14 +2035,14 @@ g_vfs_backend_afc_query_info (GVfsBackend *backend, | ||
554 | { | ||
555 | char *app; | ||
556 | |||
557 | - g_mutex_lock (self->apps_lock); | ||
558 | + g_mutex_lock (&self->apps_lock); | ||
559 | if (g_vfs_backend_load_apps (self) == FALSE) | ||
560 | { | ||
561 | g_vfs_backend_afc_check (AFC_E_INTERNAL_ERROR, G_VFS_JOB (job)); | ||
562 | - g_mutex_unlock (self->apps_lock); | ||
563 | + g_mutex_unlock (&self->apps_lock); | ||
564 | return; | ||
565 | } | ||
566 | - g_mutex_unlock (self->apps_lock); | ||
567 | + g_mutex_unlock (&self->apps_lock); | ||
568 | |||
569 | app = g_vfs_backend_parse_house_arrest_path (self, TRUE, path, &new_path); | ||
570 | |||
571 | @@ -2604,8 +2600,6 @@ g_vfs_backend_afc_init (GVfsBackendAfc *self) | ||
572 | /* enable full debugging */ | ||
573 | idevice_set_debug_level (1); | ||
574 | } | ||
575 | - | ||
576 | - self->apps_lock = g_mutex_new (); | ||
577 | } | ||
578 | |||
579 | static void | ||
580 | diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c | ||
581 | index 35e0b71..3883ca3 100644 | ||
582 | --- a/daemon/gvfsbackendftp.c | ||
583 | +++ b/daemon/gvfsbackendftp.c | ||
584 | @@ -382,8 +382,8 @@ g_vfs_backend_ftp_finalize (GObject *object) | ||
585 | |||
586 | /* has been cleared on unmount */ | ||
587 | g_assert (ftp->queue == NULL); | ||
588 | - g_cond_free (ftp->cond); | ||
589 | - g_mutex_free (ftp->mutex); | ||
590 | + g_cond_clear (&ftp->cond); | ||
591 | + g_mutex_clear (&ftp->mutex); | ||
592 | |||
593 | g_free (ftp->user); | ||
594 | g_free (ftp->password); | ||
595 | @@ -395,8 +395,6 @@ g_vfs_backend_ftp_finalize (GObject *object) | ||
596 | static void | ||
597 | g_vfs_backend_ftp_init (GVfsBackendFtp *ftp) | ||
598 | { | ||
599 | - ftp->mutex = g_mutex_new (); | ||
600 | - ftp->cond = g_cond_new (); | ||
601 | } | ||
602 | |||
603 | static void | ||
604 | @@ -698,7 +696,7 @@ do_unmount (GVfsBackend * backend, | ||
605 | GVfsBackendFtp *ftp = G_VFS_BACKEND_FTP (backend); | ||
606 | GVfsFtpConnection *conn; | ||
607 | |||
608 | - g_mutex_lock (ftp->mutex); | ||
609 | + g_mutex_lock (&ftp->mutex); | ||
610 | while ((conn = g_queue_pop_head (ftp->queue))) | ||
611 | { | ||
612 | /* FIXME: properly quit */ | ||
613 | @@ -706,8 +704,8 @@ do_unmount (GVfsBackend * backend, | ||
614 | } | ||
615 | g_queue_free (ftp->queue); | ||
616 | ftp->queue = NULL; | ||
617 | - g_cond_broadcast (ftp->cond); | ||
618 | - g_mutex_unlock (ftp->mutex); | ||
619 | + g_cond_broadcast (&ftp->cond); | ||
620 | + g_mutex_unlock (&ftp->mutex); | ||
621 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
622 | } | ||
623 | |||
624 | diff --git a/daemon/gvfsbackendftp.h b/daemon/gvfsbackendftp.h | ||
625 | index f5983b5..767ea35 100644 | ||
626 | --- a/daemon/gvfsbackendftp.h | ||
627 | +++ b/daemon/gvfsbackendftp.h | ||
628 | @@ -100,8 +100,8 @@ struct _GVfsBackendFtp | ||
629 | GVfsFtpDirCache * dir_cache; /* directory cache */ | ||
630 | |||
631 | /* connection collection - accessed from gvfsftptask.c */ | ||
632 | - GMutex * mutex; /* mutex protecting the following variables */ | ||
633 | - GCond * cond; /* cond used to signal tasks waiting on the mutex */ | ||
634 | + GMutex mutex; /* mutex protecting the following variables */ | ||
635 | + GCond cond; /* cond used to signal tasks waiting on the mutex */ | ||
636 | GQueue * queue; /* queue containing the connections */ | ||
637 | guint connections; /* current number of connections */ | ||
638 | guint busy_connections; /* current number of connections being used for reads/writes */ | ||
639 | diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c | ||
640 | index 541dafe..9a1b6d8 100644 | ||
641 | --- a/daemon/gvfsbackendgphoto2.c | ||
642 | +++ b/daemon/gvfsbackendgphoto2.c | ||
643 | @@ -207,7 +207,7 @@ struct _GVfsBackendGphoto2 | ||
644 | * | ||
645 | * Must only be held for very short amounts of time (e.g. no IO). | ||
646 | */ | ||
647 | - GMutex *lock; | ||
648 | + GMutex lock; | ||
649 | |||
650 | /* CACHES */ | ||
651 | |||
652 | @@ -433,7 +433,7 @@ caches_invalidate_all (GVfsBackendGphoto2 *gphoto2_backend) | ||
653 | { | ||
654 | DEBUG ("caches_invalidate_all()"); | ||
655 | |||
656 | - g_mutex_lock (gphoto2_backend->lock); | ||
657 | + g_mutex_lock (&gphoto2_backend->lock); | ||
658 | if (gphoto2_backend->dir_name_cache != NULL) | ||
659 | g_hash_table_remove_all (gphoto2_backend->dir_name_cache); | ||
660 | if (gphoto2_backend->file_name_cache != NULL) | ||
661 | @@ -442,7 +442,7 @@ caches_invalidate_all (GVfsBackendGphoto2 *gphoto2_backend) | ||
662 | g_hash_table_remove_all (gphoto2_backend->info_cache); | ||
663 | gphoto2_backend->capacity = -1; | ||
664 | gphoto2_backend->free_space = -1; | ||
665 | - g_mutex_unlock (gphoto2_backend->lock); | ||
666 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
667 | } | ||
668 | |||
669 | /* ------------------------------------------------------------------------------------------------- */ | ||
670 | @@ -450,9 +450,9 @@ caches_invalidate_all (GVfsBackendGphoto2 *gphoto2_backend) | ||
671 | static void | ||
672 | caches_invalidate_free_space (GVfsBackendGphoto2 *gphoto2_backend) | ||
673 | { | ||
674 | - g_mutex_lock (gphoto2_backend->lock); | ||
675 | + g_mutex_lock (&gphoto2_backend->lock); | ||
676 | gphoto2_backend->free_space = -1; | ||
677 | - g_mutex_unlock (gphoto2_backend->lock); | ||
678 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
679 | } | ||
680 | |||
681 | /* ------------------------------------------------------------------------------------------------- */ | ||
682 | @@ -461,11 +461,11 @@ static void | ||
683 | caches_invalidate_dir (GVfsBackendGphoto2 *gphoto2_backend, const char *dir) | ||
684 | { | ||
685 | DEBUG ("caches_invalidate_dir() for '%s'", dir); | ||
686 | - g_mutex_lock (gphoto2_backend->lock); | ||
687 | + g_mutex_lock (&gphoto2_backend->lock); | ||
688 | g_hash_table_remove (gphoto2_backend->dir_name_cache, dir); | ||
689 | g_hash_table_remove (gphoto2_backend->file_name_cache, dir); | ||
690 | g_hash_table_remove (gphoto2_backend->info_cache, dir); | ||
691 | - g_mutex_unlock (gphoto2_backend->lock); | ||
692 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
693 | } | ||
694 | |||
695 | /* ------------------------------------------------------------------------------------------------- */ | ||
696 | @@ -477,14 +477,14 @@ caches_invalidate_file (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, co | ||
697 | |||
698 | full_name = g_build_filename (dir, name, NULL); | ||
699 | |||
700 | - g_mutex_lock (gphoto2_backend->lock); | ||
701 | + g_mutex_lock (&gphoto2_backend->lock); | ||
702 | /* this is essentially: caches_invalidate_dir (gphoto2_backend, dir); */ | ||
703 | g_hash_table_remove (gphoto2_backend->dir_name_cache, dir); | ||
704 | g_hash_table_remove (gphoto2_backend->file_name_cache, dir); | ||
705 | g_hash_table_remove (gphoto2_backend->info_cache, dir); | ||
706 | |||
707 | g_hash_table_remove (gphoto2_backend->info_cache, full_name); | ||
708 | - g_mutex_unlock (gphoto2_backend->lock); | ||
709 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
710 | |||
711 | DEBUG ("caches_invalidate_file() for '%s'", full_name); | ||
712 | g_free (full_name); | ||
713 | @@ -618,11 +618,7 @@ release_device (GVfsBackendGphoto2 *gphoto2_backend) | ||
714 | g_list_free (gphoto2_backend->file_monitor_proxies); | ||
715 | gphoto2_backend->file_monitor_proxies = NULL; | ||
716 | |||
717 | - if (gphoto2_backend->lock != NULL) | ||
718 | - { | ||
719 | - g_mutex_free (gphoto2_backend->lock); | ||
720 | - gphoto2_backend->lock = NULL; | ||
721 | - } | ||
722 | + g_mutex_clear (&gphoto2_backend->lock); | ||
723 | gphoto2_backend->capacity = -1; | ||
724 | gphoto2_backend->free_space = -1; | ||
725 | } | ||
726 | @@ -1099,17 +1095,17 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, | ||
727 | |||
728 | |||
729 | /* first look up cache */ | ||
730 | - g_mutex_lock (gphoto2_backend->lock); | ||
731 | + g_mutex_lock (&gphoto2_backend->lock); | ||
732 | cached_info = g_hash_table_lookup (gphoto2_backend->info_cache, full_path); | ||
733 | if (cached_info != NULL) | ||
734 | { | ||
735 | g_file_info_copy_into (cached_info, info); | ||
736 | - g_mutex_unlock (gphoto2_backend->lock); | ||
737 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
738 | DEBUG (" Using cached info %p for '%s'", cached_info, full_path); | ||
739 | ret = TRUE; | ||
740 | goto out; | ||
741 | } | ||
742 | - g_mutex_unlock (gphoto2_backend->lock); | ||
743 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
744 | |||
745 | if (try_cache_only) | ||
746 | goto out; | ||
747 | @@ -1307,9 +1303,9 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, | ||
748 | #ifndef DEBUG_NO_CACHING | ||
749 | cached_info = g_file_info_dup (info); | ||
750 | DEBUG (" Storing cached info %p for '%s'", cached_info, full_path); | ||
751 | - g_mutex_lock (gphoto2_backend->lock); | ||
752 | + g_mutex_lock (&gphoto2_backend->lock); | ||
753 | g_hash_table_insert (gphoto2_backend->info_cache, g_strdup (full_path), cached_info); | ||
754 | - g_mutex_unlock (gphoto2_backend->lock); | ||
755 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
756 | #endif | ||
757 | } | ||
758 | |||
759 | @@ -1716,8 +1712,6 @@ do_mount (GVfsBackend *backend, | ||
760 | |||
761 | gphoto2_backend->free_space = -1; | ||
762 | |||
763 | - gphoto2_backend->lock = g_mutex_new (); | ||
764 | - | ||
765 | gphoto2_mount_spec = g_mount_spec_new ("gphoto2"); | ||
766 | g_mount_spec_set (gphoto2_mount_spec, "host", host); | ||
767 | g_vfs_backend_set_mount_spec (backend, gphoto2_mount_spec); | ||
768 | @@ -1860,9 +1854,9 @@ do_open_for_read_real (GVfsBackend *backend, | ||
769 | DEBUG (" data=%p size=%ld handle=%p get_preview=%d", | ||
770 | read_handle->data, read_handle->size, read_handle, get_preview); | ||
771 | |||
772 | - g_mutex_lock (gphoto2_backend->lock); | ||
773 | + g_mutex_lock (&gphoto2_backend->lock); | ||
774 | gphoto2_backend->open_read_handles = g_list_prepend (gphoto2_backend->open_read_handles, read_handle); | ||
775 | - g_mutex_unlock (gphoto2_backend->lock); | ||
776 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
777 | |||
778 | read_handle->cursor = 0; | ||
779 | |||
780 | @@ -2008,9 +2002,9 @@ do_close_read (GVfsBackend *backend, | ||
781 | |||
782 | DEBUG ("close_read() handle=%p", handle); | ||
783 | |||
784 | - g_mutex_lock (gphoto2_backend->lock); | ||
785 | + g_mutex_lock (&gphoto2_backend->lock); | ||
786 | gphoto2_backend->open_read_handles = g_list_remove (gphoto2_backend->open_read_handles, read_handle); | ||
787 | - g_mutex_unlock (gphoto2_backend->lock); | ||
788 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
789 | |||
790 | free_read_handle (read_handle); | ||
791 | |||
792 | @@ -2140,11 +2134,11 @@ do_enumerate (GVfsBackend *backend, | ||
793 | g_free (as_name); | ||
794 | |||
795 | /* first, list the folders */ | ||
796 | - g_mutex_lock (gphoto2_backend->lock); | ||
797 | + g_mutex_lock (&gphoto2_backend->lock); | ||
798 | list = g_hash_table_lookup (gphoto2_backend->dir_name_cache, filename); | ||
799 | if (list == NULL) | ||
800 | { | ||
801 | - g_mutex_unlock (gphoto2_backend->lock); | ||
802 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
803 | |||
804 | ensure_not_dirty (gphoto2_backend); | ||
805 | |||
806 | @@ -2169,7 +2163,7 @@ do_enumerate (GVfsBackend *backend, | ||
807 | DEBUG (" Using cached dir list for dir '%s'", filename); | ||
808 | using_cached_dir_list = TRUE; | ||
809 | gp_list_ref (list); | ||
810 | - g_mutex_unlock (gphoto2_backend->lock); | ||
811 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
812 | } | ||
813 | for (n = 0; n < gp_list_count (list); n++) | ||
814 | { | ||
815 | @@ -2193,25 +2187,25 @@ do_enumerate (GVfsBackend *backend, | ||
816 | if (!using_cached_dir_list) | ||
817 | { | ||
818 | #ifndef DEBUG_NO_CACHING | ||
819 | - g_mutex_lock (gphoto2_backend->lock); | ||
820 | + g_mutex_lock (&gphoto2_backend->lock); | ||
821 | g_hash_table_insert (gphoto2_backend->dir_name_cache, g_strdup (filename), list); | ||
822 | - g_mutex_unlock (gphoto2_backend->lock); | ||
823 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
824 | #endif | ||
825 | } | ||
826 | else | ||
827 | { | ||
828 | - g_mutex_lock (gphoto2_backend->lock); | ||
829 | + g_mutex_lock (&gphoto2_backend->lock); | ||
830 | gp_list_unref (list); | ||
831 | - g_mutex_unlock (gphoto2_backend->lock); | ||
832 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
833 | } | ||
834 | |||
835 | |||
836 | /* then list the files in each folder */ | ||
837 | - g_mutex_lock (gphoto2_backend->lock); | ||
838 | + g_mutex_lock (&gphoto2_backend->lock); | ||
839 | list = g_hash_table_lookup (gphoto2_backend->file_name_cache, filename); | ||
840 | if (list == NULL) | ||
841 | { | ||
842 | - g_mutex_unlock (gphoto2_backend->lock); | ||
843 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
844 | ensure_not_dirty (gphoto2_backend); | ||
845 | |||
846 | DEBUG (" Generating file list for dir '%s'", filename); | ||
847 | @@ -2235,7 +2229,7 @@ do_enumerate (GVfsBackend *backend, | ||
848 | DEBUG (" Using cached file list for dir '%s'", filename); | ||
849 | using_cached_file_list = TRUE; | ||
850 | gp_list_ref (list); | ||
851 | - g_mutex_unlock (gphoto2_backend->lock); | ||
852 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
853 | } | ||
854 | for (n = 0; n < gp_list_count (list); n++) | ||
855 | { | ||
856 | @@ -2260,16 +2254,16 @@ do_enumerate (GVfsBackend *backend, | ||
857 | if (!using_cached_file_list) | ||
858 | { | ||
859 | #ifndef DEBUG_NO_CACHING | ||
860 | - g_mutex_lock (gphoto2_backend->lock); | ||
861 | + g_mutex_lock (&gphoto2_backend->lock); | ||
862 | g_hash_table_insert (gphoto2_backend->file_name_cache, g_strdup (filename), list); | ||
863 | - g_mutex_unlock (gphoto2_backend->lock); | ||
864 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
865 | #endif | ||
866 | } | ||
867 | else | ||
868 | { | ||
869 | - g_mutex_lock (gphoto2_backend->lock); | ||
870 | + g_mutex_lock (&gphoto2_backend->lock); | ||
871 | gp_list_unref (list); | ||
872 | - g_mutex_unlock (gphoto2_backend->lock); | ||
873 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
874 | } | ||
875 | |||
876 | /* and we're done */ | ||
877 | @@ -2307,15 +2301,15 @@ try_enumerate (GVfsBackend *backend, | ||
878 | DEBUG ("try_enumerate (%s)", given_filename); | ||
879 | |||
880 | /* first, list the folders */ | ||
881 | - g_mutex_lock (gphoto2_backend->lock); | ||
882 | + g_mutex_lock (&gphoto2_backend->lock); | ||
883 | list = g_hash_table_lookup (gphoto2_backend->dir_name_cache, filename); | ||
884 | if (list == NULL) | ||
885 | { | ||
886 | - g_mutex_unlock (gphoto2_backend->lock); | ||
887 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
888 | goto error_not_cached; | ||
889 | } | ||
890 | gp_list_ref (list); | ||
891 | - g_mutex_unlock (gphoto2_backend->lock); | ||
892 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
893 | for (n = 0; n < gp_list_count (list); n++) | ||
894 | { | ||
895 | gp_list_get_name (list, n, &name); | ||
896 | @@ -2323,27 +2317,27 @@ try_enumerate (GVfsBackend *backend, | ||
897 | info = g_file_info_new (); | ||
898 | if (!file_get_info (gphoto2_backend, filename, name, info, &error, TRUE)) | ||
899 | { | ||
900 | - g_mutex_lock (gphoto2_backend->lock); | ||
901 | + g_mutex_lock (&gphoto2_backend->lock); | ||
902 | gp_list_unref (list); | ||
903 | - g_mutex_unlock (gphoto2_backend->lock); | ||
904 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
905 | goto error_not_cached; | ||
906 | } | ||
907 | l = g_list_append (l, info); | ||
908 | } | ||
909 | - g_mutex_lock (gphoto2_backend->lock); | ||
910 | + g_mutex_lock (&gphoto2_backend->lock); | ||
911 | gp_list_unref (list); | ||
912 | - g_mutex_unlock (gphoto2_backend->lock); | ||
913 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
914 | |||
915 | /* then list the files in each folder */ | ||
916 | - g_mutex_lock (gphoto2_backend->lock); | ||
917 | + g_mutex_lock (&gphoto2_backend->lock); | ||
918 | list = g_hash_table_lookup (gphoto2_backend->file_name_cache, filename); | ||
919 | if (list == NULL) | ||
920 | { | ||
921 | - g_mutex_unlock (gphoto2_backend->lock); | ||
922 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
923 | goto error_not_cached; | ||
924 | } | ||
925 | gp_list_ref (list); | ||
926 | - g_mutex_unlock (gphoto2_backend->lock); | ||
927 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
928 | for (n = 0; n < gp_list_count (list); n++) | ||
929 | { | ||
930 | gp_list_get_name (list, n, &name); | ||
931 | @@ -2352,16 +2346,16 @@ try_enumerate (GVfsBackend *backend, | ||
932 | info = g_file_info_new (); | ||
933 | if (!file_get_info (gphoto2_backend, filename, name, info, &error, TRUE)) | ||
934 | { | ||
935 | - g_mutex_lock (gphoto2_backend->lock); | ||
936 | + g_mutex_lock (&gphoto2_backend->lock); | ||
937 | gp_list_unref (list); | ||
938 | - g_mutex_unlock (gphoto2_backend->lock); | ||
939 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
940 | goto error_not_cached; | ||
941 | } | ||
942 | l = g_list_append (l, info); | ||
943 | } | ||
944 | - g_mutex_lock (gphoto2_backend->lock); | ||
945 | + g_mutex_lock (&gphoto2_backend->lock); | ||
946 | gp_list_unref (list); | ||
947 | - g_mutex_unlock (gphoto2_backend->lock); | ||
948 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
949 | |||
950 | /* and we're done */ | ||
951 | |||
952 | @@ -2412,9 +2406,9 @@ do_query_fs_info (GVfsBackend *backend, | ||
953 | /* for now we only support a single storage head */ | ||
954 | if (storage_info[0].fields & GP_STORAGEINFO_MAXCAPACITY) | ||
955 | { | ||
956 | - g_mutex_lock (gphoto2_backend->lock); | ||
957 | + g_mutex_lock (&gphoto2_backend->lock); | ||
958 | gphoto2_backend->capacity = storage_info[0].capacitykbytes * 1024; | ||
959 | - g_mutex_unlock (gphoto2_backend->lock); | ||
960 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
961 | g_file_info_set_attribute_uint64 (info, | ||
962 | G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, | ||
963 | (guint64) gphoto2_backend->capacity); | ||
964 | @@ -2422,9 +2416,9 @@ do_query_fs_info (GVfsBackend *backend, | ||
965 | |||
966 | if (storage_info[0].fields & GP_STORAGEINFO_FREESPACEKBYTES) | ||
967 | { | ||
968 | - g_mutex_lock (gphoto2_backend->lock); | ||
969 | + g_mutex_lock (&gphoto2_backend->lock); | ||
970 | gphoto2_backend->free_space = storage_info[0].freekbytes * 1024; | ||
971 | - g_mutex_unlock (gphoto2_backend->lock); | ||
972 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
973 | g_file_info_set_attribute_uint64 (info, | ||
974 | G_FILE_ATTRIBUTE_FILESYSTEM_FREE, | ||
975 | (guint64) gphoto2_backend->free_space); | ||
976 | @@ -2454,10 +2448,10 @@ try_query_fs_info (GVfsBackend *backend, | ||
977 | |||
978 | ret = FALSE; | ||
979 | |||
980 | - g_mutex_lock (gphoto2_backend->lock); | ||
981 | + g_mutex_lock (&gphoto2_backend->lock); | ||
982 | free_space = gphoto2_backend->free_space; | ||
983 | capacity = gphoto2_backend->capacity; | ||
984 | - g_mutex_unlock (gphoto2_backend->lock); | ||
985 | + g_mutex_unlock (&gphoto2_backend->lock); | ||
986 | |||
987 | if (free_space == -1 || capacity == -1) | ||
988 | { | ||
989 | diff --git a/daemon/gvfsbackendnetwork.c b/daemon/gvfsbackendnetwork.c | ||
990 | index 80273e5..3c38514 100644 | ||
991 | --- a/daemon/gvfsbackendnetwork.c | ||
992 | +++ b/daemon/gvfsbackendnetwork.c | ||
993 | @@ -65,7 +65,7 @@ struct _GVfsBackendNetwork | ||
994 | gboolean have_smb; | ||
995 | char *current_workgroup; | ||
996 | GFileMonitor *smb_monitor; | ||
997 | - GMutex *smb_mount_lock; | ||
998 | + GMutex smb_mount_lock; | ||
999 | GVfsJobMount *mount_job; | ||
1000 | |||
1001 | /* DNS-SD Stuff */ | ||
1002 | @@ -433,7 +433,7 @@ mount_smb_done_cb (GObject *object, | ||
1003 | g_vfs_job_succeeded (G_VFS_JOB (backend->mount_job)); | ||
1004 | g_object_unref (backend->mount_job); | ||
1005 | } | ||
1006 | - g_mutex_unlock (backend->smb_mount_lock); | ||
1007 | + g_mutex_unlock (&backend->smb_mount_lock); | ||
1008 | } | ||
1009 | |||
1010 | static void | ||
1011 | @@ -442,7 +442,7 @@ remount_smb (GVfsBackendNetwork *backend, GVfsJobMount *job) | ||
1012 | GFile *file; | ||
1013 | char *workgroup; | ||
1014 | |||
1015 | - if (! g_mutex_trylock (backend->smb_mount_lock)) | ||
1016 | + if (! g_mutex_trylock (&backend->smb_mount_lock)) | ||
1017 | /* Do nothing when the mount operation is already active */ | ||
1018 | return; | ||
1019 | |||
1020 | @@ -769,8 +769,6 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) | ||
1021 | const char * const* supported_vfs; | ||
1022 | int i; | ||
1023 | |||
1024 | - network_backend->smb_mount_lock = g_mutex_new (); | ||
1025 | - | ||
1026 | supported_vfs = g_vfs_get_supported_uri_schemes (g_vfs_get_default ()); | ||
1027 | |||
1028 | network_backend->have_smb = FALSE; | ||
1029 | @@ -836,7 +834,7 @@ g_vfs_backend_network_finalize (GObject *object) | ||
1030 | GVfsBackendNetwork *backend; | ||
1031 | backend = G_VFS_BACKEND_NETWORK (object); | ||
1032 | |||
1033 | - g_mutex_free (backend->smb_mount_lock); | ||
1034 | + g_mutex_clear (&backend->smb_mount_lock); | ||
1035 | g_mount_spec_unref (backend->mount_spec); | ||
1036 | g_object_unref (backend->root_monitor); | ||
1037 | g_object_unref (backend->workgroup_icon); | ||
1038 | diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c | ||
1039 | index 9630df8..62fe32f 100644 | ||
1040 | --- a/daemon/gvfsbackendobexftp.c | ||
1041 | +++ b/daemon/gvfsbackendobexftp.c | ||
1042 | @@ -85,8 +85,8 @@ struct _GVfsBackendObexftp | ||
1043 | DBusGProxy *session_proxy; | ||
1044 | |||
1045 | /* Use for the async notifications and errors */ | ||
1046 | - GCond *cond; | ||
1047 | - GMutex *mutex; | ||
1048 | + GCond cond; | ||
1049 | + GMutex mutex; | ||
1050 | int status; | ||
1051 | gboolean doing_io; | ||
1052 | GError *error; | ||
1053 | @@ -494,8 +494,8 @@ g_vfs_backend_obexftp_finalize (GObject *object) | ||
1054 | |||
1055 | if (backend->session_proxy != NULL) | ||
1056 | g_object_unref (backend->session_proxy); | ||
1057 | - g_mutex_free (backend->mutex); | ||
1058 | - g_cond_free (backend->cond); | ||
1059 | + g_mutex_clear (&backend->mutex); | ||
1060 | + g_cond_clear (&backend->cond); | ||
1061 | |||
1062 | if (G_OBJECT_CLASS (g_vfs_backend_obexftp_parent_class)->finalize) | ||
1063 | (*G_OBJECT_CLASS (g_vfs_backend_obexftp_parent_class)->finalize) (object); | ||
1064 | @@ -530,8 +530,6 @@ g_vfs_backend_obexftp_init (GVfsBackendObexftp *backend) | ||
1065 | return; | ||
1066 | } | ||
1067 | |||
1068 | - backend->mutex = g_mutex_new (); | ||
1069 | - backend->cond = g_cond_new (); | ||
1070 | backend->manager_proxy = dbus_g_proxy_new_for_name (backend->connection, | ||
1071 | "org.openobex", | ||
1072 | "/org/openobex", | ||
1073 | @@ -759,18 +757,18 @@ error_occurred_cb (DBusGProxy *proxy, const gchar *error_name, const gchar *erro | ||
1074 | } | ||
1075 | |||
1076 | /* Something is waiting on us */ | ||
1077 | - g_mutex_lock (op_backend->mutex); | ||
1078 | + g_mutex_lock (&op_backend->mutex); | ||
1079 | if (op_backend->doing_io) | ||
1080 | { | ||
1081 | op_backend->status = ASYNC_ERROR; | ||
1082 | op_backend->error = g_error_new_literal (DBUS_GERROR, | ||
1083 | DBUS_GERROR_REMOTE_EXCEPTION, | ||
1084 | error_message); | ||
1085 | - g_cond_signal (op_backend->cond); | ||
1086 | - g_mutex_unlock (op_backend->mutex); | ||
1087 | + g_cond_signal (&op_backend->cond); | ||
1088 | + g_mutex_unlock (&op_backend->mutex); | ||
1089 | return; | ||
1090 | } | ||
1091 | - g_mutex_unlock (op_backend->mutex); | ||
1092 | + g_mutex_unlock (&op_backend->mutex); | ||
1093 | |||
1094 | g_message ("Unhandled error, file a bug"); | ||
1095 | _exit (1); | ||
1096 | @@ -785,13 +783,13 @@ session_connect_error_cb (DBusGProxy *proxy, | ||
1097 | { | ||
1098 | GVfsBackendObexftp *op_backend = G_VFS_BACKEND_OBEXFTP (user_data); | ||
1099 | |||
1100 | - g_mutex_lock (op_backend->mutex); | ||
1101 | + g_mutex_lock (&op_backend->mutex); | ||
1102 | op_backend->status = ASYNC_ERROR; | ||
1103 | op_backend->error = g_error_new_literal (DBUS_GERROR, | ||
1104 | DBUS_GERROR_REMOTE_EXCEPTION, | ||
1105 | error_message); | ||
1106 | - g_cond_signal (op_backend->cond); | ||
1107 | - g_mutex_unlock (op_backend->mutex); | ||
1108 | + g_cond_signal (&op_backend->cond); | ||
1109 | + g_mutex_unlock (&op_backend->mutex); | ||
1110 | } | ||
1111 | |||
1112 | static void | ||
1113 | @@ -801,10 +799,10 @@ session_connected_cb (DBusGProxy *proxy, | ||
1114 | { | ||
1115 | GVfsBackendObexftp *op_backend = G_VFS_BACKEND_OBEXFTP (user_data); | ||
1116 | |||
1117 | - g_mutex_lock (op_backend->mutex); | ||
1118 | + g_mutex_lock (&op_backend->mutex); | ||
1119 | op_backend->status = ASYNC_SUCCESS; | ||
1120 | - g_cond_signal (op_backend->cond); | ||
1121 | - g_mutex_unlock (op_backend->mutex); | ||
1122 | + g_cond_signal (&op_backend->cond); | ||
1123 | + g_mutex_unlock (&op_backend->mutex); | ||
1124 | } | ||
1125 | |||
1126 | static void | ||
1127 | @@ -814,10 +812,10 @@ cancelled_cb (DBusGProxy *proxy, gpointer user_data) | ||
1128 | |||
1129 | g_message ("transfer got cancelled"); | ||
1130 | |||
1131 | - g_mutex_lock (op_backend->mutex); | ||
1132 | + g_mutex_lock (&op_backend->mutex); | ||
1133 | op_backend->status = ASYNC_ERROR; | ||
1134 | - g_cond_signal (op_backend->cond); | ||
1135 | - g_mutex_unlock (op_backend->mutex); | ||
1136 | + g_cond_signal (&op_backend->cond); | ||
1137 | + g_mutex_unlock (&op_backend->mutex); | ||
1138 | } | ||
1139 | |||
1140 | static void | ||
1141 | @@ -979,17 +977,16 @@ do_mount (GVfsBackend *backend, | ||
1142 | |||
1143 | /* Now wait until the device is connected */ | ||
1144 | count = 0; | ||
1145 | - g_mutex_lock (op_backend->mutex); | ||
1146 | + g_mutex_lock (&op_backend->mutex); | ||
1147 | |||
1148 | while (op_backend->status == ASYNC_PENDING && count < 100) { | ||
1149 | - GTimeVal val; | ||
1150 | - g_get_current_time (&val); | ||
1151 | - g_time_val_add (&val, 100000); | ||
1152 | + gint64 end_time; | ||
1153 | + end_time = g_get_monotonic_time () + 100 * G_TIME_SPAN_MILLISECOND; | ||
1154 | count++; | ||
1155 | - if (g_cond_timed_wait (op_backend->cond, op_backend->mutex, &val) != FALSE) | ||
1156 | + if (g_cond_wait_until (&op_backend->cond, &op_backend->mutex, end_time) != FALSE) | ||
1157 | break; | ||
1158 | } | ||
1159 | - g_mutex_unlock (op_backend->mutex); | ||
1160 | + g_mutex_unlock (&op_backend->mutex); | ||
1161 | |||
1162 | if (op_backend->status == ASYNC_ERROR || op_backend->status == ASYNC_PENDING) | ||
1163 | { | ||
1164 | @@ -1026,10 +1023,10 @@ transfer_started_cb (DBusGProxy *proxy, const gchar *filename, | ||
1165 | |||
1166 | g_message ("transfer of %s to %s started", filename, local_path); | ||
1167 | |||
1168 | - g_mutex_lock (op_backend->mutex); | ||
1169 | + g_mutex_lock (&op_backend->mutex); | ||
1170 | op_backend->status = ASYNC_SUCCESS; | ||
1171 | - g_cond_signal (op_backend->cond); | ||
1172 | - g_mutex_unlock (op_backend->mutex); | ||
1173 | + g_cond_signal (&op_backend->cond); | ||
1174 | + g_mutex_unlock (&op_backend->mutex); | ||
1175 | } | ||
1176 | |||
1177 | static void | ||
1178 | @@ -1047,7 +1044,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1179 | |||
1180 | g_debug ("+ do_open_for_read, filename: %s\n", filename); | ||
1181 | |||
1182 | - g_mutex_lock (op_backend->mutex); | ||
1183 | + g_mutex_lock (&op_backend->mutex); | ||
1184 | op_backend->doing_io = TRUE; | ||
1185 | |||
1186 | /* Change into the directory and cache the file size */ | ||
1187 | @@ -1055,7 +1052,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1188 | if (_query_file_info_helper (backend, filename, info, &error) == FALSE) | ||
1189 | { | ||
1190 | op_backend->doing_io = FALSE; | ||
1191 | - g_mutex_unlock (op_backend->mutex); | ||
1192 | + g_mutex_unlock (&op_backend->mutex); | ||
1193 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1194 | g_error_free (error); | ||
1195 | g_object_unref (info); | ||
1196 | @@ -1065,7 +1062,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1197 | if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) | ||
1198 | { | ||
1199 | op_backend->doing_io = FALSE; | ||
1200 | - g_mutex_unlock (op_backend->mutex); | ||
1201 | + g_mutex_unlock (&op_backend->mutex); | ||
1202 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1203 | G_IO_ERROR_IS_DIRECTORY, | ||
1204 | _("Can't open directory")); | ||
1205 | @@ -1079,7 +1076,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1206 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1207 | { | ||
1208 | op_backend->doing_io = FALSE; | ||
1209 | - g_mutex_unlock (op_backend->mutex); | ||
1210 | + g_mutex_unlock (&op_backend->mutex); | ||
1211 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1212 | G_IO_ERROR_CANCELLED, | ||
1213 | _("Operation was cancelled")); | ||
1214 | @@ -1091,7 +1088,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1215 | if (fd < 0) | ||
1216 | { | ||
1217 | op_backend->doing_io = FALSE; | ||
1218 | - g_mutex_unlock (op_backend->mutex); | ||
1219 | + g_mutex_unlock (&op_backend->mutex); | ||
1220 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1221 | g_error_free (error); | ||
1222 | return; | ||
1223 | @@ -1100,7 +1097,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1224 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1225 | { | ||
1226 | op_backend->doing_io = FALSE; | ||
1227 | - g_mutex_unlock (op_backend->mutex); | ||
1228 | + g_mutex_unlock (&op_backend->mutex); | ||
1229 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1230 | G_IO_ERROR_CANCELLED, | ||
1231 | _("Operation was cancelled")); | ||
1232 | @@ -1134,13 +1131,13 @@ do_open_for_read (GVfsBackend *backend, | ||
1233 | close (fd); | ||
1234 | |||
1235 | op_backend->doing_io = FALSE; | ||
1236 | - g_mutex_unlock (op_backend->mutex); | ||
1237 | + g_mutex_unlock (&op_backend->mutex); | ||
1238 | return; | ||
1239 | } | ||
1240 | |||
1241 | /* Wait for TransferStarted or ErrorOccurred to have happened */ | ||
1242 | while (op_backend->status == ASYNC_PENDING) | ||
1243 | - g_cond_wait (op_backend->cond, op_backend->mutex); | ||
1244 | + g_cond_wait (&op_backend->cond, &op_backend->mutex); | ||
1245 | success = op_backend->status; | ||
1246 | dbus_g_proxy_disconnect_signal(op_backend->session_proxy, "TransferStarted", | ||
1247 | G_CALLBACK(transfer_started_cb), op_backend); | ||
1248 | @@ -1158,7 +1155,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1249 | if (success == ASYNC_ERROR) | ||
1250 | { | ||
1251 | op_backend->doing_io = FALSE; | ||
1252 | - g_mutex_unlock (op_backend->mutex); | ||
1253 | + g_mutex_unlock (&op_backend->mutex); | ||
1254 | close (fd); | ||
1255 | g_vfs_job_failed_from_error (G_VFS_JOB (job), | ||
1256 | op_backend->error); | ||
1257 | @@ -1179,7 +1176,7 @@ do_open_for_read (GVfsBackend *backend, | ||
1258 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1259 | |||
1260 | op_backend->doing_io = FALSE; | ||
1261 | - g_mutex_unlock (op_backend->mutex); | ||
1262 | + g_mutex_unlock (&op_backend->mutex); | ||
1263 | } | ||
1264 | |||
1265 | static int | ||
1266 | @@ -1266,7 +1263,7 @@ do_close_read (GVfsBackend *backend, | ||
1267 | return; | ||
1268 | } | ||
1269 | |||
1270 | - g_mutex_lock (op_backend->mutex); | ||
1271 | + g_mutex_lock (&op_backend->mutex); | ||
1272 | |||
1273 | if (busy > 0) | ||
1274 | { | ||
1275 | @@ -1276,11 +1273,11 @@ do_close_read (GVfsBackend *backend, | ||
1276 | G_TYPE_INVALID, G_TYPE_INVALID) != FALSE) | ||
1277 | { | ||
1278 | while (op_backend->status == ASYNC_PENDING) | ||
1279 | - g_cond_wait (op_backend->cond, op_backend->mutex); | ||
1280 | + g_cond_wait (&op_backend->cond, &op_backend->mutex); | ||
1281 | } | ||
1282 | } | ||
1283 | |||
1284 | - g_mutex_unlock (op_backend->mutex); | ||
1285 | + g_mutex_unlock (&op_backend->mutex); | ||
1286 | |||
1287 | close (backend_handle->fd); | ||
1288 | g_free (backend_handle->source); | ||
1289 | @@ -1304,17 +1301,17 @@ do_query_info (GVfsBackend *backend, | ||
1290 | |||
1291 | g_debug ("+ do_query_info, filename: %s\n", filename); | ||
1292 | |||
1293 | - g_mutex_lock (op_backend->mutex); | ||
1294 | + g_mutex_lock (&op_backend->mutex); | ||
1295 | |||
1296 | if (_query_file_info_helper (backend, filename, info, &error) == FALSE) | ||
1297 | { | ||
1298 | - g_mutex_unlock (op_backend->mutex); | ||
1299 | + g_mutex_unlock (&op_backend->mutex); | ||
1300 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1301 | g_error_free (error); | ||
1302 | return; | ||
1303 | } | ||
1304 | |||
1305 | - g_mutex_unlock (op_backend->mutex); | ||
1306 | + g_mutex_unlock (&op_backend->mutex); | ||
1307 | |||
1308 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1309 | |||
1310 | @@ -1341,14 +1338,14 @@ do_query_fs_info (GVfsBackend *backend, | ||
1311 | |||
1312 | g_debug ("+ do_query_fs_info, filename: %s\n", filename); | ||
1313 | |||
1314 | - g_mutex_lock (op_backend->mutex); | ||
1315 | + g_mutex_lock (&op_backend->mutex); | ||
1316 | |||
1317 | /* Get the capabilities */ | ||
1318 | if (dbus_g_proxy_call (op_backend->session_proxy, "GetCapability", &error, | ||
1319 | G_TYPE_INVALID, | ||
1320 | G_TYPE_STRING, &caps_str, G_TYPE_INVALID) == FALSE) | ||
1321 | { | ||
1322 | - g_mutex_unlock (op_backend->mutex); | ||
1323 | + g_mutex_unlock (&op_backend->mutex); | ||
1324 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1325 | g_error_free (error); | ||
1326 | return; | ||
1327 | @@ -1356,7 +1353,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1328 | |||
1329 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1330 | { | ||
1331 | - g_mutex_unlock (op_backend->mutex); | ||
1332 | + g_mutex_unlock (&op_backend->mutex); | ||
1333 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1334 | G_IO_ERROR_CANCELLED, | ||
1335 | _("Operation was cancelled")); | ||
1336 | @@ -1368,7 +1365,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1337 | if (caps_str == NULL) | ||
1338 | { | ||
1339 | /* Best effort, don't error out */ | ||
1340 | - g_mutex_unlock (op_backend->mutex); | ||
1341 | + g_mutex_unlock (&op_backend->mutex); | ||
1342 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1343 | return; | ||
1344 | } | ||
1345 | @@ -1377,7 +1374,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1346 | g_free (caps_str); | ||
1347 | if (caps == NULL) | ||
1348 | { | ||
1349 | - g_mutex_unlock (op_backend->mutex); | ||
1350 | + g_mutex_unlock (&op_backend->mutex); | ||
1351 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1352 | g_error_free (error); | ||
1353 | return; | ||
1354 | @@ -1395,7 +1392,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1355 | } | ||
1356 | if (has_free_memory == FALSE) | ||
1357 | { | ||
1358 | - g_mutex_unlock (op_backend->mutex); | ||
1359 | + g_mutex_unlock (&op_backend->mutex); | ||
1360 | /* Best effort, don't error out */ | ||
1361 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1362 | return; | ||
1363 | @@ -1411,7 +1408,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1364 | |||
1365 | if (_query_file_info_helper (backend, filename, info, &error) == FALSE) | ||
1366 | { | ||
1367 | - g_mutex_unlock (op_backend->mutex); | ||
1368 | + g_mutex_unlock (&op_backend->mutex); | ||
1369 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1370 | g_error_free (error); | ||
1371 | ovu_caps_free (caps); | ||
1372 | @@ -1420,7 +1417,7 @@ do_query_fs_info (GVfsBackend *backend, | ||
1373 | |||
1374 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1375 | { | ||
1376 | - g_mutex_unlock (op_backend->mutex); | ||
1377 | + g_mutex_unlock (&op_backend->mutex); | ||
1378 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1379 | G_IO_ERROR_CANCELLED, | ||
1380 | _("Operation was cancelled")); | ||
1381 | @@ -1457,7 +1454,7 @@ set_info_from_memory: | ||
1382 | |||
1383 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1384 | |||
1385 | - g_mutex_unlock (op_backend->mutex); | ||
1386 | + g_mutex_unlock (&op_backend->mutex); | ||
1387 | |||
1388 | g_debug ("- do_query_fs_info\n"); | ||
1389 | } | ||
1390 | @@ -1476,11 +1473,11 @@ do_enumerate (GVfsBackend *backend, | ||
1391 | |||
1392 | g_debug ("+ do_enumerate, filename: %s\n", filename); | ||
1393 | |||
1394 | - g_mutex_lock (op_backend->mutex); | ||
1395 | + g_mutex_lock (&op_backend->mutex); | ||
1396 | |||
1397 | if (_change_directory (op_backend, filename, &error) == FALSE) | ||
1398 | { | ||
1399 | - g_mutex_unlock (op_backend->mutex); | ||
1400 | + g_mutex_unlock (&op_backend->mutex); | ||
1401 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1402 | g_error_free (error); | ||
1403 | return; | ||
1404 | @@ -1489,7 +1486,7 @@ do_enumerate (GVfsBackend *backend, | ||
1405 | files = NULL; | ||
1406 | if (_retrieve_folder_listing (backend, filename, &files, &error) == FALSE) | ||
1407 | { | ||
1408 | - g_mutex_unlock (op_backend->mutex); | ||
1409 | + g_mutex_unlock (&op_backend->mutex); | ||
1410 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1411 | g_error_free (error); | ||
1412 | return; | ||
1413 | @@ -1497,7 +1494,7 @@ do_enumerate (GVfsBackend *backend, | ||
1414 | |||
1415 | if (gvfsbackendobexftp_fl_parser_parse (files, strlen (files), &elements, &error) == FALSE) | ||
1416 | { | ||
1417 | - g_mutex_unlock (op_backend->mutex); | ||
1418 | + g_mutex_unlock (&op_backend->mutex); | ||
1419 | /* See http://web.archive.org/web/20070826221251/http://docs.kde.org/development/en/extragear-pim/kdebluetooth/components.kio_obex.html#devices | ||
1420 | * for the reasoning */ | ||
1421 | if (strstr (files, "SYSTEM\"obex-folder-listing.dtd") != NULL && _is_nokia_3650 (op_backend->bdaddr)) | ||
1422 | @@ -1525,7 +1522,7 @@ do_enumerate (GVfsBackend *backend, | ||
1423 | g_list_free (elements); | ||
1424 | g_vfs_job_enumerate_done (job); | ||
1425 | |||
1426 | - g_mutex_unlock (op_backend->mutex); | ||
1427 | + g_mutex_unlock (&op_backend->mutex); | ||
1428 | |||
1429 | g_debug ("- do_enumerate\n"); | ||
1430 | } | ||
1431 | @@ -1549,7 +1546,7 @@ push_transfer_started_cb (DBusGProxy *proxy, | ||
1432 | |||
1433 | g_message ("transfer of %s to %s started", filename, local_path); | ||
1434 | |||
1435 | - g_mutex_lock (op_backend->mutex); | ||
1436 | + g_mutex_lock (&op_backend->mutex); | ||
1437 | |||
1438 | op_backend->status = ASYNC_RUNNING; | ||
1439 | job_data->total_bytes = (goffset) total_bytes; | ||
1440 | @@ -1557,8 +1554,8 @@ push_transfer_started_cb (DBusGProxy *proxy, | ||
1441 | job_data->progress_callback (0, job_data->total_bytes, | ||
1442 | job_data->progress_callback_data); | ||
1443 | |||
1444 | - g_cond_signal (op_backend->cond); | ||
1445 | - g_mutex_unlock (op_backend->mutex); | ||
1446 | + g_cond_signal (&op_backend->cond); | ||
1447 | + g_mutex_unlock (&op_backend->mutex); | ||
1448 | } | ||
1449 | |||
1450 | static void | ||
1451 | @@ -1570,12 +1567,12 @@ push_transfer_completed_cb (DBusGProxy *proxy, | ||
1452 | |||
1453 | g_message ("transfer completed"); | ||
1454 | |||
1455 | - g_mutex_lock (op_backend->mutex); | ||
1456 | + g_mutex_lock (&op_backend->mutex); | ||
1457 | |||
1458 | op_backend->status = ASYNC_SUCCESS; | ||
1459 | |||
1460 | - g_cond_signal (op_backend->cond); | ||
1461 | - g_mutex_unlock (op_backend->mutex); | ||
1462 | + g_cond_signal (&op_backend->cond); | ||
1463 | + g_mutex_unlock (&op_backend->mutex); | ||
1464 | } | ||
1465 | |||
1466 | static void | ||
1467 | @@ -1657,7 +1654,7 @@ _push_single_file_helper (GVfsBackendObexftp *op_backend, | ||
1468 | |||
1469 | /* wait for the TransferStarted or ErrorOccurred signal */ | ||
1470 | while (op_backend->status == ASYNC_PENDING) | ||
1471 | - g_cond_wait (op_backend->cond, op_backend->mutex); | ||
1472 | + g_cond_wait (&op_backend->cond, &op_backend->mutex); | ||
1473 | |||
1474 | dbus_g_proxy_disconnect_signal (op_backend->session_proxy, "TransferStarted", | ||
1475 | G_CALLBACK (push_transfer_started_cb), job_data); | ||
1476 | @@ -1678,7 +1675,7 @@ _push_single_file_helper (GVfsBackendObexftp *op_backend, | ||
1477 | } | ||
1478 | |||
1479 | while (op_backend->status == ASYNC_RUNNING) | ||
1480 | - g_cond_wait (op_backend->cond, op_backend->mutex); | ||
1481 | + g_cond_wait (&op_backend->cond, &op_backend->mutex); | ||
1482 | |||
1483 | dbus_g_proxy_disconnect_signal (op_backend->session_proxy, "TransferCompleted", | ||
1484 | G_CALLBACK (push_transfer_completed_cb), job_data); | ||
1485 | @@ -1717,7 +1714,7 @@ do_push (GVfsBackend *backend, | ||
1486 | |||
1487 | g_debug ("+ do_push, destination: %s, local_path: %s\n", destination, local_path); | ||
1488 | |||
1489 | - g_mutex_lock (op_backend->mutex); | ||
1490 | + g_mutex_lock (&op_backend->mutex); | ||
1491 | op_backend->doing_io = TRUE; | ||
1492 | |||
1493 | overwrite = (flags & G_FILE_COPY_OVERWRITE); | ||
1494 | @@ -1728,7 +1725,7 @@ do_push (GVfsBackend *backend, | ||
1495 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1496 | { | ||
1497 | op_backend->doing_io = FALSE; | ||
1498 | - g_mutex_unlock (op_backend->mutex); | ||
1499 | + g_mutex_unlock (&op_backend->mutex); | ||
1500 | |||
1501 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1502 | G_IO_ERROR_CANCELLED, | ||
1503 | @@ -1743,7 +1740,7 @@ do_push (GVfsBackend *backend, | ||
1504 | if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) | ||
1505 | { | ||
1506 | op_backend->doing_io = FALSE; | ||
1507 | - g_mutex_unlock (op_backend->mutex); | ||
1508 | + g_mutex_unlock (&op_backend->mutex); | ||
1509 | |||
1510 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1511 | g_error_free (error); | ||
1512 | @@ -1766,7 +1763,7 @@ do_push (GVfsBackend *backend, | ||
1513 | if (is_dir) | ||
1514 | { | ||
1515 | op_backend->doing_io = FALSE; | ||
1516 | - g_mutex_unlock (op_backend->mutex); | ||
1517 | + g_mutex_unlock (&op_backend->mutex); | ||
1518 | |||
1519 | if (target_type != 0) | ||
1520 | { | ||
1521 | @@ -1799,7 +1796,7 @@ do_push (GVfsBackend *backend, | ||
1522 | if (target_type != 0) | ||
1523 | { | ||
1524 | op_backend->doing_io = FALSE; | ||
1525 | - g_mutex_unlock (op_backend->mutex); | ||
1526 | + g_mutex_unlock (&op_backend->mutex); | ||
1527 | |||
1528 | if (overwrite) | ||
1529 | { | ||
1530 | @@ -1831,7 +1828,7 @@ do_push (GVfsBackend *backend, | ||
1531 | &error, job_data) == FALSE) | ||
1532 | { | ||
1533 | op_backend->doing_io = FALSE; | ||
1534 | - g_mutex_unlock (op_backend->mutex); | ||
1535 | + g_mutex_unlock (&op_backend->mutex); | ||
1536 | push_data_free (job_data); | ||
1537 | |||
1538 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1539 | @@ -1859,7 +1856,7 @@ do_push (GVfsBackend *backend, | ||
1540 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1541 | |||
1542 | op_backend->doing_io = FALSE; | ||
1543 | - g_mutex_unlock (op_backend->mutex); | ||
1544 | + g_mutex_unlock (&op_backend->mutex); | ||
1545 | |||
1546 | g_debug ("- do_push\n"); | ||
1547 | } | ||
1548 | @@ -1876,13 +1873,13 @@ do_delete (GVfsBackend *backend, | ||
1549 | |||
1550 | g_debug ("+ do_delete, filename: %s\n", filename); | ||
1551 | |||
1552 | - g_mutex_lock (op_backend->mutex); | ||
1553 | + g_mutex_lock (&op_backend->mutex); | ||
1554 | |||
1555 | /* Check whether we have a directory */ | ||
1556 | info = g_file_info_new (); | ||
1557 | if (_query_file_info_helper (backend, filename, info, &error) == FALSE) | ||
1558 | { | ||
1559 | - g_mutex_unlock (op_backend->mutex); | ||
1560 | + g_mutex_unlock (&op_backend->mutex); | ||
1561 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1562 | g_error_free (error); | ||
1563 | g_object_unref (info); | ||
1564 | @@ -1891,7 +1888,7 @@ do_delete (GVfsBackend *backend, | ||
1565 | |||
1566 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1567 | { | ||
1568 | - g_mutex_unlock (op_backend->mutex); | ||
1569 | + g_mutex_unlock (&op_backend->mutex); | ||
1570 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1571 | G_IO_ERROR_CANCELLED, | ||
1572 | _("Operation was cancelled")); | ||
1573 | @@ -1910,7 +1907,7 @@ do_delete (GVfsBackend *backend, | ||
1574 | |||
1575 | if (_change_directory (op_backend, filename, &error) == FALSE) | ||
1576 | { | ||
1577 | - g_mutex_unlock (op_backend->mutex); | ||
1578 | + g_mutex_unlock (&op_backend->mutex); | ||
1579 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1580 | g_error_free (error); | ||
1581 | return; | ||
1582 | @@ -1918,7 +1915,7 @@ do_delete (GVfsBackend *backend, | ||
1583 | |||
1584 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1585 | { | ||
1586 | - g_mutex_unlock (op_backend->mutex); | ||
1587 | + g_mutex_unlock (&op_backend->mutex); | ||
1588 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1589 | G_IO_ERROR_CANCELLED, | ||
1590 | _("Operation was cancelled")); | ||
1591 | @@ -1928,7 +1925,7 @@ do_delete (GVfsBackend *backend, | ||
1592 | files = NULL; | ||
1593 | if (_retrieve_folder_listing (backend, filename, &files, &error) == FALSE) | ||
1594 | { | ||
1595 | - g_mutex_unlock (op_backend->mutex); | ||
1596 | + g_mutex_unlock (&op_backend->mutex); | ||
1597 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1598 | g_error_free (error); | ||
1599 | return; | ||
1600 | @@ -1936,7 +1933,7 @@ do_delete (GVfsBackend *backend, | ||
1601 | |||
1602 | if (gvfsbackendobexftp_fl_parser_parse (files, strlen (files), &elements, &error) == FALSE) | ||
1603 | { | ||
1604 | - g_mutex_unlock (op_backend->mutex); | ||
1605 | + g_mutex_unlock (&op_backend->mutex); | ||
1606 | g_message ("gvfsbackendobexftp_fl_parser_parse failed"); | ||
1607 | g_free (files); | ||
1608 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1609 | @@ -1951,7 +1948,7 @@ do_delete (GVfsBackend *backend, | ||
1610 | |||
1611 | if (len != 0) | ||
1612 | { | ||
1613 | - g_mutex_unlock (op_backend->mutex); | ||
1614 | + g_mutex_unlock (&op_backend->mutex); | ||
1615 | g_set_error_literal (&error, G_IO_ERROR, | ||
1616 | G_IO_ERROR_NOT_EMPTY, | ||
1617 | g_strerror (ENOTEMPTY)); | ||
1618 | @@ -1969,7 +1966,7 @@ do_delete (GVfsBackend *backend, | ||
1619 | if (strcmp (basename, G_DIR_SEPARATOR_S) == 0 | ||
1620 | || strcmp (basename, ".") == 0) | ||
1621 | { | ||
1622 | - g_mutex_unlock (op_backend->mutex); | ||
1623 | + g_mutex_unlock (&op_backend->mutex); | ||
1624 | g_free (basename); | ||
1625 | g_vfs_job_failed_from_errno (G_VFS_JOB (job), EPERM); | ||
1626 | return; | ||
1627 | @@ -1977,7 +1974,7 @@ do_delete (GVfsBackend *backend, | ||
1628 | |||
1629 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1630 | { | ||
1631 | - g_mutex_unlock (op_backend->mutex); | ||
1632 | + g_mutex_unlock (&op_backend->mutex); | ||
1633 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1634 | G_IO_ERROR_CANCELLED, | ||
1635 | _("Operation was cancelled")); | ||
1636 | @@ -1988,7 +1985,7 @@ do_delete (GVfsBackend *backend, | ||
1637 | parent = g_path_get_dirname (filename); | ||
1638 | if (_change_directory (op_backend, parent, &error) == FALSE) | ||
1639 | { | ||
1640 | - g_mutex_unlock (op_backend->mutex); | ||
1641 | + g_mutex_unlock (&op_backend->mutex); | ||
1642 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1643 | g_free (basename); | ||
1644 | g_free (parent); | ||
1645 | @@ -1999,7 +1996,7 @@ do_delete (GVfsBackend *backend, | ||
1646 | |||
1647 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1648 | { | ||
1649 | - g_mutex_unlock (op_backend->mutex); | ||
1650 | + g_mutex_unlock (&op_backend->mutex); | ||
1651 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1652 | G_IO_ERROR_CANCELLED, | ||
1653 | _("Operation was cancelled")); | ||
1654 | @@ -2011,7 +2008,7 @@ do_delete (GVfsBackend *backend, | ||
1655 | G_TYPE_STRING, basename, G_TYPE_INVALID, | ||
1656 | G_TYPE_INVALID) == FALSE) | ||
1657 | { | ||
1658 | - g_mutex_unlock (op_backend->mutex); | ||
1659 | + g_mutex_unlock (&op_backend->mutex); | ||
1660 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1661 | g_error_free (error); | ||
1662 | return; | ||
1663 | @@ -2020,7 +2017,7 @@ do_delete (GVfsBackend *backend, | ||
1664 | |||
1665 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1666 | |||
1667 | - g_mutex_unlock (op_backend->mutex); | ||
1668 | + g_mutex_unlock (&op_backend->mutex); | ||
1669 | |||
1670 | g_debug ("- do_delete\n"); | ||
1671 | } | ||
1672 | @@ -2037,13 +2034,13 @@ do_make_directory (GVfsBackend *backend, | ||
1673 | |||
1674 | g_debug ("+ do_make_directory, filename: %s\n", filename); | ||
1675 | |||
1676 | - g_mutex_lock (op_backend->mutex); | ||
1677 | + g_mutex_lock (&op_backend->mutex); | ||
1678 | |||
1679 | /* Check if the folder already exists */ | ||
1680 | info = g_file_info_new (); | ||
1681 | if (_query_file_info_helper (backend, filename, info, &error) != FALSE) | ||
1682 | { | ||
1683 | - g_mutex_unlock (op_backend->mutex); | ||
1684 | + g_mutex_unlock (&op_backend->mutex); | ||
1685 | g_object_unref (info); | ||
1686 | g_vfs_job_failed_from_errno (G_VFS_JOB (job), EEXIST); | ||
1687 | return; | ||
1688 | @@ -2051,7 +2048,7 @@ do_make_directory (GVfsBackend *backend, | ||
1689 | g_object_unref (info); | ||
1690 | if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) == FALSE) | ||
1691 | { | ||
1692 | - g_mutex_unlock (op_backend->mutex); | ||
1693 | + g_mutex_unlock (&op_backend->mutex); | ||
1694 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1695 | g_error_free (error); | ||
1696 | return; | ||
1697 | @@ -2062,7 +2059,7 @@ do_make_directory (GVfsBackend *backend, | ||
1698 | |||
1699 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1700 | { | ||
1701 | - g_mutex_unlock (op_backend->mutex); | ||
1702 | + g_mutex_unlock (&op_backend->mutex); | ||
1703 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1704 | G_IO_ERROR_CANCELLED, | ||
1705 | _("Operation was cancelled")); | ||
1706 | @@ -2072,7 +2069,7 @@ do_make_directory (GVfsBackend *backend, | ||
1707 | parent = g_path_get_dirname (filename); | ||
1708 | if (_change_directory (op_backend, parent, &error) == FALSE) | ||
1709 | { | ||
1710 | - g_mutex_unlock (op_backend->mutex); | ||
1711 | + g_mutex_unlock (&op_backend->mutex); | ||
1712 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1713 | g_error_free (error); | ||
1714 | return; | ||
1715 | @@ -2081,7 +2078,7 @@ do_make_directory (GVfsBackend *backend, | ||
1716 | |||
1717 | if (g_vfs_job_is_cancelled (G_VFS_JOB (job))) | ||
1718 | { | ||
1719 | - g_mutex_unlock (op_backend->mutex); | ||
1720 | + g_mutex_unlock (&op_backend->mutex); | ||
1721 | g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, | ||
1722 | G_IO_ERROR_CANCELLED, | ||
1723 | _("Operation was cancelled")); | ||
1724 | @@ -2093,7 +2090,7 @@ do_make_directory (GVfsBackend *backend, | ||
1725 | G_TYPE_STRING, basename, G_TYPE_INVALID, | ||
1726 | G_TYPE_INVALID) == FALSE) | ||
1727 | { | ||
1728 | - g_mutex_unlock (op_backend->mutex); | ||
1729 | + g_mutex_unlock (&op_backend->mutex); | ||
1730 | g_free (basename); | ||
1731 | g_vfs_job_failed_from_error (G_VFS_JOB (job), error); | ||
1732 | g_error_free (error); | ||
1733 | @@ -2108,7 +2105,7 @@ do_make_directory (GVfsBackend *backend, | ||
1734 | |||
1735 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1736 | |||
1737 | - g_mutex_unlock (op_backend->mutex); | ||
1738 | + g_mutex_unlock (&op_backend->mutex); | ||
1739 | |||
1740 | g_debug ("- do_make_directory\n"); | ||
1741 | } | ||
1742 | diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c | ||
1743 | index 01d7da6..f1055c5 100644 | ||
1744 | --- a/daemon/gvfsbackendsmbbrowse.c | ||
1745 | +++ b/daemon/gvfsbackendsmbbrowse.c | ||
1746 | @@ -94,8 +94,8 @@ struct _GVfsBackendSmbBrowse | ||
1747 | gboolean password_in_keyring; | ||
1748 | GPasswordSave password_save; | ||
1749 | |||
1750 | - GMutex *entries_lock; | ||
1751 | - GMutex *update_cache_lock; | ||
1752 | + GMutex entries_lock; | ||
1753 | + GMutex update_cache_lock; | ||
1754 | time_t last_entry_update; | ||
1755 | GList *entries; | ||
1756 | int entry_errno; | ||
1757 | @@ -226,8 +226,8 @@ g_vfs_backend_smb_browse_finalize (GObject *object) | ||
1758 | g_free (backend->server); | ||
1759 | g_free (backend->default_workgroup); | ||
1760 | |||
1761 | - g_mutex_free (backend->entries_lock); | ||
1762 | - g_mutex_free (backend->update_cache_lock); | ||
1763 | + g_mutex_clear (&backend->entries_lock); | ||
1764 | + g_mutex_clear (&backend->update_cache_lock); | ||
1765 | |||
1766 | smbc_free_context (backend->smb_context, TRUE); | ||
1767 | |||
1768 | @@ -244,9 +244,6 @@ g_vfs_backend_smb_browse_init (GVfsBackendSmbBrowse *backend) | ||
1769 | char *workgroup; | ||
1770 | GSettings *settings; | ||
1771 | |||
1772 | - backend->entries_lock = g_mutex_new (); | ||
1773 | - backend->update_cache_lock = g_mutex_new (); | ||
1774 | - | ||
1775 | if (mount_tracker == NULL) | ||
1776 | mount_tracker = g_mount_tracker_new (NULL); | ||
1777 | |||
1778 | @@ -592,7 +589,7 @@ update_cache (GVfsBackendSmbBrowse *backend, SMBCFILE *supplied_dir) | ||
1779 | entry_errno = 0; | ||
1780 | res = -1; | ||
1781 | |||
1782 | - g_mutex_lock (backend->update_cache_lock); | ||
1783 | + g_mutex_lock (&backend->update_cache_lock); | ||
1784 | |||
1785 | DEBUG ("update_cache - updating...\n"); | ||
1786 | |||
1787 | @@ -665,7 +662,7 @@ update_cache (GVfsBackendSmbBrowse *backend, SMBCFILE *supplied_dir) | ||
1788 | |||
1789 | out: | ||
1790 | |||
1791 | - g_mutex_lock (backend->entries_lock); | ||
1792 | + g_mutex_lock (&backend->entries_lock); | ||
1793 | |||
1794 | /* Clear old cache */ | ||
1795 | g_list_foreach (backend->entries, (GFunc)browse_entry_free, NULL); | ||
1796 | @@ -676,8 +673,8 @@ update_cache (GVfsBackendSmbBrowse *backend, SMBCFILE *supplied_dir) | ||
1797 | |||
1798 | DEBUG ("update_cache - done.\n"); | ||
1799 | |||
1800 | - g_mutex_unlock (backend->entries_lock); | ||
1801 | - g_mutex_unlock (backend->update_cache_lock); | ||
1802 | + g_mutex_unlock (&backend->entries_lock); | ||
1803 | + g_mutex_unlock (&backend->update_cache_lock); | ||
1804 | |||
1805 | return (res >= 0); | ||
1806 | } | ||
1807 | @@ -780,9 +777,9 @@ has_name (GVfsBackendSmbBrowse *backend, | ||
1808 | { | ||
1809 | gboolean res; | ||
1810 | |||
1811 | - g_mutex_lock (backend->entries_lock); | ||
1812 | + g_mutex_lock (&backend->entries_lock); | ||
1813 | res = (find_entry_unlocked (backend, filename) != NULL); | ||
1814 | - g_mutex_unlock (backend->entries_lock); | ||
1815 | + g_mutex_unlock (&backend->entries_lock); | ||
1816 | return res; | ||
1817 | } | ||
1818 | |||
1819 | @@ -793,11 +790,11 @@ cache_needs_updating (GVfsBackendSmbBrowse *backend) | ||
1820 | gboolean res; | ||
1821 | |||
1822 | /* If there's already cache update in progress, lock and wait until update is finished, then recheck */ | ||
1823 | - g_mutex_lock (backend->update_cache_lock); | ||
1824 | + g_mutex_lock (&backend->update_cache_lock); | ||
1825 | now = time (NULL); | ||
1826 | res = now < backend->last_entry_update || | ||
1827 | (now - backend->last_entry_update) > DEFAULT_CACHE_EXPIRATION_TIME; | ||
1828 | - g_mutex_unlock (backend->update_cache_lock); | ||
1829 | + g_mutex_unlock (&backend->update_cache_lock); | ||
1830 | |||
1831 | return res; | ||
1832 | } | ||
1833 | @@ -1070,7 +1067,7 @@ run_mount_mountable (GVfsBackendSmbBrowse *backend, | ||
1834 | GError *error = NULL; | ||
1835 | GMountSpec *mount_spec; | ||
1836 | |||
1837 | - g_mutex_lock (backend->entries_lock); | ||
1838 | + g_mutex_lock (&backend->entries_lock); | ||
1839 | |||
1840 | entry = find_entry_unlocked (backend, filename); | ||
1841 | |||
1842 | @@ -1093,7 +1090,7 @@ run_mount_mountable (GVfsBackendSmbBrowse *backend, | ||
1843 | G_IO_ERROR, G_IO_ERROR_NOT_FOUND, | ||
1844 | _("File doesn't exist")); | ||
1845 | |||
1846 | - g_mutex_unlock (backend->entries_lock); | ||
1847 | + g_mutex_unlock (&backend->entries_lock); | ||
1848 | |||
1849 | if (error) | ||
1850 | { | ||
1851 | @@ -1316,14 +1313,14 @@ run_query_info (GVfsBackendSmbBrowse *backend, | ||
1852 | { | ||
1853 | BrowseEntry *entry; | ||
1854 | |||
1855 | - g_mutex_lock (backend->entries_lock); | ||
1856 | + g_mutex_lock (&backend->entries_lock); | ||
1857 | |||
1858 | entry = find_entry_unlocked (backend, filename); | ||
1859 | |||
1860 | if (entry) | ||
1861 | get_file_info_from_entry (backend, entry, info); | ||
1862 | |||
1863 | - g_mutex_unlock (backend->entries_lock); | ||
1864 | + g_mutex_unlock (&backend->entries_lock); | ||
1865 | |||
1866 | if (entry) | ||
1867 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1868 | @@ -1408,7 +1405,7 @@ run_enumerate (GVfsBackendSmbBrowse *backend, | ||
1869 | g_vfs_job_succeeded (G_VFS_JOB (job)); | ||
1870 | |||
1871 | files = NULL; | ||
1872 | - g_mutex_lock (backend->entries_lock); | ||
1873 | + g_mutex_lock (&backend->entries_lock); | ||
1874 | for (l = backend->entries; l != NULL; l = l->next) | ||
1875 | { | ||
1876 | BrowseEntry *entry = l->data; | ||
1877 | @@ -1418,7 +1415,7 @@ run_enumerate (GVfsBackendSmbBrowse *backend, | ||
1878 | |||
1879 | files = g_list_prepend (files, info); | ||
1880 | } | ||
1881 | - g_mutex_unlock (backend->entries_lock); | ||
1882 | + g_mutex_unlock (&backend->entries_lock); | ||
1883 | |||
1884 | files = g_list_reverse (files); | ||
1885 | |||
1886 | diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c | ||
1887 | index 9714b39..4f59b94 100644 | ||
1888 | --- a/daemon/gvfsdaemon.c | ||
1889 | +++ b/daemon/gvfsdaemon.c | ||
1890 | @@ -58,7 +58,7 @@ struct _GVfsDaemon | ||
1891 | { | ||
1892 | GObject parent_instance; | ||
1893 | |||
1894 | - GMutex *lock; | ||
1895 | + GMutex lock; | ||
1896 | gboolean main_daemon; | ||
1897 | |||
1898 | GThreadPool *thread_pool; | ||
1899 | @@ -119,7 +119,7 @@ g_vfs_daemon_finalize (GObject *object) | ||
1900 | g_assert (daemon->jobs == NULL); | ||
1901 | |||
1902 | g_hash_table_destroy (daemon->registered_paths); | ||
1903 | - g_mutex_free (daemon->lock); | ||
1904 | + g_mutex_clear (&daemon->lock); | ||
1905 | |||
1906 | if (G_OBJECT_CLASS (g_vfs_daemon_parent_class)->finalize) | ||
1907 | (*G_OBJECT_CLASS (g_vfs_daemon_parent_class)->finalize) (object); | ||
1908 | @@ -150,7 +150,6 @@ g_vfs_daemon_init (GVfsDaemon *daemon) | ||
1909 | gint max_threads = 1; /* TODO: handle max threads */ | ||
1910 | DBusError error; | ||
1911 | |||
1912 | - daemon->lock = g_mutex_new (); | ||
1913 | daemon->session_bus = dbus_bus_get (DBUS_BUS_SESSION, NULL); | ||
1914 | daemon->thread_pool = g_thread_pool_new (job_handler_callback, | ||
1915 | daemon, | ||
1916 | @@ -326,7 +325,7 @@ static void | ||
1917 | job_source_closed_callback (GVfsJobSource *job_source, | ||
1918 | GVfsDaemon *daemon) | ||
1919 | { | ||
1920 | - g_mutex_lock (daemon->lock); | ||
1921 | + g_mutex_lock (&daemon->lock); | ||
1922 | |||
1923 | daemon->job_sources = g_list_remove (daemon->job_sources, | ||
1924 | job_source); | ||
1925 | @@ -343,7 +342,7 @@ job_source_closed_callback (GVfsJobSource *job_source, | ||
1926 | if (daemon->job_sources == NULL) | ||
1927 | daemon_schedule_exit (daemon); | ||
1928 | |||
1929 | - g_mutex_unlock (daemon->lock); | ||
1930 | + g_mutex_unlock (&daemon->lock); | ||
1931 | } | ||
1932 | |||
1933 | static void | ||
1934 | @@ -351,7 +350,7 @@ g_vfs_daemon_re_register_job_sources (GVfsDaemon *daemon) | ||
1935 | { | ||
1936 | GList *l; | ||
1937 | |||
1938 | - g_mutex_lock (daemon->lock); | ||
1939 | + g_mutex_lock (&daemon->lock); | ||
1940 | |||
1941 | for (l = daemon->job_sources; l != NULL; l = l->next) | ||
1942 | { | ||
1943 | @@ -366,7 +365,7 @@ g_vfs_daemon_re_register_job_sources (GVfsDaemon *daemon) | ||
1944 | } | ||
1945 | } | ||
1946 | |||
1947 | - g_mutex_unlock (daemon->lock); | ||
1948 | + g_mutex_unlock (&daemon->lock); | ||
1949 | } | ||
1950 | |||
1951 | void | ||
1952 | @@ -375,7 +374,7 @@ g_vfs_daemon_add_job_source (GVfsDaemon *daemon, | ||
1953 | { | ||
1954 | g_debug ("Added new job source %p (%s)\n", job_source, g_type_name_from_instance ((gpointer)job_source)); | ||
1955 | |||
1956 | - g_mutex_lock (daemon->lock); | ||
1957 | + g_mutex_lock (&daemon->lock); | ||
1958 | |||
1959 | daemon_unschedule_exit (daemon); | ||
1960 | |||
1961 | @@ -387,7 +386,7 @@ g_vfs_daemon_add_job_source (GVfsDaemon *daemon, | ||
1962 | g_signal_connect (job_source, "closed", | ||
1963 | (GCallback)job_source_closed_callback, daemon); | ||
1964 | |||
1965 | - g_mutex_unlock (daemon->lock); | ||
1966 | + g_mutex_unlock (&daemon->lock); | ||
1967 | } | ||
1968 | |||
1969 | /* This registers a dbus callback on *all* connections, client and session bus */ | ||
1970 | @@ -437,9 +436,9 @@ job_finished_callback (GVfsJob *job, | ||
1971 | (GCallback)job_finished_callback, | ||
1972 | daemon); | ||
1973 | |||
1974 | - g_mutex_lock (daemon->lock); | ||
1975 | + g_mutex_lock (&daemon->lock); | ||
1976 | daemon->jobs = g_list_remove (daemon->jobs, job); | ||
1977 | - g_mutex_unlock (daemon->lock); | ||
1978 | + g_mutex_unlock (&daemon->lock); | ||
1979 | |||
1980 | g_object_unref (job); | ||
1981 | } | ||
1982 | @@ -454,9 +453,9 @@ g_vfs_daemon_queue_job (GVfsDaemon *daemon, | ||
1983 | g_signal_connect (job, "finished", (GCallback)job_finished_callback, daemon); | ||
1984 | g_signal_connect (job, "new_source", (GCallback)job_new_source_callback, daemon); | ||
1985 | |||
1986 | - g_mutex_lock (daemon->lock); | ||
1987 | + g_mutex_lock (&daemon->lock); | ||
1988 | daemon->jobs = g_list_prepend (daemon->jobs, job); | ||
1989 | - g_mutex_unlock (daemon->lock); | ||
1990 | + g_mutex_unlock (&daemon->lock); | ||
1991 | |||
1992 | /* Can we start the job immediately / async */ | ||
1993 | if (!g_vfs_job_try (job)) | ||
1994 | @@ -949,7 +948,7 @@ daemon_message_func (DBusConnection *conn, | ||
1995 | DBUS_TYPE_UINT32, &serial, | ||
1996 | DBUS_TYPE_INVALID)) | ||
1997 | { | ||
1998 | - g_mutex_lock (daemon->lock); | ||
1999 | + g_mutex_lock (&daemon->lock); | ||
2000 | for (l = daemon->jobs; l != NULL; l = l->next) | ||
2001 | { | ||
2002 | GVfsJob *job = l->data; | ||
2003 | @@ -962,7 +961,7 @@ daemon_message_func (DBusConnection *conn, | ||
2004 | break; | ||
2005 | } | ||
2006 | } | ||
2007 | - g_mutex_unlock (daemon->lock); | ||
2008 | + g_mutex_unlock (&daemon->lock); | ||
2009 | |||
2010 | |||
2011 | if (job_to_cancel) | ||
2012 | @@ -1007,7 +1006,7 @@ peer_to_peer_filter_func (DBusConnection *conn, | ||
2013 | { | ||
2014 | GList *l; | ||
2015 | |||
2016 | - g_mutex_lock (daemon->lock); | ||
2017 | + g_mutex_lock (&daemon->lock); | ||
2018 | for (l = daemon->jobs; l != NULL; l = l->next) | ||
2019 | { | ||
2020 | GVfsJob *job = l->data; | ||
2021 | @@ -1016,7 +1015,7 @@ peer_to_peer_filter_func (DBusConnection *conn, | ||
2022 | G_VFS_JOB_DBUS (job)->connection == conn) | ||
2023 | g_vfs_job_cancel (job); | ||
2024 | } | ||
2025 | - g_mutex_unlock (daemon->lock); | ||
2026 | + g_mutex_unlock (&daemon->lock); | ||
2027 | |||
2028 | /* The peer-to-peer connection was disconnected */ | ||
2029 | dbus_connection_unref (conn); | ||
2030 | diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c | ||
2031 | index cd19c17..49023b1 100644 | ||
2032 | --- a/daemon/gvfsftpdircache.c | ||
2033 | +++ b/daemon/gvfsftpdircache.c | ||
2034 | @@ -98,7 +98,7 @@ struct _GVfsFtpDirCache | ||
2035 | { | ||
2036 | GHashTable * directories; /* GVfsFtpFile of directory => GVfsFtpDirCacheEntry mapping */ | ||
2037 | guint stamp; /* used to identify validity of cache when flushing */ | ||
2038 | - GMutex * lock; /* mutex for thread safety of stamp and hash table */ | ||
2039 | + GMutex lock; /* mutex for thread safety of stamp and hash table */ | ||
2040 | const GVfsFtpDirFuncs *funcs; /* functions to call */ | ||
2041 | }; | ||
2042 | |||
2043 | @@ -114,7 +114,6 @@ g_vfs_ftp_dir_cache_new (const GVfsFtpDirFuncs *funcs) | ||
2044 | g_vfs_ftp_file_equal, | ||
2045 | (GDestroyNotify) g_vfs_ftp_file_free, | ||
2046 | (GDestroyNotify) g_vfs_ftp_dir_cache_entry_unref); | ||
2047 | - cache->lock = g_mutex_new(); | ||
2048 | cache->funcs = funcs; | ||
2049 | |||
2050 | return cache; | ||
2051 | @@ -126,7 +125,7 @@ g_vfs_ftp_dir_cache_free (GVfsFtpDirCache *cache) | ||
2052 | g_return_if_fail (cache != NULL); | ||
2053 | |||
2054 | g_hash_table_destroy (cache->directories); | ||
2055 | - g_mutex_free (cache->lock); | ||
2056 | + g_mutex_clear (&cache->lock); | ||
2057 | g_slice_free (GVfsFtpDirCache, cache); | ||
2058 | } | ||
2059 | |||
2060 | @@ -138,11 +137,11 @@ g_vfs_ftp_dir_cache_lookup_entry (GVfsFtpDirCache * cache, | ||
2061 | { | ||
2062 | GVfsFtpDirCacheEntry *entry; | ||
2063 | |||
2064 | - g_mutex_lock (cache->lock); | ||
2065 | + g_mutex_lock (&cache->lock); | ||
2066 | entry = g_hash_table_lookup (cache->directories, dir); | ||
2067 | if (entry) | ||
2068 | g_vfs_ftp_dir_cache_entry_ref (entry); | ||
2069 | - g_mutex_unlock (cache->lock); | ||
2070 | + g_mutex_unlock (&cache->lock); | ||
2071 | if (entry && entry->stamp < stamp) | ||
2072 | g_vfs_ftp_dir_cache_entry_unref (entry); | ||
2073 | else if (entry) | ||
2074 | @@ -178,11 +177,11 @@ g_vfs_ftp_dir_cache_lookup_entry (GVfsFtpDirCache * cache, | ||
2075 | g_vfs_ftp_dir_cache_entry_unref (entry); | ||
2076 | return NULL; | ||
2077 | } | ||
2078 | - g_mutex_lock (cache->lock); | ||
2079 | + g_mutex_lock (&cache->lock); | ||
2080 | g_hash_table_insert (cache->directories, | ||
2081 | g_vfs_ftp_file_copy (dir), | ||
2082 | g_vfs_ftp_dir_cache_entry_ref (entry)); | ||
2083 | - g_mutex_unlock (cache->lock); | ||
2084 | + g_mutex_unlock (&cache->lock); | ||
2085 | return entry; | ||
2086 | } | ||
2087 | |||
2088 | @@ -357,10 +356,10 @@ g_vfs_ftp_dir_cache_lookup_dir (GVfsFtpDirCache * cache, | ||
2089 | |||
2090 | if (flush) | ||
2091 | { | ||
2092 | - g_mutex_lock (cache->lock); | ||
2093 | + g_mutex_lock (&cache->lock); | ||
2094 | g_assert (cache->stamp != G_MAXUINT); | ||
2095 | stamp = ++cache->stamp; | ||
2096 | - g_mutex_unlock (cache->lock); | ||
2097 | + g_mutex_unlock (&cache->lock); | ||
2098 | } | ||
2099 | else | ||
2100 | stamp = 0; | ||
2101 | @@ -390,9 +389,9 @@ g_vfs_ftp_dir_cache_purge_dir (GVfsFtpDirCache * cache, | ||
2102 | g_return_if_fail (cache != NULL); | ||
2103 | g_return_if_fail (dir != NULL); | ||
2104 | |||
2105 | - g_mutex_lock (cache->lock); | ||
2106 | + g_mutex_lock (&cache->lock); | ||
2107 | g_hash_table_remove (cache->directories, dir); | ||
2108 | - g_mutex_unlock (cache->lock); | ||
2109 | + g_mutex_unlock (&cache->lock); | ||
2110 | } | ||
2111 | |||
2112 | void | ||
2113 | diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c | ||
2114 | index 8c5f7fb..f83882a 100644 | ||
2115 | --- a/daemon/gvfsftptask.c | ||
2116 | +++ b/daemon/gvfsftptask.c | ||
2117 | @@ -180,7 +180,7 @@ static gboolean | ||
2118 | g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2119 | { | ||
2120 | GVfsBackendFtp *ftp; | ||
2121 | - GTimeVal now; | ||
2122 | + gint64 end_time; | ||
2123 | gulong id; | ||
2124 | |||
2125 | g_return_val_if_fail (task != NULL, FALSE); | ||
2126 | @@ -190,10 +190,10 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2127 | return FALSE; | ||
2128 | |||
2129 | ftp = task->backend; | ||
2130 | - g_mutex_lock (ftp->mutex); | ||
2131 | + g_mutex_lock (&ftp->mutex); | ||
2132 | id = g_cancellable_connect (task->cancellable, | ||
2133 | G_CALLBACK (do_broadcast), | ||
2134 | - ftp->cond, NULL); | ||
2135 | + &ftp->cond, NULL); | ||
2136 | while (task->conn == NULL && ftp->queue != NULL) | ||
2137 | { | ||
2138 | if (g_cancellable_is_cancelled (task->cancellable)) | ||
2139 | @@ -218,7 +218,7 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2140 | |||
2141 | ftp->connections++; | ||
2142 | last_thread = g_thread_self (); | ||
2143 | - g_mutex_unlock (ftp->mutex); | ||
2144 | + g_mutex_unlock (&ftp->mutex); | ||
2145 | task->conn = g_vfs_ftp_connection_new (ftp->addr, task->cancellable, &task->error); | ||
2146 | if (G_LIKELY (task->conn != NULL)) | ||
2147 | { | ||
2148 | @@ -231,7 +231,7 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2149 | |||
2150 | g_vfs_ftp_connection_free (task->conn); | ||
2151 | task->conn = NULL; | ||
2152 | - g_mutex_lock (ftp->mutex); | ||
2153 | + g_mutex_lock (&ftp->mutex); | ||
2154 | ftp->connections--; | ||
2155 | /* If this value is still equal to our thread it means there were no races | ||
2156 | * trying to open connections and the maybe_max_connections value is | ||
2157 | @@ -253,10 +253,9 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2158 | continue; | ||
2159 | } | ||
2160 | |||
2161 | - g_get_current_time (&now); | ||
2162 | - g_time_val_add (&now, G_VFS_FTP_TIMEOUT_IN_SECONDS * 1000 * 1000); | ||
2163 | + end_time = g_get_monotonic_time () + G_VFS_FTP_TIMEOUT_IN_SECONDS * G_TIME_SPAN_SECOND; | ||
2164 | if (ftp->busy_connections >= ftp->connections || | ||
2165 | - !g_cond_timed_wait (ftp->cond, ftp->mutex, &now)) | ||
2166 | + !g_cond_wait_until (&ftp->cond, &ftp->mutex, end_time)) | ||
2167 | { | ||
2168 | task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_BUSY, | ||
2169 | _("The FTP server is busy. Try again later")); | ||
2170 | @@ -264,7 +263,7 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task) | ||
2171 | } | ||
2172 | } | ||
2173 | g_cancellable_disconnect (task->cancellable, id); | ||
2174 | - g_mutex_unlock (ftp->mutex); | ||
2175 | + g_mutex_unlock (&ftp->mutex); | ||
2176 | |||
2177 | return task->conn != NULL; | ||
2178 | } | ||
2179 | @@ -287,18 +286,18 @@ g_vfs_ftp_task_release_connection (GVfsFtpTask *task) | ||
2180 | if (task->conn == NULL) | ||
2181 | return; | ||
2182 | |||
2183 | - g_mutex_lock (task->backend->mutex); | ||
2184 | + g_mutex_lock (&task->backend->mutex); | ||
2185 | if (task->backend->queue && g_vfs_ftp_connection_is_usable (task->conn)) | ||
2186 | { | ||
2187 | g_queue_push_tail (task->backend->queue, task->conn); | ||
2188 | - g_cond_signal (task->backend->cond); | ||
2189 | + g_cond_signal (&task->backend->cond); | ||
2190 | } | ||
2191 | else | ||
2192 | { | ||
2193 | task->backend->connections--; | ||
2194 | g_vfs_ftp_connection_free (task->conn); | ||
2195 | } | ||
2196 | - g_mutex_unlock (task->backend->mutex); | ||
2197 | + g_mutex_unlock (&task->backend->mutex); | ||
2198 | task->conn = NULL; | ||
2199 | } | ||
2200 | |||
2201 | @@ -434,10 +433,10 @@ g_vfs_ftp_task_give_connection (GVfsFtpTask * task, | ||
2202 | |||
2203 | task->conn = conn; | ||
2204 | /* this connection is not busy anymore */ | ||
2205 | - g_mutex_lock (task->backend->mutex); | ||
2206 | + g_mutex_lock (&task->backend->mutex); | ||
2207 | g_assert (task->backend->busy_connections > 0); | ||
2208 | task->backend->busy_connections--; | ||
2209 | - g_mutex_unlock (task->backend->mutex); | ||
2210 | + g_mutex_unlock (&task->backend->mutex); | ||
2211 | } | ||
2212 | |||
2213 | /** | ||
2214 | @@ -465,13 +464,13 @@ g_vfs_ftp_task_take_connection (GVfsFtpTask *task) | ||
2215 | |||
2216 | ftp = task->backend; | ||
2217 | /* mark this connection as busy */ | ||
2218 | - g_mutex_lock (ftp->mutex); | ||
2219 | + g_mutex_lock (&ftp->mutex); | ||
2220 | ftp->busy_connections++; | ||
2221 | /* if all connections are busy, signal all waiting threads, | ||
2222 | * so they stop waiting and return BUSY earlier */ | ||
2223 | if (ftp->busy_connections >= ftp->connections) | ||
2224 | - g_cond_broadcast (ftp->cond); | ||
2225 | - g_mutex_unlock (ftp->mutex); | ||
2226 | + g_cond_broadcast (&ftp->cond); | ||
2227 | + g_mutex_unlock (&ftp->mutex); | ||
2228 | |||
2229 | return conn; | ||
2230 | } | ||
2231 | diff --git a/daemon/trashlib/trashexpunge.c b/daemon/trashlib/trashexpunge.c | ||
2232 | index 782be54..a5cf975 100644 | ||
2233 | --- a/daemon/trashlib/trashexpunge.c | ||
2234 | +++ b/daemon/trashlib/trashexpunge.c | ||
2235 | @@ -11,8 +11,8 @@ | ||
2236 | static gsize trash_expunge_initialised; | ||
2237 | static GHashTable *trash_expunge_queue; | ||
2238 | static gboolean trash_expunge_alive; | ||
2239 | -static GMutex *trash_expunge_lock; | ||
2240 | -static GCond *trash_expunge_wait; | ||
2241 | +static GMutex trash_expunge_lock; | ||
2242 | +static GCond trash_expunge_wait; | ||
2243 | |||
2244 | static void | ||
2245 | trash_expunge_delete_everything_under (GFile *directory) | ||
2246 | @@ -66,9 +66,9 @@ just_return_true (gpointer a, | ||
2247 | static gpointer | ||
2248 | trash_expunge_thread (gpointer data) | ||
2249 | { | ||
2250 | - GTimeVal timeval; | ||
2251 | + gint64 end_time; | ||
2252 | |||
2253 | - g_mutex_lock (trash_expunge_lock); | ||
2254 | + g_mutex_lock (&trash_expunge_lock); | ||
2255 | |||
2256 | do | ||
2257 | { | ||
2258 | @@ -80,23 +80,22 @@ trash_expunge_thread (gpointer data) | ||
2259 | just_return_true, NULL); | ||
2260 | g_hash_table_remove (trash_expunge_queue, directory); | ||
2261 | |||
2262 | - g_mutex_unlock (trash_expunge_lock); | ||
2263 | + g_mutex_unlock (&trash_expunge_lock); | ||
2264 | trash_expunge_delete_everything_under (directory); | ||
2265 | - g_mutex_lock (trash_expunge_lock); | ||
2266 | + g_mutex_lock (&trash_expunge_lock); | ||
2267 | |||
2268 | g_object_unref (directory); | ||
2269 | } | ||
2270 | |||
2271 | - g_get_current_time (&timeval); | ||
2272 | - g_time_val_add (&timeval, 60 * 1000000); /* 1min */ | ||
2273 | + end_time = g_get_monotonic_time () + 1 * G_TIME_SPAN_MINUTE; | ||
2274 | } | ||
2275 | - while (g_cond_timed_wait (trash_expunge_wait, | ||
2276 | - trash_expunge_lock, | ||
2277 | - &timeval)); | ||
2278 | + while (g_cond_wait_until (&trash_expunge_wait, | ||
2279 | + &trash_expunge_lock, | ||
2280 | + end_time)); | ||
2281 | |||
2282 | trash_expunge_alive = FALSE; | ||
2283 | |||
2284 | - g_mutex_unlock (trash_expunge_lock); | ||
2285 | + g_mutex_unlock (&trash_expunge_lock); | ||
2286 | |||
2287 | return NULL; | ||
2288 | } | ||
2289 | @@ -108,13 +107,13 @@ trash_expunge (GFile *directory) | ||
2290 | { | ||
2291 | trash_expunge_queue = g_hash_table_new (g_file_hash, | ||
2292 | (GEqualFunc) g_file_equal); | ||
2293 | - trash_expunge_lock = g_mutex_new (); | ||
2294 | - trash_expunge_wait = g_cond_new (); | ||
2295 | + g_mutex_init (&trash_expunge_lock); | ||
2296 | + g_cond_init (&trash_expunge_wait); | ||
2297 | |||
2298 | g_once_init_leave (&trash_expunge_initialised, 1); | ||
2299 | } | ||
2300 | |||
2301 | - g_mutex_lock (trash_expunge_lock); | ||
2302 | + g_mutex_lock (&trash_expunge_lock); | ||
2303 | |||
2304 | if (!g_hash_table_lookup (trash_expunge_queue, directory)) | ||
2305 | g_hash_table_insert (trash_expunge_queue, | ||
2306 | @@ -130,7 +129,7 @@ trash_expunge (GFile *directory) | ||
2307 | trash_expunge_alive = TRUE; | ||
2308 | } | ||
2309 | else | ||
2310 | - g_cond_signal (trash_expunge_wait); | ||
2311 | + g_cond_signal (&trash_expunge_wait); | ||
2312 | |||
2313 | - g_mutex_unlock (trash_expunge_lock); | ||
2314 | + g_mutex_unlock (&trash_expunge_lock); | ||
2315 | } | ||
2316 | diff --git a/daemon/trashlib/trashitem.c b/daemon/trashlib/trashitem.c | ||
2317 | index bcfc301..dbc9307 100644 | ||
2318 | --- a/daemon/trashlib/trashitem.c | ||
2319 | +++ b/daemon/trashlib/trashitem.c | ||
2320 | @@ -20,7 +20,7 @@ typedef struct | ||
2321 | |||
2322 | struct OPAQUE_TYPE__TrashRoot | ||
2323 | { | ||
2324 | - GStaticRWLock lock; | ||
2325 | + GRWLock lock; | ||
2326 | GQueue *notifications; | ||
2327 | |||
2328 | trash_item_notify create_notify; | ||
2329 | @@ -297,12 +297,12 @@ trash_root_thaw (TrashRoot *root) | ||
2330 | /* send notifications until we have none */ | ||
2331 | while (TRUE) | ||
2332 | { | ||
2333 | - g_static_rw_lock_writer_lock (&root->lock); | ||
2334 | + g_rw_lock_writer_lock (&root->lock); | ||
2335 | if (g_queue_is_empty (root->notifications)) | ||
2336 | break; | ||
2337 | |||
2338 | closure = g_queue_pop_head (root->notifications); | ||
2339 | - g_static_rw_lock_writer_unlock (&root->lock); | ||
2340 | + g_rw_lock_writer_unlock (&root->lock); | ||
2341 | |||
2342 | trash_item_invoke_closure (closure); | ||
2343 | } | ||
2344 | @@ -312,7 +312,7 @@ trash_root_thaw (TrashRoot *root) | ||
2345 | size_changed = root->old_size != size; | ||
2346 | root->old_size = size; | ||
2347 | |||
2348 | - g_static_rw_lock_writer_unlock (&root->lock); | ||
2349 | + g_rw_lock_writer_unlock (&root->lock); | ||
2350 | |||
2351 | if (size_changed) | ||
2352 | root->size_change (root->user_data); | ||
2353 | @@ -336,7 +336,7 @@ trash_root_new (trash_item_notify create, | ||
2354 | TrashRoot *root; | ||
2355 | |||
2356 | root = g_slice_new (TrashRoot); | ||
2357 | - g_static_rw_lock_init (&root->lock); | ||
2358 | + g_rw_lock_init (&root->lock); | ||
2359 | root->create_notify = create; | ||
2360 | root->delete_notify = delete; | ||
2361 | root->size_change = size_change; | ||
2362 | @@ -376,11 +376,11 @@ trash_root_add_item (TrashRoot *list, | ||
2363 | |||
2364 | item = trash_item_new (list, file, in_homedir); | ||
2365 | |||
2366 | - g_static_rw_lock_writer_lock (&list->lock); | ||
2367 | + g_rw_lock_writer_lock (&list->lock); | ||
2368 | |||
2369 | if (g_hash_table_lookup (list->item_table, item->escaped_name)) | ||
2370 | { | ||
2371 | - g_static_rw_lock_writer_unlock (&list->lock); | ||
2372 | + g_rw_lock_writer_unlock (&list->lock); | ||
2373 | |||
2374 | /* already exists... */ | ||
2375 | trash_item_unref (item); | ||
2376 | @@ -390,7 +390,7 @@ trash_root_add_item (TrashRoot *list, | ||
2377 | g_hash_table_insert (list->item_table, item->escaped_name, item); | ||
2378 | trash_item_queue_notify (item, item->root->create_notify); | ||
2379 | |||
2380 | - g_static_rw_lock_writer_unlock (&list->lock); | ||
2381 | + g_rw_lock_writer_unlock (&list->lock); | ||
2382 | } | ||
2383 | |||
2384 | void | ||
2385 | @@ -402,9 +402,9 @@ trash_root_remove_item (TrashRoot *list, | ||
2386 | |||
2387 | escaped = trash_item_escape_name (file, in_homedir); | ||
2388 | |||
2389 | - g_static_rw_lock_writer_lock (&list->lock); | ||
2390 | + g_rw_lock_writer_lock (&list->lock); | ||
2391 | g_hash_table_remove (list->item_table, escaped); | ||
2392 | - g_static_rw_lock_writer_unlock (&list->lock); | ||
2393 | + g_rw_lock_writer_unlock (&list->lock); | ||
2394 | |||
2395 | g_free (escaped); | ||
2396 | } | ||
2397 | @@ -414,13 +414,13 @@ trash_root_get_items (TrashRoot *root) | ||
2398 | { | ||
2399 | GList *items, *node; | ||
2400 | |||
2401 | - g_static_rw_lock_reader_lock (&root->lock); | ||
2402 | + g_rw_lock_reader_lock (&root->lock); | ||
2403 | |||
2404 | items = g_hash_table_get_values (root->item_table); | ||
2405 | for (node = items; node; node = node->next) | ||
2406 | trash_item_ref (node->data); | ||
2407 | |||
2408 | - g_static_rw_lock_reader_unlock (&root->lock); | ||
2409 | + g_rw_lock_reader_unlock (&root->lock); | ||
2410 | |||
2411 | return items; | ||
2412 | } | ||
2413 | @@ -441,12 +441,12 @@ trash_root_lookup_item (TrashRoot *root, | ||
2414 | { | ||
2415 | TrashItem *item; | ||
2416 | |||
2417 | - g_static_rw_lock_reader_lock (&root->lock); | ||
2418 | + g_rw_lock_reader_lock (&root->lock); | ||
2419 | |||
2420 | if ((item = g_hash_table_lookup (root->item_table, escaped))) | ||
2421 | trash_item_ref (item); | ||
2422 | |||
2423 | - g_static_rw_lock_reader_unlock (&root->lock); | ||
2424 | + g_rw_lock_reader_unlock (&root->lock); | ||
2425 | |||
2426 | return item; | ||
2427 | } | ||
2428 | @@ -456,9 +456,9 @@ trash_root_get_n_items (TrashRoot *root) | ||
2429 | { | ||
2430 | int size; | ||
2431 | |||
2432 | - g_static_rw_lock_reader_lock (&root->lock); | ||
2433 | + g_rw_lock_reader_lock (&root->lock); | ||
2434 | size = g_hash_table_size (root->item_table); | ||
2435 | - g_static_rw_lock_reader_unlock (&root->lock); | ||
2436 | + g_rw_lock_reader_unlock (&root->lock); | ||
2437 | |||
2438 | return size; | ||
2439 | } | ||
2440 | @@ -517,9 +517,9 @@ trash_item_restore (TrashItem *item, | ||
2441 | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, | ||
2442 | NULL, NULL, NULL, error)) | ||
2443 | { | ||
2444 | - g_static_rw_lock_writer_lock (&item->root->lock); | ||
2445 | + g_rw_lock_writer_lock (&item->root->lock); | ||
2446 | g_hash_table_remove (item->root->item_table, item->escaped_name); | ||
2447 | - g_static_rw_lock_writer_unlock (&item->root->lock); | ||
2448 | + g_rw_lock_writer_unlock (&item->root->lock); | ||
2449 | |||
2450 | { | ||
2451 | GFile *trashinfo; | ||
2452 | -- | ||
2453 | 1.7.6.5 | ||
2454 | |||
diff --git a/meta-gnome/recipes-gnome/gvfs/files/0004-Adapt-to-glib-thread-API-changes.patch b/meta-gnome/recipes-gnome/gvfs/files/0004-Adapt-to-glib-thread-API-changes.patch new file mode 100644 index 000000000..0fac60155 --- /dev/null +++ b/meta-gnome/recipes-gnome/gvfs/files/0004-Adapt-to-glib-thread-API-changes.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | From 008031adbe2fd118a4e9a3c7219a9777cab1bb75 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tomas Bzatek <tbzatek@redhat.com> | ||
3 | Date: Wed, 26 Oct 2011 14:12:13 +0200 | ||
4 | Subject: [PATCH 2/2] Adapt to glib thread API changes | ||
5 | |||
6 | Last piece in order to fix https://bugzilla.gnome.org/show_bug.cgi?id=661148 | ||
7 | |||
8 | Upstream-Status: Backport | ||
9 | |||
10 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
11 | --- | ||
12 | client/gvfsfusedaemon.c | 2 +- | ||
13 | daemon/trashlib/trashexpunge.c | 2 +- | ||
14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c | ||
17 | index c986f69..5e79638 100644 | ||
18 | --- a/client/gvfsfusedaemon.c | ||
19 | +++ b/client/gvfsfusedaemon.c | ||
20 | @@ -2358,7 +2358,7 @@ vfs_init (struct fuse_conn_info *conn) | ||
21 | volume_monitor = g_object_new (g_type_from_name ("GDaemonVolumeMonitor"), NULL); | ||
22 | |||
23 | subthread_main_loop = g_main_loop_new (NULL, FALSE); | ||
24 | - subthread = g_thread_create ((GThreadFunc) subthread_main, NULL, FALSE, NULL); | ||
25 | + subthread = g_thread_new ("gvfs-fuse-sub", (GThreadFunc) subthread_main, NULL); | ||
26 | |||
27 | /* Indicate O_TRUNC support for open() */ | ||
28 | conn->want |= FUSE_CAP_ATOMIC_O_TRUNC; | ||
29 | diff --git a/daemon/trashlib/trashexpunge.c b/daemon/trashlib/trashexpunge.c | ||
30 | index a5cf975..677fb81 100644 | ||
31 | --- a/daemon/trashlib/trashexpunge.c | ||
32 | +++ b/daemon/trashlib/trashexpunge.c | ||
33 | @@ -124,7 +124,7 @@ trash_expunge (GFile *directory) | ||
34 | { | ||
35 | GThread *thread; | ||
36 | |||
37 | - thread = g_thread_create (trash_expunge_thread, NULL, FALSE, NULL); | ||
38 | + thread = g_thread_new ("trash-expunge", trash_expunge_thread, NULL); | ||
39 | g_assert (thread != NULL); | ||
40 | trash_expunge_alive = TRUE; | ||
41 | } | ||
42 | -- | ||
43 | 1.7.6.5 | ||
44 | |||
diff --git a/meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.8.2.bb b/meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.10.1.bb index 8fe72edd3..bd6d9de5d 100644 --- a/meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.8.2.bb +++ b/meta-gnome/recipes-gnome/gvfs/gvfs-gdu-volume-monitor_1.10.1.bb | |||
@@ -4,7 +4,7 @@ BPN = "gvfs" | |||
4 | 4 | ||
5 | DEPENDS = "gvfs gnome-disk-utility" | 5 | DEPENDS = "gvfs gnome-disk-utility" |
6 | 6 | ||
7 | PR = "${INC_PR}.5" | 7 | PR = "${INC_PR}.0" |
8 | 8 | ||
9 | # we need gdu files only: reduce files to delete in libexecdir | 9 | # we need gdu files only: reduce files to delete in libexecdir |
10 | EXTRA_OECONF += "--disable-gphoto2 \ | 10 | EXTRA_OECONF += "--disable-gphoto2 \ |
diff --git a/meta-gnome/recipes-gnome/gvfs/gvfs.inc b/meta-gnome/recipes-gnome/gvfs/gvfs.inc index 0e1c69cf2..491428585 100644 --- a/meta-gnome/recipes-gnome/gvfs/gvfs.inc +++ b/meta-gnome/recipes-gnome/gvfs/gvfs.inc | |||
@@ -4,11 +4,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7" | |||
4 | 4 | ||
5 | inherit gnome | 5 | inherit gnome |
6 | 6 | ||
7 | INC_PR = "r9" | 7 | INC_PR = "r0" |
8 | 8 | ||
9 | SRC_URI[archive.md5sum] = "402f94b187b197b403d25c85caeb9562" | 9 | GNOME_COMPRESS_TYPE = "xz" |
10 | SRC_URI[archive.sha256sum] = "0895ac8f6d416e1b15433b6b6b68eb119c6e8b04fdb66db665d684355ef89345" | 10 | |
11 | SRC_URI += "file://0001-gvfsfusedaemon.c-fix-glib-build.patch" | 11 | SRC_URI[archive.md5sum] = "0c968704be003d2f6eab29388c41664e" |
12 | SRC_URI[archive.sha256sum] = "cd30facee5ad6cd0fafc5337bbf7c06a0bff3936f9ff2ae31519b301efcc9288" | ||
13 | SRC_URI += " \ | ||
14 | file://0001-Revert-Respect-UDISKS_AUTOMOUNT_HINT-available-in-re.patch \ | ||
15 | file://0002-Adapt-to-GLib-2.31-deprecations-and-thread-API-chang.patch \ | ||
16 | file://0003-Adapt-to-glib-mutex-API-changes.patch \ | ||
17 | file://0004-Adapt-to-glib-thread-API-changes.patch \ | ||
18 | " | ||
12 | 19 | ||
13 | EXTRA_OECONF = "--with-samba-includes=${STAGING_INCDIR} \ | 20 | EXTRA_OECONF = "--with-samba-includes=${STAGING_INCDIR} \ |
14 | --with-samba-libs=${STAGING_LIBDIR} \ | 21 | --with-samba-libs=${STAGING_LIBDIR} \ |
diff --git a/meta-gnome/recipes-gnome/gvfs/gvfs_1.8.2.bb b/meta-gnome/recipes-gnome/gvfs/gvfs_1.10.1.bb index 7f8615106..9c21760b7 100644 --- a/meta-gnome/recipes-gnome/gvfs/gvfs_1.8.2.bb +++ b/meta-gnome/recipes-gnome/gvfs/gvfs_1.10.1.bb | |||
@@ -3,7 +3,7 @@ require gvfs.inc | |||
3 | DEPENDS = "samba libsoup-2.4 gnome-keyring glib-2.0 fuse avahi fuse gconf libgphoto2" | 3 | DEPENDS = "samba libsoup-2.4 gnome-keyring glib-2.0 fuse avahi fuse gconf libgphoto2" |
4 | # optional: obexftp libcdio libimobiledevice | 4 | # optional: obexftp libcdio libimobiledevice |
5 | 5 | ||
6 | PR = "${INC_PR}.1" | 6 | PR = "${INC_PR}.0" |
7 | 7 | ||
8 | # in case of gnome-disk-utility was alresdy built: avoid double files | 8 | # in case of gnome-disk-utility was alresdy built: avoid double files |
9 | # afc is enabled when it detects libimobiledevice | 9 | # afc is enabled when it detects libimobiledevice |