- Ensure archive mounts are read-only and turn on thumbnailing on them

- Update fuse threading patch
This commit is contained in:
David Zeuthen 2008-04-22 17:16:34 +00:00
parent 9895b17078
commit a3932394ed
3 changed files with 117 additions and 3 deletions

View File

@ -0,0 +1,95 @@
Index: daemon/gvfsbackendarchive.c
===================================================================
--- daemon/gvfsbackendarchive.c (revision 1746)
+++ daemon/gvfsbackendarchive.c (working copy)
@@ -322,6 +322,13 @@
g_file_info_set_content_type (info, "inode/directory");
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, "inode/directory");
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, TRUE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE);
+
icon = g_themed_icon_new ("folder");
g_file_info_set_icon (info, icon);
g_object_unref (icon);
@@ -340,19 +347,19 @@
g_file_info_set_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_ACCESS,
archive_entry_atime (entry));
- g_file_info_set_attribute_uint64 (info,
+ g_file_info_set_attribute_uint32 (info,
G_FILE_ATTRIBUTE_TIME_ACCESS_USEC,
archive_entry_atime_nsec (entry) / 1000);
g_file_info_set_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_CHANGED,
archive_entry_ctime (entry));
- g_file_info_set_attribute_uint64 (info,
+ g_file_info_set_attribute_uint32 (info,
G_FILE_ATTRIBUTE_TIME_CHANGED_USEC,
archive_entry_ctime_nsec (entry) / 1000);
g_file_info_set_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_MODIFIED,
archive_entry_mtime (entry));
- g_file_info_set_attribute_uint64 (info,
+ g_file_info_set_attribute_uint32 (info,
G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC,
archive_entry_mtime_nsec (entry) / 1000);
@@ -387,6 +394,13 @@
g_file_info_set_size (info,
archive_entry_size (entry));
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, type == G_FILE_TYPE_DIRECTORY);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE);
+
/* FIXME: add info for these
dev_t archive_entry_dev(struct archive_entry *);
dev_t archive_entry_devmajor(struct archive_entry *);
@@ -508,11 +522,11 @@
return;
}
- archive->file = g_file_new_for_uri (filename);
+ archive->file = g_file_new_for_commandline_arg (filename);
g_free (filename);
}
else
- archive->file = g_file_new_for_uri (file);
+ archive->file = g_file_new_for_commandline_arg (file);
DEBUG ("Trying to mount %s\n", g_file_get_uri (archive->file));
@@ -714,6 +728,19 @@
g_vfs_job_succeeded (G_VFS_JOB (job));
}
+static gboolean
+try_query_fs_info (GVfsBackend *backend,
+ GVfsJobQueryFsInfo *job,
+ const char *filename,
+ GFileInfo *info,
+ GFileAttributeMatcher *attribute_matcher)
+{
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
+ g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL);
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+ return TRUE;
+}
+
static void
g_vfs_backend_archive_class_init (GVfsBackendArchiveClass *klass)
{
@@ -729,4 +756,5 @@
backend_class->read = do_read;
backend_class->enumerate = do_enumerate;
backend_class->query_info = do_query_info;
+ backend_class->try_query_fs_info = try_query_fs_info;
}

View File

@ -1,6 +1,6 @@
Index: client/gvfsfusedaemon.c
===================================================================
--- client/gvfsfusedaemon.c (revision 1744)
--- client/gvfsfusedaemon.c (revision 1746)
+++ client/gvfsfusedaemon.c (working copy)
@@ -71,6 +71,8 @@
} FileOp;
@ -82,4 +82,15 @@ Index: client/gvfsfusedaemon.c
SET_FILE_HANDLE (fi, fh);
g_assert (fh->stream == NULL);
@@ -1047,7 +1063,10 @@
debug_print ("vfs_release: %s\n", path);
if (fh)
- free_file_handle_for_path (path);
+ {
+ if (!file_handle_unref (fh))
+ free_file_handle_for_path (path);
+ }
return 0;
}

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 0.2.3
Release: 8%{?dist}
Release: 9%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -47,6 +47,9 @@ Patch8: gvfs-fuse-threading.patch
#
Patch9: gvfs-dbus-exit.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=528950
Patch10: gvfs-archive-minor-fixes-2.patch
%description
The gvfs package provides backend implementations for the gio
framework in GLib. It includes ftp, sftp, cifs.
@ -83,6 +86,7 @@ to access the gvfs filesystems.
%patch7 -p1 -b .unmount-scheme
%patch8 -p0 -b .fuse-threading
%patch9 -p1 -b .dbus-exit
%patch10 -p0 -b .archive-fixes
%build
@ -197,6 +201,10 @@ update-desktop-database &> /dev/null ||:
%changelog
* Sun Apr 19 2008 David Zeuthen <davidz@redhat.com> - 0.2.3-9
- Ensure archive mounts are read-only and turn on thumbnailing on them
- Update fuse threading patch
* Fri Apr 18 2008 Matthias Clasen <mclasen@redhat.com> - 0.2.3-8
- Fix thread-safety issues in gvfs-fuse-daemon
- Prevent dbus from shutting us down unexpectedly