This commit is contained in:
parent
0d63366acc
commit
b0870e7b0f
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:27d73ba99f71d01d306887a19535a3384e9e374db5231f8f7eb2918f8eb0f877
|
||||
size 830289
|
3
gvfs-0.99.1.tar.bz2
Normal file
3
gvfs-0.99.1.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:026e174a7c0108a53c6914aef23879478f3684dab340f4f1e6a661561ebb0fc9
|
||||
size 829953
|
@ -1,274 +0,0 @@
|
||||
--- gvfs-0-2-3/client/gvfsfusedaemon.c 2008-05-23 14:24:07.000000000 -0500
|
||||
+++ gvfs-2-22/client/gvfsfusedaemon.c 2008-05-23 14:17:36.000000000 -0500
|
||||
@@ -55,8 +55,8 @@
|
||||
|
||||
#define DEBUG_ENABLED 0
|
||||
|
||||
-#define GET_FILE_HANDLE(fi) (GUINT_TO_POINTER ((guint) (fi)->fh))
|
||||
-#define SET_FILE_HANDLE(fi, fh) ((fi)->fh = (guint64) GPOINTER_TO_UINT (fh))
|
||||
+#define GET_FILE_HANDLE(fi) ((gpointer) (fi)->fh)
|
||||
+#define SET_FILE_HANDLE(fi, fh) ((fi)->fh = (guint64) (fh))
|
||||
|
||||
typedef struct {
|
||||
time_t creation_time;
|
||||
@@ -71,7 +71,10 @@ typedef enum {
|
||||
} FileOp;
|
||||
|
||||
typedef struct {
|
||||
+ gint refcount;
|
||||
+
|
||||
GMutex *mutex;
|
||||
+ gchar *path;
|
||||
FileOp op;
|
||||
gpointer stream;
|
||||
gint length;
|
||||
@@ -183,18 +186,45 @@ errno_from_error (GError *error)
|
||||
}
|
||||
|
||||
static FileHandle *
|
||||
-file_handle_new (void)
|
||||
+file_handle_new (const gchar *path)
|
||||
{
|
||||
FileHandle *file_handle;
|
||||
|
||||
file_handle = g_new0 (FileHandle, 1);
|
||||
+ file_handle->refcount = 1;
|
||||
file_handle->mutex = g_mutex_new ();
|
||||
file_handle->op = FILE_OP_NONE;
|
||||
+ file_handle->path = g_strdup (path);
|
||||
+
|
||||
+ return file_handle;
|
||||
+}
|
||||
|
||||
+static FileHandle *
|
||||
+file_handle_ref (FileHandle *file_handle)
|
||||
+{
|
||||
+ g_atomic_int_inc (&file_handle->refcount);
|
||||
return file_handle;
|
||||
}
|
||||
|
||||
static void
|
||||
+file_handle_unref (FileHandle *file_handle)
|
||||
+{
|
||||
+ if (g_atomic_int_dec_and_test (&file_handle->refcount))
|
||||
+ {
|
||||
+ g_static_mutex_lock (&global_mutex);
|
||||
+
|
||||
+ /* Test again, since e.g. get_file_handle_for_path() might have
|
||||
+ * snatched the global mutex and revived the file handle between
|
||||
+ * g_atomic_int_dec_and_test() and us obtaining the lock. */
|
||||
+
|
||||
+ if (g_atomic_int_get (&file_handle->refcount) == 0)
|
||||
+ g_hash_table_remove (global_fh_table, file_handle->path);
|
||||
+
|
||||
+ g_static_mutex_unlock (&global_mutex);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
file_handle_close_stream (FileHandle *file_handle)
|
||||
{
|
||||
debug_print ("file_handle_close_stream\n");
|
||||
@@ -220,11 +250,13 @@ file_handle_close_stream (FileHandle *fi
|
||||
}
|
||||
}
|
||||
|
||||
+/* Called on hash table removal */
|
||||
static void
|
||||
file_handle_free (FileHandle *file_handle)
|
||||
{
|
||||
file_handle_close_stream (file_handle);
|
||||
g_mutex_free (file_handle->mutex);
|
||||
+ g_free (file_handle->path);
|
||||
g_free (file_handle);
|
||||
}
|
||||
|
||||
@@ -234,7 +266,11 @@ get_file_handle_for_path (const gchar *p
|
||||
FileHandle *fh;
|
||||
|
||||
g_static_mutex_lock (&global_mutex);
|
||||
+
|
||||
fh = g_hash_table_lookup (global_fh_table, path);
|
||||
+ if (fh)
|
||||
+ file_handle_ref (fh);
|
||||
+
|
||||
g_static_mutex_unlock (&global_mutex);
|
||||
|
||||
return fh;
|
||||
@@ -245,15 +281,21 @@ get_or_create_file_handle_for_path (cons
|
||||
{
|
||||
FileHandle *fh;
|
||||
|
||||
- fh = get_file_handle_for_path (path);
|
||||
- if (!fh)
|
||||
- {
|
||||
- fh = file_handle_new ();
|
||||
+ g_static_mutex_lock (&global_mutex);
|
||||
|
||||
- g_static_mutex_lock (&global_mutex);
|
||||
- g_hash_table_insert (global_fh_table, g_strdup (path), fh);
|
||||
- g_static_mutex_unlock (&global_mutex);
|
||||
+ fh = g_hash_table_lookup (global_fh_table, path);
|
||||
+
|
||||
+ if (fh)
|
||||
+ {
|
||||
+ file_handle_ref (fh);
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ fh = file_handle_new (path);
|
||||
+ g_hash_table_insert (global_fh_table, fh->path, fh);
|
||||
+ }
|
||||
+
|
||||
+ g_static_mutex_unlock (&global_mutex);
|
||||
|
||||
return fh;
|
||||
}
|
||||
@@ -271,30 +313,15 @@ reindex_file_handle_for_path (const gcha
|
||||
(gpointer *) &fh))
|
||||
goto out;
|
||||
|
||||
- g_free (old_path_internal);
|
||||
- g_hash_table_insert (global_fh_table, g_strdup (new_path), fh);
|
||||
+ g_free (fh->path);
|
||||
+ fh->path = g_strdup (new_path);
|
||||
+ g_hash_table_steal (global_fh_table, old_path);
|
||||
+ g_hash_table_insert (global_fh_table, fh->path, fh);
|
||||
|
||||
out:
|
||||
g_static_mutex_unlock (&global_mutex);
|
||||
}
|
||||
|
||||
-static gboolean
|
||||
-free_file_handle_for_path (const gchar *path)
|
||||
-{
|
||||
- FileHandle *fh;
|
||||
-
|
||||
- fh = get_file_handle_for_path (path);
|
||||
- if (fh)
|
||||
- {
|
||||
- g_static_mutex_lock (&global_mutex);
|
||||
- g_hash_table_remove (global_fh_table, path);
|
||||
- g_static_mutex_unlock (&global_mutex);
|
||||
- return TRUE;
|
||||
- }
|
||||
-
|
||||
- return FALSE;
|
||||
-}
|
||||
-
|
||||
static MountRecord *
|
||||
mount_record_new (GMount *mount)
|
||||
{
|
||||
@@ -795,7 +822,10 @@ vfs_getattr (const gchar *path, struct s
|
||||
}
|
||||
|
||||
if (fh)
|
||||
- g_mutex_unlock (fh->mutex);
|
||||
+ {
|
||||
+ g_mutex_unlock (fh->mutex);
|
||||
+ file_handle_unref (fh);
|
||||
+ }
|
||||
|
||||
debug_print ("vfs_getattr: -> %s\n", strerror (-result));
|
||||
|
||||
@@ -933,6 +963,8 @@ vfs_open (const gchar *path, struct fuse
|
||||
result = setup_output_stream (file, fh);
|
||||
else
|
||||
result = setup_input_stream (file, fh);
|
||||
+
|
||||
+ /* The added reference to the file handle is released in vfs_release() */
|
||||
}
|
||||
else if (file_type == G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
@@ -1019,6 +1051,8 @@ vfs_create (const gchar *path, mode_t mo
|
||||
|
||||
fh->stream = file_output_stream;
|
||||
fh->op = FILE_OP_WRITE;
|
||||
+
|
||||
+ /* The added reference to the file handle is released in vfs_release() */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1047,7 +1081,7 @@ vfs_release (const gchar *path, struct f
|
||||
debug_print ("vfs_release: %s\n", path);
|
||||
|
||||
if (fh)
|
||||
- free_file_handle_for_path (path);
|
||||
+ file_handle_unref (fh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1479,6 +1513,7 @@ vfs_rename (const gchar *old_path, const
|
||||
if (fh)
|
||||
{
|
||||
g_mutex_unlock (fh->mutex);
|
||||
+ file_handle_unref (fh);
|
||||
}
|
||||
|
||||
if (result == -EISDIR)
|
||||
@@ -1530,6 +1565,7 @@ vfs_unlink (const gchar *path)
|
||||
if (fh)
|
||||
{
|
||||
g_mutex_unlock (fh->mutex);
|
||||
+ file_handle_unref (fh);
|
||||
}
|
||||
|
||||
if (error)
|
||||
@@ -1748,7 +1784,10 @@ vfs_truncate (const gchar *path, off_t s
|
||||
}
|
||||
|
||||
if (fh)
|
||||
- g_mutex_unlock (fh->mutex);
|
||||
+ {
|
||||
+ g_mutex_unlock (fh->mutex);
|
||||
+ file_handle_unref (fh);
|
||||
+ }
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
@@ -1998,6 +2037,9 @@ subthread_main (gpointer data)
|
||||
g_object_unref (volume_monitor);
|
||||
volume_monitor = NULL;
|
||||
|
||||
+ /* Tell the main thread to unmount. Using kill() is necessary according to FUSE maintainers. */
|
||||
+ kill (getpid (), SIGHUP);
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2025,9 +2067,16 @@ dbus_filter_func (DBusConnection *connec
|
||||
*new_owner == 0)
|
||||
{
|
||||
/* The daemon died, unmount */
|
||||
- kill (getpid(), SIGHUP);
|
||||
+ g_main_loop_quit (subthread_main_loop);
|
||||
}
|
||||
}
|
||||
+ else if (dbus_message_is_signal (message,
|
||||
+ DBUS_INTERFACE_LOCAL,
|
||||
+ "Disconnected"))
|
||||
+ {
|
||||
+ /* Session bus died, unmount */
|
||||
+ g_main_loop_quit (subthread_main_loop);
|
||||
+ }
|
||||
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
@@ -2046,7 +2094,7 @@ vfs_init (struct fuse_conn_info *conn)
|
||||
|
||||
mount_list_mutex = g_mutex_new ();
|
||||
global_fh_table = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
- g_free, (GDestroyNotify) file_handle_free);
|
||||
+ NULL, (GDestroyNotify) file_handle_free);
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
@@ -2059,6 +2107,8 @@ vfs_init (struct fuse_conn_info *conn)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ dbus_connection_set_exit_on_disconnect (dbus_conn, FALSE);
|
||||
+
|
||||
_g_dbus_connection_integrate_with_main (dbus_conn);
|
||||
|
||||
dbus_bus_add_match (dbus_conn,
|
16
gvfs.changes
16
gvfs.changes
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 6 20:12:07 CEST 2008 - maw@suse.de
|
||||
|
||||
- Update to versino 0.99.1:
|
||||
+ Fix directory copy/delete problems
|
||||
+ Fuse daemon robustness fixes
|
||||
+ Allow mounting non-standard ISO images
|
||||
+ Better username/domain tests on mount spec
|
||||
+ Require gphoto >= 2.4.0
|
||||
+ Fix strdup()/g_free() confusion
|
||||
+ Use consistent translatable strings for mount and volume
|
||||
+ Plug some memory leaks
|
||||
+ Many smaller bug fixes
|
||||
+ Updated translations
|
||||
- Remove upstreamed patch: gvfs-bnc368628-fuse-robustness.patch.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 24 03:17:59 CEST 2008 - hpj@suse.de
|
||||
|
||||
|
22
gvfs.spec
22
gvfs.spec
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package gvfs (Version 0.2.3)
|
||||
# spec file for package gvfs (Version 0.99.1)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
@ -24,15 +24,13 @@ BuildRequires: libgphoto2
|
||||
BuildRequires: extra-rpm-macros
|
||||
%endif
|
||||
Summary: VFS functionality for GLib
|
||||
Version: 0.2.3
|
||||
Release: 24
|
||||
Version: 0.99.1
|
||||
Release: 1
|
||||
License: LGPL v2.0 or later
|
||||
Group: Development/Libraries/C and C++
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
# PATCH-FIX-UPSTREAM gvfs-no-shebang.patch bgo523420 maw@suse.de -- Is this even worth upstreaming?
|
||||
Patch0: gvfs-no-shebang.patch
|
||||
# PATCH-FIX-UPSTREAM gvfs-bnc368628-fuse-robustness.patch bnc368628 bgo531516 hpj@novell.com
|
||||
Patch1: gvfs-bnc368628-fuse-robustness.patch
|
||||
# PATCH-FIX-UPSTREAM gvfs-bnc382172-home-trash-monitoring.patch hpj@novell.com
|
||||
Patch2: gvfs-bnc382172-home-trash-monitoring.patch
|
||||
Url: http://www.gnome.org
|
||||
@ -121,7 +119,6 @@ Authors:
|
||||
%prep
|
||||
%setup -n %{name}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
@ -177,6 +174,19 @@ chmod -x $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/*
|
||||
%files lang -f %{name}.lang
|
||||
|
||||
%changelog
|
||||
* Fri Jun 06 2008 maw@suse.de
|
||||
- Update to versino 0.99.1:
|
||||
+ Fix directory copy/delete problems
|
||||
+ Fuse daemon robustness fixes
|
||||
+ Allow mounting non-standard ISO images
|
||||
+ Better username/domain tests on mount spec
|
||||
+ Require gphoto >= 2.4.0
|
||||
+ Fix strdup()/g_free() confusion
|
||||
+ Use consistent translatable strings for mount and volume
|
||||
+ Plug some memory leaks
|
||||
+ Many smaller bug fixes
|
||||
+ Updated translations
|
||||
- Remove upstreamed patch: gvfs-bnc368628-fuse-robustness.patch.
|
||||
* Sat May 24 2008 hpj@suse.de
|
||||
- Merge gvfs-bgo531516-fuse-cleanup-when-killed.patch into
|
||||
gvfs-bnc368628-fuse-robustness.patch so as to avoid overlapping
|
||||
|
Loading…
Reference in New Issue
Block a user