SHA256
1
0
forked from pool/gvfs

Accepting request 1183898 from GNOME:Next

- Update to version 1.54.2:
  + ftp:
    - Change cwd to root before renaming to prevent failures
    - Use timegm instead of mktime to not shift dates by timezone
    - Preserve mtime when copying to local
  + udisks2: Ignore autofs mounts to prevent duplicated entries
  + build:
    - Add deprecated_apis option to control installation of headers
    - Disable burn backend by default
  + dav: Disable query_info_on_read method to fix mtime
    preservation
  + network: Disable usage of smbbrowse backend by default
  + smbbrowse: Don't enforce NT1 to fix mounting in certain cases
  + onedrive: Fix various memory leaks
  + Updated translations.
- Pass burn=true to meson, we still want to build the burn backend,
  at least for now.

OBS-URL: https://build.opensuse.org/request/show/1183898
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gvfs?expand=0&rev=400
This commit is contained in:
Dominique Leuenberger 2024-07-01 08:58:58 +00:00 committed by Git OBS Bridge
commit a8237680fd
10 changed files with 5789 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

19
_service Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<services>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://gitlab.gnome.org/GNOME/gvfs.git</param>
<param name="revision">1.54.2</param>
<param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param>
<param name="versionrewrite-pattern">(.*)\+0</param>
<param name="versionrewrite-replacement">\1</param>
<param name="changesgenerate">disable</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">zst</param>
</service>
<service name="set_version" mode="manual" />
</services>

4
baselibs.conf Normal file
View File

@ -0,0 +1,4 @@
gvfs
requires "glib2-tools-<targettype>"
post "%glib2_gio_module_post"
postun "%glib2_gio_module_postun"

3
gvfs-1.54.2.obscpio Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4ca6feebcaef33c02cae2c2a6a3e66fab1763b79aa3d18f1bbbf20aa35b19990
size 12908557

887
gvfs-nds.patch Normal file
View File

@ -0,0 +1,887 @@
diff --git a/daemon/gvfsbackendnds.c b/daemon/gvfsbackendnds.c
new file mode 100644
index 0000000..960d457
--- /dev/null
+++ b/daemon/gvfsbackendnds.c
@@ -0,0 +1,747 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode; nil; -*- */
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <glib/gstdio.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <dlfcn.h>
+#include <sys/utsname.h>
+
+#include "gvfsbackendnds.h"
+#include "gvfsjobmountmountable.h"
+#include "gvfsjobopenforread.h"
+#include "gvfsjobread.h"
+#include "gvfsjobseekread.h"
+#include "gvfsjobqueryinfo.h"
+#include "gvfsjobenumerate.h"
+#include "gvfsdaemonprotocol.h"
+#include "gmounttracker.h"
+#include "gvfsmonitor.h"
+
+
+
+typedef struct {
+ char *name;
+ char *name_normalized;
+ char *name_utf8;
+} BrowseEntry;
+
+struct _GVfsBackendNds
+{
+ GVfsBackend parent_instance;
+
+ char *server;
+ char *mounted_server;
+
+ GMutex entries_lock;
+ GList *entries;
+ int entry_errno;
+};
+
+static GMountTracker *mount_tracker = NULL;
+
+G_DEFINE_TYPE (GVfsBackendNds, g_vfs_backend_nds, G_VFS_TYPE_BACKEND)
+
+static gboolean
+is_root (const char *filename)
+{
+ const char *p;
+
+ p = filename;
+ while (*p == '/')
+ p++;
+
+ return *p == 0;
+}
+
+static char *
+normalize_nds_name_helper (const char *name, gssize len, gboolean valid_utf8)
+{
+ if (valid_utf8)
+ return g_utf8_casefold (name, len);
+ else
+ return g_ascii_strdown (name, len);
+}
+
+static char *
+normalize_nds_name (const char *name, gssize len)
+{
+ gboolean valid_utf8;
+
+ valid_utf8 = g_utf8_validate (name, len, NULL);
+ return normalize_nds_name_helper (name, len, valid_utf8);
+}
+
+static char *
+nds_name_to_utf8 (const char *name, gboolean *valid_utf8_out)
+{
+ GString *string;
+ const gchar *remainder, *invalid;
+ gint remaining_bytes, valid_bytes;
+ gboolean valid_utf8;
+
+ remainder = name;
+ remaining_bytes = strlen (name);
+ valid_utf8 = TRUE;
+
+ string = g_string_sized_new (remaining_bytes);
+ while (remaining_bytes != 0)
+ {
+ if (g_utf8_validate (remainder, remaining_bytes, &invalid))
+ break;
+ valid_utf8 = FALSE;
+
+ valid_bytes = invalid - remainder;
+
+ g_string_append_len (string, remainder, valid_bytes);
+ /* append U+FFFD REPLACEMENT CHARACTER */
+ g_string_append (string, "\357\277\275");
+
+ remaining_bytes -= valid_bytes + 1;
+ remainder = invalid + 1;
+ }
+
+ g_string_append (string, remainder);
+
+ if (valid_utf8_out)
+ *valid_utf8_out = valid_utf8;
+
+ return g_string_free (string, FALSE);
+}
+
+static void
+browse_entry_free (BrowseEntry *entry)
+{
+ if(entry->name != NULL)
+ g_free (entry->name);
+ if(entry != NULL)
+ g_free (entry);
+}
+
+
+static void
+g_vfs_backend_nds_finalize (GObject *object)
+{
+ GVfsBackendNds *backend;
+
+ backend = G_VFS_BACKEND_NDS (object);
+
+ if(backend->mounted_server != NULL)
+ g_free (backend->mounted_server);
+ if(backend->server != NULL)
+ g_free (backend->server);
+
+ g_mutex_clear (&backend->entries_lock);
+
+ g_list_foreach (backend->entries, (GFunc)browse_entry_free, NULL);
+ if(backend->entries != NULL)
+ g_list_free (backend->entries);
+
+ if (G_OBJECT_CLASS (g_vfs_backend_nds_parent_class)->finalize)
+ (*G_OBJECT_CLASS (g_vfs_backend_nds_parent_class)->finalize) (object);
+}
+
+static void
+g_vfs_backend_nds_init (GVfsBackendNds *backend)
+{
+ g_mutex_init(&backend->entries_lock);
+
+ if (mount_tracker == NULL)
+ mount_tracker = g_mount_tracker_new (NULL, FALSE);
+}
+
+
+static void
+update_cache (GVfsBackendNds *backend,const char *filename)
+{
+ GList *entries;
+ int entry_errno;
+ char *objectname=NULL;
+ char *treename=NULL;
+ GList *objectlist=NULL;
+ GList *object=NULL;
+ FILE *fptr=NULL;
+ void *handle=NULL; //handle for dlopen
+ int res;
+ char *ptr=NULL;
+ char *server_name=NULL;
+ struct utsname utsbuf;
+/* Function Pointer to /opt/novell/lib/libinterface.so */
+ int (*retrieve_children)(char *,char ***,int *);
+ char **object_list_array=NULL;
+ int num_objects=0;
+ int i;
+
+ entries = NULL;
+ entry_errno = 0;
+
+ if(backend->server != NULL)
+ {
+ server_name = g_strdup(backend->server);
+ if((ptr = strchr(server_name,'%')) != NULL)
+ *ptr = '\0';
+
+ }
+
+ if(backend->server == NULL) //retrieve Tree names
+ {
+ treename = (char *)malloc(sizeof(char) * 80);
+ system("/opt/novell/ncl/bin/retrieve_trees.pl");
+ fptr = fopen("/tmp/ndstrees.txt","r");
+ if(fptr == NULL)
+ {
+ entry_errno = -1;
+ goto out;
+ }
+ while (fgets(treename,80,fptr) != NULL)
+ {
+ objectlist = g_list_append(objectlist,g_strdup(treename));
+ memset(treename,'\0',80);
+ }
+ fclose(fptr);
+ free(treename);
+ }
+
+ else //retrieve object names
+ {
+ uname(&utsbuf);
+ if(!strcmp(utsbuf.machine,"x86_64"))
+ handle = dlopen("/usr/lib64/libinterface.so",RTLD_NOW | RTLD_DEEPBIND);
+ else
+ handle = dlopen("/usr/lib/libinterface.so",RTLD_NOW | RTLD_DEEPBIND);
+
+ if(handle == NULL)
+ {
+ return;
+ }
+ *(void **)(&retrieve_children) = dlsym(handle,"retrieve_children");
+
+ if(retrieve_children != NULL)
+ {
+ res = (*retrieve_children)(server_name,&object_list_array,&num_objects);
+ if(res == 0)
+ {
+ for(i=0;i < num_objects; i++)
+ {
+ objectlist = g_list_append(objectlist,g_strdup(*(object_list_array+ i)));
+ }
+ }
+ }
+ else
+ {
+ return;
+ }
+ dlclose(handle);
+ }
+
+
+ gboolean valid_utf8;
+ BrowseEntry *entry;
+
+ for(object = objectlist;object != NULL;object = object->next)
+ {
+ entry = g_new (BrowseEntry, 1);
+ objectname = object->data;
+ entry->name = g_strdup (objectname);
+ entry->name_utf8 = nds_name_to_utf8 (objectname, &valid_utf8);
+ entry->name_normalized = normalize_nds_name_helper (objectname, -1, valid_utf8);
+
+ entries = g_list_append (entries, entry);
+ }
+
+ //if(objectlist != NULL)
+ //g_list_free(objectlist);
+
+out:
+
+ if(entry_errno == 0)
+ {
+ g_mutex_lock (&backend->entries_lock);
+ backend->entries = entries;
+ g_mutex_unlock (&backend->entries_lock);
+ }
+ backend->entry_errno = entry_errno;
+
+}
+
+static BrowseEntry *
+find_entry_unlocked (GVfsBackendNds *backend,
+ const char *filename)
+{
+ BrowseEntry *entry, *found;
+ GList *l;
+ char *end;
+ int len;
+
+ while (*filename == '/')
+ filename++;
+
+ end = strchr (filename, '/');
+ if (end)
+ {
+ len = end - filename;
+
+ while (*end == '/')
+ end++;
+
+ if (*end != 0)
+ return NULL;
+ }
+ else
+ len = strlen (filename);
+
+ /* First look for an exact filename match */
+ found = NULL;
+ for (l = backend->entries; l != NULL; l = l->next)
+ {
+ entry = l->data;
+
+ if (strncmp (filename, entry->name, len) == 0 &&
+ strlen (entry->name) == len)
+ {
+ found = entry;
+ break;
+ }
+ }
+
+ if (found == NULL)
+ {
+ char *normalized;
+ /* That failed, try normalizing the filename */
+ normalized = normalize_nds_name (filename, len);
+
+ for (l = backend->entries; l != NULL; l = l->next)
+ {
+ entry = l->data;
+
+ if (strcmp (normalized, entry->name_normalized) == 0)
+ {
+ found = entry;
+ break;
+ }
+ }
+ if(normalized != NULL)
+ g_free (normalized);
+ }
+
+ return found;
+}
+
+static GMountSpec *
+get_mount_spec_for_share (const char *server, const char *share)
+{
+ GMountSpec *mount_spec;
+ char *normalized;
+
+ mount_spec = g_mount_spec_new ("nds");
+ g_mount_spec_set (mount_spec, "host", server);
+ g_mount_spec_set (mount_spec, "share", share);
+
+ return mount_spec;
+}
+
+
+
+static void
+do_mount (GVfsBackend *backend,
+ GVfsJobMount *job,
+ GMountSpec *mount_spec,
+ GMountSource *mount_source,
+ gboolean is_automount)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+ char *display_name;
+ char *icon;
+ GMountSpec *browse_mount_spec;
+
+
+ icon = NULL;
+ if (op_backend->server == NULL)
+ {
+ display_name = g_strdup (_("NVVFS Top Directory"));
+ browse_mount_spec = g_mount_spec_new ("nds");
+ icon = "network-workgroup";
+ }
+ else
+ {
+ display_name = g_strdup_printf (_("NVVFS Objects"));
+ browse_mount_spec = g_mount_spec_new ("nds");
+ //g_mount_spec_set (browse_mount_spec, "host", op_backend->mounted_server);
+ g_mount_spec_set (browse_mount_spec, "host", op_backend->server);
+ icon = "network-server";
+ }
+
+ g_vfs_backend_set_display_name (backend, display_name);
+ g_free (display_name);
+ if (icon)
+ g_vfs_backend_set_icon_name (backend, icon);
+ g_vfs_backend_set_user_visible (backend, FALSE);
+ g_vfs_backend_set_mount_spec (backend, browse_mount_spec);
+ g_mount_spec_unref (browse_mount_spec);
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+}
+
+static gboolean
+try_mount (GVfsBackend *backend,
+ GVfsJobMount *job,
+ GMountSpec *mount_spec,
+ GMountSource *mount_source,
+ gboolean is_automount)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+ const char *server;
+
+ server = g_mount_spec_get (mount_spec, "host");
+ if (server)
+ {
+ op_backend->server = g_strdup (server);
+ op_backend->mounted_server = g_strdup (server);
+ }
+ else
+ {
+ op_backend->server = NULL;
+ op_backend->mounted_server = NULL;
+ }
+
+ return FALSE;
+}
+
+static void
+run_mount_mountable (GVfsBackendNds *backend,
+ GVfsJobMountMountable *job,
+ const char *filename,
+ GMountSource *mount_source)
+{
+ GMountSpec *mount_spec;
+
+ g_mutex_lock (&backend->entries_lock);
+
+ backend->server = g_strdup(filename);
+
+ mount_spec = get_mount_spec_for_share (backend->server, filename);
+ g_vfs_job_mount_mountable_set_target (job, mount_spec, "/", TRUE);
+ g_mount_spec_unref (mount_spec);
+ g_mutex_unlock (&backend->entries_lock);
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+}
+
+
+static gboolean
+do_mount_mountable (GVfsBackend *backend,
+ GVfsJobMountMountable *job,
+ const char *filename,
+ GMountSource *mount_source)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+
+ update_cache (op_backend,filename);
+
+ run_mount_mountable (op_backend,
+ job,
+ filename,
+ mount_source);
+ return TRUE;
+}
+
+static gboolean
+try_mount_mountable (GVfsBackend *backend,
+ GVfsJobMountMountable *job,
+ const char *filename,
+ GMountSource *mount_source)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+
+
+ if (is_root (filename))
+ {
+ g_vfs_job_failed (G_VFS_JOB (job),
+ G_IO_ERROR, G_IO_ERROR_NOT_MOUNTABLE_FILE,
+ _("The file is not a mountable"));
+ return TRUE;
+ }
+
+update_cache (op_backend,filename);
+
+ run_mount_mountable (op_backend,
+ job,
+ filename,
+ mount_source);
+ return TRUE;
+}
+
+
+
+#define SUB_DELIM_CHARS "!$&'()*+,;="
+
+static gboolean
+is_valid (char c, const char *reserved_chars_allowed)
+{
+ if (g_ascii_isalnum (c) ||
+ c == '-' ||
+ c == '.' ||
+ c == '_' ||
+ c == '~')
+ return TRUE;
+
+ if (reserved_chars_allowed &&
+ strchr (reserved_chars_allowed, c) != NULL)
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+g_string_append_encoded (GString *string,
+ const char *encoded,
+ const char *encoded_end,
+ const char *reserved_chars_allowed)
+{
+ char c;
+ static const gchar hex[16] = "0123456789ABCDEF";
+
+ if (encoded_end == NULL)
+ encoded_end = encoded + strlen (encoded);
+
+ while (encoded < encoded_end)
+ {
+ c = *encoded++;
+
+ if (is_valid (c, reserved_chars_allowed))
+ g_string_append_c (string, c);
+ else
+ {
+ g_string_append_c (string, '%');
+ g_string_append_c (string, hex[((guchar)c) >> 4]);
+ g_string_append_c (string, hex[((guchar)c) & 0xf]);
+ }
+ }
+}
+
+static void
+get_file_info_from_entry (GVfsBackendNds *backend, BrowseEntry *entry, GFileInfo *info)
+{
+ GString *uri;
+ GIcon *icon;
+
+ g_file_info_set_name (info, entry->name);
+ g_file_info_set_display_name (info, entry->name_utf8);
+ g_file_info_set_edit_name (info, entry->name_utf8);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL, TRUE);
+
+ if(backend->server == NULL) //NDS-Tree icon
+ icon = g_themed_icon_new ("ncl-ndstree");
+ else
+ icon = g_themed_icon_new ("ncl-nwcontext");
+
+ if (icon)
+ {
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+ }
+
+ g_file_info_set_file_type (info, G_FILE_TYPE_SHORTCUT);
+
+ uri = g_string_new ("nds://");
+ g_string_append_encoded (uri, entry->name, NULL, NULL);
+ g_string_append_c (uri, '/');
+
+ g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, uri->str);
+
+ g_string_free (uri, TRUE);
+
+}
+
+static void
+run_query_info (GVfsBackendNds *backend,
+ GVfsJobQueryInfo *job,
+ const char *filename,
+ GFileInfo *info,
+ GFileAttributeMatcher *matcher)
+{
+ BrowseEntry *entry;
+
+ g_mutex_lock (&backend->entries_lock);
+
+ entry = find_entry_unlocked (backend, filename);
+
+ if (entry)
+ get_file_info_from_entry (backend, entry, info);
+
+ g_mutex_unlock (&backend->entries_lock);
+
+ if (entry)
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+ else
+ g_vfs_job_failed (G_VFS_JOB (job),
+ G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ _("File doesn't exist"));
+}
+
+static void
+do_query_info (GVfsBackend *backend,
+ GVfsJobQueryInfo *job,
+ const char *filename,
+ GFileQueryInfoFlags flags,
+ GFileInfo *info,
+ GFileAttributeMatcher *matcher)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+
+ run_query_info (op_backend, job, filename, info, matcher);
+}
+
+static gboolean
+try_query_info (GVfsBackend *backend,
+ GVfsJobQueryInfo *job,
+ const char *filename,
+ GFileQueryInfoFlags flags,
+ GFileInfo *info,
+ GFileAttributeMatcher *matcher)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+ const char *icon_name = NULL;
+ GIcon *icon;
+
+ if (filename && is_root (filename))
+ {
+ g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
+ g_file_info_set_name (info, "/");
+ g_file_info_set_display_name (info, g_vfs_backend_get_display_name (backend));
+ /* FIXME: This API does not seem to be in gvfs-1.2.0. Find a suitable replacement? */
+ /* icon_name = g_vfs_backend_get_icon_name (backend); */
+ if (icon_name)
+ {
+ icon = g_themed_icon_new (icon_name);
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+ }
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ return TRUE;
+ }
+
+ return FALSE;
+
+ run_query_info (op_backend, job, filename, info, matcher);
+ return TRUE;
+}
+
+static void
+run_enumerate (GVfsBackendNds *backend,
+ GVfsJobEnumerate *job,
+ const char *filename,
+ GFileAttributeMatcher *matcher)
+{
+ GList *files, *l;
+ GFileInfo *info;
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ files = NULL;
+ g_mutex_lock (&backend->entries_lock);
+ for (l = backend->entries; l != NULL; l = l->next)
+ {
+ BrowseEntry *entry = l->data;
+
+ info = g_file_info_new ();
+ get_file_info_from_entry (backend, entry, info);
+
+ files = g_list_prepend (files, info);
+ }
+ g_mutex_unlock (&backend->entries_lock);
+
+ files = g_list_reverse (files);
+
+ g_vfs_job_enumerate_add_infos (job, files);
+ g_list_foreach (files, (GFunc)g_object_unref, NULL);
+ g_list_free (files);
+
+ g_vfs_job_enumerate_done (job);
+}
+
+static void
+do_enumerate (GVfsBackend *backend,
+ GVfsJobEnumerate *job,
+ const char *filename,
+ GFileAttributeMatcher *matcher,
+ GFileQueryInfoFlags flags)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+
+ update_cache (op_backend,filename);
+
+ run_enumerate (op_backend, job, filename, matcher);
+}
+
+static gboolean
+try_enumerate (GVfsBackend *backend,
+ GVfsJobEnumerate *job,
+ const char *filename,
+ GFileAttributeMatcher *matcher,
+ GFileQueryInfoFlags flags)
+{
+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend);
+
+ update_cache (op_backend,filename);
+
+ run_enumerate (op_backend, job, filename, matcher);
+ return TRUE;
+}
+
+
+static void
+g_vfs_backend_nds_class_init (GVfsBackendNdsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
+
+ gobject_class->finalize = g_vfs_backend_nds_finalize;
+
+ backend_class->mount = do_mount;
+ backend_class->try_mount = try_mount;
+ backend_class->query_info = do_query_info;
+ backend_class->try_query_info = try_query_info;
+ backend_class->enumerate = do_enumerate;
+ backend_class->try_enumerate = try_enumerate;
+ backend_class->try_mount_mountable = try_mount_mountable;
+ backend_class->mount_mountable = do_mount_mountable;
+}
+
+void
+g_vfs_nds_daemon_init (void)
+{
+ g_set_application_name (_("Displaying Embedded Objects"));
+}
diff --git a/daemon/gvfsbackendnds.h b/daemon/gvfsbackendnds.h
new file mode 100644
index 0000000..0b48ad6
--- /dev/null
+++ b/daemon/gvfsbackendnds.h
@@ -0,0 +1,53 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_VFS_BACKEND_NDS_H__
+#define __G_VFS_BACKEND_NDS_H__
+
+#include <gvfsbackend.h>
+#include <gmountspec.h>
+
+G_BEGIN_DECLS
+
+#define G_VFS_TYPE_BACKEND_NDS (g_vfs_backend_nds_get_type ())
+#define G_VFS_BACKEND_NDS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_BACKEND_NDS, GVfsBackendNds))
+#define G_VFS_BACKEND_NDS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_BACKEND_NDS, GVfsBackendNdsClass))
+#define G_VFS_IS_BACKEND_NDS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_BACKEND_NDS))
+#define G_VFS_IS_BACKEND_NDS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_BACKEND_NDS))
+#define G_VFS_BACKEND_NDS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_BACKEND_NDS, GVfsBackendNdsClass))
+
+typedef struct _GVfsBackendNds GVfsBackendNds;
+typedef struct _GVfsBackendNdsClass GVfsBackendNdsClass;
+
+struct _GVfsBackendNdsClass
+{
+ GVfsBackendClass parent_class;
+};
+
+GType g_vfs_backend_nds_get_type (void) G_GNUC_CONST;
+
+#define BACKEND_SETUP_FUNC g_vfs_nds_daemon_init
+void g_vfs_nds_daemon_init (void);
+
+G_END_DECLS
+
+#endif /* __G_VFS_BACKEND_NDS_H__ */
diff --git a/daemon/meson.build b/daemon/meson.build
index dffeef3..dabdcb2 100644
--- a/daemon/meson.build
+++ b/daemon/meson.build
@@ -530,6 +530,22 @@ if enable_afp
mounts += ['afp-browse']
endif
+if enable_nds
+ sources = daemon_main_sources + files('gvfsbackendnds.c')
+
+ deps = [libdl_dep]
+
+ cflags = [
+ '-DBACKEND_HEADER=gvfsbackendnds.h',
+ '-DDEFAULT_BACKEND_TYPE=nds',
+ '-DBACKEND_TYPES="nds", G_VFS_TYPE_BACKEND_NDS,',
+ '-DMAX_JOB_THREADS=1',
+ ]
+
+ programs += {'gvfsd-nds': {'sources': sources, 'dependencies': deps, 'c_args': cflags}}
+ mounts += ['nds']
+endif
+
if enable_nfs
cflags = [
'-DBACKEND_HEADER=gvfsbackendnfs.h',
diff --git a/daemon/nds.mount.in b/daemon/nds.mount.in
new file mode 100644
index 0000000..1068344
--- /dev/null
+++ b/daemon/nds.mount.in
@@ -0,0 +1,5 @@
+[Mount]
+Type=nds
+Exec=@libexecdir@/gvfsd-nds
+AutoMount=false
+Scheme=nds
diff --git a/meson.build b/meson.build
index d844335..34d754f 100644
--- a/meson.build
+++ b/meson.build
@@ -448,6 +448,12 @@ config_h.set('HAVE_LIBMTP', enable_mtp)
# *** AFP backend ***
enable_afp = get_option('afp')
+# *** NDS backend ***
+enable_nds = get_option('nds')
+if enable_nds
+ libdl_dep = cc.find_library('dl')
+endif
+
# *** NFS backend ***
enable_nfs = get_option('nfs')
if enable_nfs
@@ -507,6 +513,7 @@ summary({
'gphoto2': enable_gphoto2,
'http': enable_http,
'mtp': enable_mtp,
+ 'nds': enable_nds,
'nfs': enable_nfs,
'sftp': enable_sftp,
'smb': enable_samba,
diff --git a/meson_options.txt b/meson_options.txt
index 32f10d4..dced004 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,6 +12,7 @@ option('google', type: 'boolean', value: true, description: 'build with google b
option('gphoto2', type: 'boolean', value: true, description: 'build with gphoto2 backend and volume monitor')
option('http', type: 'boolean', value: true, description: 'build with http/dav backends')
option('mtp', type: 'boolean', value: true, description: 'build with mtp backend and volume monitor')
+option('nds', type: 'boolean', value: true, description: 'build with nds backend')
option('nfs', type: 'boolean', value: true, description: 'build with nfs backend')
option('sftp', type: 'boolean', value: true, description: 'build with sftp backend')
option('smb', type: 'boolean', value: true, description: 'build with smb backends')

720
gvfs-nvvfs.patch Normal file
View File

@ -0,0 +1,720 @@
Index: gvfs-1.52.0/daemon/gvfsbackendnvvfs.c
===================================================================
--- /dev/null
+++ gvfs-1.52.0/daemon/gvfsbackendnvvfs.c
@@ -0,0 +1,591 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Alexander Larsson <alexl@redhat.com>
+ * Cosimo Cecchi <cosimoc@gnome.org>
+ */
+
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include <glib/gstdio.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gunixmounts.h>
+#include <glib.h>
+
+#include "gvfsbackendnvvfs.h"
+#include "gvfsmonitor.h"
+#include "gvfsjobopenforread.h"
+#include "gvfsjobread.h"
+#include "gvfsjobseekread.h"
+#include "gvfsjobopenforwrite.h"
+#include "gvfsjobwrite.h"
+#include "gvfsjobclosewrite.h"
+#include "gvfsjobseekwrite.h"
+#include "gvfsjobsetdisplayname.h"
+#include "gvfsjobmountmountable.h"
+#include "gvfsjobqueryinfo.h"
+#include "gvfsjobdelete.h"
+#include "gvfsjobqueryfsinfo.h"
+#include "gvfsjobqueryattributes.h"
+#include "gvfsjobenumerate.h"
+#include "gvfsjobcreatemonitor.h"
+#include "gvfsdaemonprotocol.h"
+
+
+
+typedef struct {
+ char *filename;
+ char *display_name;
+ GIcon *icon;
+ GFile *root;
+ int prio;
+ gboolean can_mount;
+ gboolean can_unmount;
+ gboolean can_eject;
+} NovellNautilus;
+
+static NovellNautilus root = { "/" };
+
+struct _GVfsBackendNvvfs
+{
+ GVfsBackend parent_instance;
+
+ GVolumeMonitor *volume_monitor;
+
+ GVfsMonitor *root_monitor;
+
+ GList *files;
+
+ guint recompute_idle_tag;
+
+ GMountSpec *mount_spec;
+};
+
+G_DEFINE_TYPE (GVfsBackendNvvfs, g_vfs_backend_nvvfs, G_VFS_TYPE_BACKEND)
+
+static void
+nvvfs_file_free (NovellNautilus *file)
+{
+ g_free (file->filename);
+ g_free (file->display_name);
+ if (file->icon)
+ g_object_unref (file->icon);
+ if (file->root)
+ g_object_unref (file->root);
+
+ g_slice_free (NovellNautilus, file);
+}
+
+/* Assumes filename equal */
+static gboolean
+nvvfs_file_equal (NovellNautilus *a,
+ NovellNautilus *b)
+{
+ if (strcmp (a->display_name, b->display_name) != 0)
+ return FALSE;
+
+ if (!g_icon_equal (a->icon, b->icon))
+ return FALSE;
+
+ if ((a->root != NULL && b->root != NULL &&
+ !g_file_equal (a->root, b->root)) ||
+ (a->root != NULL && b->root == NULL) ||
+ (a->root == NULL && b->root != NULL))
+ return FALSE;
+
+ if (a->prio != b->prio)
+ return FALSE;
+
+ if (a->can_mount != b->can_mount ||
+ a->can_unmount != b->can_unmount ||
+ a->can_eject != b->can_eject)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void object_changed (GVolumeMonitor *monitor,
+ gpointer object,
+ GVfsBackendNvvfs *backend);
+
+static void
+g_vfs_backend_nvvfs_finalize (GObject *object)
+{
+ GVfsBackendNvvfs *backend;
+
+ backend = G_VFS_BACKEND_NVVFS (object);
+
+ if (backend->volume_monitor)
+ {
+ g_signal_handlers_disconnect_by_func(backend->volume_monitor, object_changed, backend);
+ g_object_unref (backend->volume_monitor);
+ }
+
+ g_mount_spec_unref (backend->mount_spec);
+
+ if (backend->recompute_idle_tag)
+ {
+ g_source_remove (backend->recompute_idle_tag);
+ backend->recompute_idle_tag = 0;
+ }
+
+ g_object_unref (backend->root_monitor);
+
+ if (G_OBJECT_CLASS (g_vfs_backend_nvvfs_parent_class)->finalize)
+ (*G_OBJECT_CLASS (g_vfs_backend_nvvfs_parent_class)->finalize) (object);
+}
+
+static void
+g_vfs_backend_nvvfs_init (GVfsBackendNvvfs *nvvfs_backend)
+{
+ GVfsBackend *backend = G_VFS_BACKEND (nvvfs_backend);
+ GMountSpec *mount_spec;
+
+ g_vfs_backend_set_display_name (backend, _("Nvvfs"));
+ g_vfs_backend_set_icon_name (backend, "gnome-fs-client");
+ g_vfs_backend_set_user_visible (backend, FALSE);
+
+ mount_spec = g_mount_spec_new ("nvvfs");
+ g_vfs_backend_set_mount_spec (backend, mount_spec);
+ nvvfs_backend->mount_spec = mount_spec;
+}
+
+static gboolean
+filename_is_used (GList *files, const char *filename)
+{
+ NovellNautilus *file;
+
+ while (files != NULL)
+ {
+ file = files->data;
+
+ if (file->filename == NULL)
+ return FALSE;
+
+ if (strcmp (file->filename, filename) == 0)
+ return TRUE;
+
+ files = files->next;
+ }
+ return FALSE;
+}
+
+static int
+sort_file_by_filename (NovellNautilus *a, NovellNautilus *b)
+{
+ return strcmp (a->filename, b->filename);
+}
+
+static void
+convert_slashes (char *str)
+{
+ char *s;
+
+ while ((s = strchr (str, '/')) != NULL)
+ *s = '\\';
+}
+
+static void
+update_from_files (GVfsBackendNvvfs *backend,
+ GList *files)
+{
+ GList *old_files;
+ GList *oldl, *newl;
+ char *filename;
+ NovellNautilus *old, *new;
+ int cmp;
+
+ old_files = backend->files;
+ backend->files = files;
+
+ /* Generate change events */
+ oldl = old_files;
+ newl = files;
+ while (oldl != NULL || newl != NULL)
+ {
+ if (oldl == NULL)
+ {
+ cmp = 1;
+ new = newl->data;
+ old = NULL;
+ }
+ else if (newl == NULL)
+ {
+ cmp = -1;
+ new = NULL;
+ old = oldl->data;
+ }
+ else
+ {
+ new = newl->data;
+ old = oldl->data;
+ cmp = strcmp (old->filename, new->filename);
+ }
+
+ if (cmp == 0)
+ {
+ if (!nvvfs_file_equal (old, new))
+ {
+ filename = g_strconcat ("/", new->filename, NULL);
+ g_vfs_monitor_emit_event (backend->root_monitor,
+ G_FILE_MONITOR_EVENT_CHANGED,
+ filename,
+ NULL);
+ g_free (filename);
+ }
+
+ oldl = oldl->next;
+ newl = newl->next;
+ }
+ else if (cmp < 0)
+ {
+ filename = g_strconcat ("/", old->filename, NULL);
+ g_vfs_monitor_emit_event (backend->root_monitor,
+ G_FILE_MONITOR_EVENT_DELETED,
+ filename,
+ NULL);
+ g_free (filename);
+ oldl = oldl->next;
+ }
+ else
+ {
+ filename = g_strconcat ("/", new->filename, NULL);
+ g_vfs_monitor_emit_event (backend->root_monitor,
+ G_FILE_MONITOR_EVENT_CREATED,
+ filename,
+ NULL);
+ g_free (filename);
+ newl = newl->next;
+ }
+ }
+
+ g_list_foreach (old_files, (GFunc)nvvfs_file_free, NULL);
+}
+
+static void
+recompute_files (GVfsBackendNvvfs *backend)
+{
+ GVolumeMonitor *volume_monitor;
+ GList *drives, *volumes, *mounts, *l, *ll;
+ GDrive *drive;
+ GVolume *volume;
+ GMount *mount;
+ NovellNautilus *file;
+ GList *files;
+ char *basename, *filename;
+ const char *extension;
+ int uniq;
+
+ gchar *nclmnt_path = "/var/opt/novell/nclmnt/";
+ gchar *user_name=NULL;
+ gchar *path_ncl=NULL;
+
+ volume_monitor = backend->volume_monitor;
+
+ files = NULL;
+
+
+// Im building the path for Novell Client mounts
+ user_name = g_get_user_name();
+ path_ncl = g_strconcat(nclmnt_path,user_name,NULL);
+
+ file = g_slice_new0 (NovellNautilus);
+ file->filename = g_strdup ("root.link");
+ file->display_name = g_strdup (_("Available Connections"));
+ file->icon = g_themed_icon_new("ncl-logo");
+ file->root = g_file_new_for_path (path_ncl);
+ file->prio = 0;
+
+ files = g_list_prepend (files, file);
+
+ file = g_slice_new0 (NovellNautilus);
+ file->filename = g_strdup ("root.lnk");
+ file->display_name = g_strdup (_("All Connections"));
+ file->icon = g_themed_icon_new("ncl-logo");
+ file->root = g_file_new_for_path (path_ncl);
+ file->prio = 0;
+
+ files = g_list_prepend (files, file);
+
+ files = g_list_reverse (files);
+
+ files = g_list_sort (files, (GCompareFunc)sort_file_by_filename);
+
+ update_from_files (backend, files);
+}
+
+static gboolean
+recompute_files_in_idle (GVfsBackendNvvfs *backend)
+{
+ backend->recompute_idle_tag = 0;
+
+ recompute_files (backend);
+
+ return FALSE;
+}
+
+static void
+object_changed (GVolumeMonitor *monitor,
+ gpointer object,
+ GVfsBackendNvvfs *backend)
+{
+ if (backend->recompute_idle_tag == 0)
+ backend->recompute_idle_tag =
+ g_idle_add ((GSourceFunc)recompute_files_in_idle,
+ backend);
+}
+
+static gboolean
+try_mount (GVfsBackend *backend,
+ GVfsJobMount *job,
+ GMountSpec *mount_spec,
+ GMountSource *mount_source,
+ gboolean is_automount)
+{
+ GVfsBackendNvvfs *nvvfs_backend = G_VFS_BACKEND_NVVFS (backend);
+ int i;
+ char *signals[] = {
+ "volume-added",
+ "volume-removed",
+ "volume-changed",
+ "mount-added",
+ "mount-removed",
+ "mount-changed",
+ "drive-connected",
+ "drive-disconnected",
+ "drive-changed",
+ NULL
+ };
+
+ nvvfs_backend->volume_monitor = g_volume_monitor_get ();
+
+ /* TODO: connect all signals to object_changed */
+
+ for (i = 0; signals[i] != NULL; i++)
+ g_signal_connect_data (nvvfs_backend->volume_monitor,
+ signals[i],
+ (GCallback)object_changed,
+ backend,
+ NULL, 0);
+
+ nvvfs_backend->root_monitor = g_vfs_monitor_new (backend);
+
+ recompute_files (nvvfs_backend);
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ return TRUE;
+}
+
+static NovellNautilus *
+lookup (GVfsBackendNvvfs *backend,
+ GVfsJob *job,
+ const char *filename)
+{
+ GList *l;
+ NovellNautilus *file;
+
+ if (*filename != '/')
+ goto out;
+
+ while (*filename == '/')
+ filename++;
+
+ if (*filename == 0)
+ return &root;
+
+ if (strchr (filename, '/') != NULL)
+ goto out;
+
+ for (l = backend->files; l != NULL; l = l->next)
+ {
+ file = l->data;
+
+ if (strcmp (file->filename, filename) == 0)
+ return file;
+ }
+
+ out:
+ g_vfs_job_failed (job, G_IO_ERROR,
+ G_IO_ERROR_NOT_FOUND,
+ _("File doesn't exist"));
+ return NULL;
+}
+
+
+static gboolean
+try_open_for_read (GVfsBackend *backend,
+ GVfsJobOpenForRead *job,
+ const char *filename)
+{
+ NovellNautilus *file;
+
+ file = lookup (G_VFS_BACKEND_NVVFS (backend),
+ G_VFS_JOB (job), filename);
+
+ if (file == &root)
+ g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+ G_IO_ERROR_IS_DIRECTORY,
+ _("Can't open directory"));
+ else if (file != NULL)
+ g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("Can't open mountable file"));
+ return TRUE;
+}
+
+static void
+file_info_from_file (NovellNautilus *file,
+ GFileInfo *info)
+{
+ char *uri;
+
+ g_file_info_set_name (info, file->filename);
+ g_file_info_set_display_name (info, file->display_name);
+
+ if (file->icon)
+ g_file_info_set_icon (info, file->icon);
+
+ if (file->root)
+ {
+ uri = g_file_get_uri (file->root);
+
+ g_file_info_set_attribute_string (info,
+ G_FILE_ATTRIBUTE_STANDARD_TARGET_URI,
+ uri);
+ g_free (uri);
+ }
+
+ g_file_info_set_sort_order (info, file->prio);
+
+ g_file_info_set_file_type (info, G_FILE_TYPE_MOUNTABLE);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT, file->can_mount);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT, file->can_unmount);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT, file->can_eject);
+
+ 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_TRASH, FALSE);
+}
+
+static gboolean
+try_enumerate (GVfsBackend *backend,
+ GVfsJobEnumerate *job,
+ const char *filename,
+ GFileAttributeMatcher *attribute_matcher,
+ GFileQueryInfoFlags flags)
+{
+ NovellNautilus *file;
+ GList *l;
+ GFileInfo *info;
+
+ file = lookup (G_VFS_BACKEND_NVVFS (backend),
+ G_VFS_JOB (job), filename);
+
+ if (file != &root)
+ {
+ if (file != NULL)
+ g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+ G_IO_ERROR_NOT_DIRECTORY,
+ _("The file is not a directory"));
+ return TRUE;
+ }
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ /* Enumerate root */
+ for (l = G_VFS_BACKEND_NVVFS (backend)->files; l != NULL; l = l->next)
+ {
+ file = l->data;
+
+ info = g_file_info_new ();
+
+ file_info_from_file (file, info);
+ g_vfs_job_enumerate_add_info (job, info);
+ g_object_unref (info);
+ }
+
+ g_vfs_job_enumerate_done (job);
+
+ return TRUE;
+}
+
+static gboolean
+try_query_info (GVfsBackend *backend,
+ GVfsJobQueryInfo *job,
+ const char *filename,
+ GFileQueryInfoFlags flags,
+ GFileInfo *info,
+ GFileAttributeMatcher *matcher)
+{
+ NovellNautilus *file;
+
+ file = lookup (G_VFS_BACKEND_NVVFS (backend),
+ G_VFS_JOB (job), filename);
+
+ if (file == &root)
+ {
+ GIcon *icon;
+
+ g_file_info_set_name (info, "/");
+ g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY);
+ g_file_info_set_display_name (info, _("Nvvfs"));
+ icon = g_themed_icon_new ("gnome-fs-client");
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+ 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_TRASH, FALSE);
+ g_file_info_set_content_type (info, "inode/directory");
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+ }
+ else if (file != NULL)
+ {
+ file_info_from_file (file, info);
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+ }
+
+ return TRUE;
+}
+
+static void
+g_vfs_backend_nvvfs_class_init (GVfsBackendNvvfsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
+
+ gobject_class->finalize = g_vfs_backend_nvvfs_finalize;
+
+ backend_class->try_mount = try_mount;
+ backend_class->try_open_for_read = try_open_for_read;
+ backend_class->try_query_info = try_query_info;
+ backend_class->try_enumerate = try_enumerate;
+}
Index: gvfs-1.52.0/daemon/gvfsbackendnvvfs.h
===================================================================
--- /dev/null
+++ gvfs-1.52.0/daemon/gvfsbackendnvvfs.h
@@ -0,0 +1,50 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_VFS_BACKEND_NVVFS_H__
+#define __G_VFS_BACKEND_NVVFS_H__
+
+#include <gvfsbackend.h>
+#include <gmountspec.h>
+
+G_BEGIN_DECLS
+
+#define G_VFS_TYPE_BACKEND_NVVFS (g_vfs_backend_nvvfs_get_type ())
+#define G_VFS_BACKEND_NVVFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_BACKEND_NVVFS, GVfsBackendNvvfs))
+#define G_VFS_BACKEND_NVVFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_BACKEND_NVVFS, GVfsBackendNvvfsClass))
+#define G_VFS_IS_BACKEND_NVVFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_BACKEND_NVVFS))
+#define G_VFS_IS_BACKEND_NVVFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_BACKEND_NVVFS))
+#define G_VFS_BACKEND_NVVFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_BACKEND_NVVFS, GVfsBackendNvvfsClass))
+
+typedef struct _GVfsBackendNvvfs GVfsBackendNvvfs;
+typedef struct _GVfsBackendNvvfsClass GVfsBackendNvvfsClass;
+
+struct _GVfsBackendNvvfsClass
+{
+ GVfsBackendClass parent_class;
+};
+
+GType g_vfs_backend_nvvfs_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_VFS_BACKEND_NVVFS_H__ */
Index: gvfs-1.52.0/daemon/meson.build
===================================================================
--- gvfs-1.52.0.orig/daemon/meson.build
+++ gvfs-1.52.0/daemon/meson.build
@@ -557,6 +557,20 @@ if enable_nfs
mounts += ['nfs']
endif
+if enable_nvvfs
+ sources = daemon_main_sources + files('gvfsbackendnvvfs.c')
+
+ cflags = [
+ '-DBACKEND_HEADER=gvfsbackendnvvfs.h',
+ '-DDEFAULT_BACKEND_TYPE=nvvfs',
+ '-DBACKEND_TYPES="nvvfs", G_VFS_TYPE_BACKEND_NVVFS,',
+ '-DMA_JOB_THREADS=1',
+ ]
+
+ programs += {'gvfsd-nvvfs': {'sources': sources, 'dependencies': [gio_unix_dep], 'c_args': cflags}}
+ mounts += ['nvvfs']
+endif
+
foreach program, options: programs
kwargs = {
'sources': daemon_main_sources + options.get('sources', []),
Index: gvfs-1.52.0/daemon/nvvfs.mount.in
===================================================================
--- /dev/null
+++ gvfs-1.52.0/daemon/nvvfs.mount.in
@@ -0,0 +1,5 @@
+[Mount]
+Type=nvvfs
+Exec=@libexecdir@/gvfsd-nvvfs
+AutoMount=false
+Scheme=nvvfs
Index: gvfs-1.52.0/meson.build
===================================================================
--- gvfs-1.52.0.orig/meson.build
+++ gvfs-1.52.0/meson.build
@@ -462,6 +462,9 @@ if enable_nfs
libnfs_dep = dependency('libnfs', version: '>= 1.9.8')
endif
+# *** NVVFS backend ***
+enable_nvvfs = get_option('nvvfs')
+
# *** SFTP backend ***
enable_sftp = get_option('sftp')
@@ -512,6 +515,7 @@ summary({
'http': enable_http,
'mtp': enable_mtp,
'nds': enable_nds,
+ 'nvvfs': enable_nvvfs,
'nfs': enable_nfs,
'sftp': enable_sftp,
'smb': enable_samba,
Index: gvfs-1.52.0/meson_options.txt
===================================================================
--- gvfs-1.52.0.orig/meson_options.txt
+++ gvfs-1.52.0/meson_options.txt
@@ -15,6 +15,7 @@ option('http', type: 'boolean', value: t
option('mtp', type: 'boolean', value: true, description: 'build with mtp backend and volume monitor')
option('nds', type: 'boolean', value: true, description: 'build with nds backend')
option('nfs', type: 'boolean', value: true, description: 'build with nfs backend')
+option('nvvfs', type: 'boolean', value: true, description: 'build with nvvfs backend')
option('sftp', type: 'boolean', value: true, description: 'build with sftp backend')
option('smb', type: 'boolean', value: true, description: 'build with smb backends')
option('udisks2', type: 'boolean', value: true, description: 'build with udisks2 volume monitor')

3764
gvfs.changes Normal file

File diff suppressed because it is too large Load Diff

4
gvfs.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: gvfs
version: 1.54.2
mtime: 1719572947
commit: 7ffc15fd6210568c009a64b6b4172e9ec8bba137

364
gvfs.spec Normal file
View File

@ -0,0 +1,364 @@
#
# spec file for package gvfs
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_without cdda
%bcond_without onedrive
Name: gvfs
Version: 1.54.2
Release: 0
Summary: Virtual File System functionality for GLib
License: GPL-3.0-only AND LGPL-2.0-or-later
Group: Development/Libraries/C and C++
URL: https://wiki.gnome.org/Projects/gvfs
Source0: %{name}-%{version}.tar.zst
Source99: baselibs.conf
### NOTE: Please, keep SLE-only patches at bottom (starting on 1000).
# PATCH-FEATURE-SLE gvfs-nds.patch ksamrat@novell.com -- Provides NDS browsing for nautilus
Patch1000: gvfs-nds.patch
# PATCH-FEATURE-SLE gvfs-nvvfs.patch ksamrat@novell.com -- Provides gvfs backend for novell nautilus plugin
Patch1001: gvfs-nvvfs.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libgcrypt-devel >= 1.2.2
BuildRequires: meson >= 0.50.0
BuildRequires: openssh
BuildRequires: pkgconfig
BuildRequires: xsltproc
BuildRequires: pkgconfig(avahi-client) >= 0.6
BuildRequires: pkgconfig(avahi-glib) >= 0.6
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(fuse3) >= 3.0.0
BuildRequires: pkgconfig(gcr-base-3)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(glib-2.0) >= 2.70.0
BuildRequires: pkgconfig(goa-1.0) >= 3.17.1
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gsettings-desktop-schemas) >= 3.33.0
BuildRequires: pkgconfig(gudev-1.0) >= 147
BuildRequires: pkgconfig(libarchive)
BuildRequires: pkgconfig(libbluray)
BuildRequires: pkgconfig(libcap)
BuildRequires: pkgconfig(libgdata) >= 0.18.0
BuildRequires: pkgconfig(libgphoto2) >= 2.4.0
BuildRequires: pkgconfig(libimobiledevice-1.0) >= 1.2
BuildRequires: pkgconfig(libmtp) >= 1.1.12
BuildRequires: pkgconfig(libnfs) >= 1.9.8
BuildRequires: pkgconfig(libsecret-unstable)
BuildRequires: pkgconfig(libsoup-3.0)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libusb-1.0) >= 1.0.21
BuildRequires: pkgconfig(libxml-2.0)
%if %{with onedrive}
BuildRequires: pkgconfig(msgraph-0.1)
%endif
BuildRequires: pkgconfig(polkit-gobject-1) >= 0.114
BuildRequires: pkgconfig(smbclient)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udisks2) >= 1.97
Recommends: gvfs-backends
Recommends: gvfs-common
Recommends: gvfs-fuse
%{glib2_gio_module_requires}
%{?systemd_requires}
%if %{with cdda}
BuildRequires: pkgconfig(libcdio_paranoia) >= 0.78.2
%endif
%if 0%{?sle_version}
# The library gvfscommon was converted to a private library and is not used outside of gvfs
Obsoletes: libgvfscommon0 <= %{version}
%endif
%description
gvfs GNOME's userspace virtual filesystem designed to work with the
I/O abstraction of GIO, a library available with GLib. gvfs installs
several modules that are automatically used by applications using the
APIs of libgio. There is also FUSE support that allows applications
not using GIO to access the GVfs filesystems.
%package backend-afc
%define mobile_device_package %(rpm -q --qf "%%{name}" -f $(readlink -f %{_libdir}/libimobiledevice-1.0.so))
Summary: VFS functionality for GLib -- iPod / iPhone Support
License: LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Supplements: (gvfs and %{mobile_device_package})
%description backend-afc
This package provides a gvfs backend that supports iPod / iPhone devices.
%package backend-samba
%define smb_client_package %(rpm -q --qf "%%{name}" -f $(readlink -f %{_libdir}/libsmbclient.so))
Summary: VFS functionality for GLib -- Samba Support
License: LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: %{name}-backends = %{version}
Supplements: (gvfs and %{smb_client_package})
%description backend-samba
This package provides a gvfs backend that supports Samba.
%package backends
Summary: VFS functionality for GLib
License: GPL-3.0-only AND LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: permissions
Recommends: pkexec
Recommends: udisks2
%description backends
VFS functionality for GLib.
This package contains all necessary backend files and libraries.
%package fuse
Summary: VFS functionality for GLib
License: LGPL-2.0-or-later
Group: System/Filesystems
Requires: %{name} = %{version}
Requires: fuse3
%description fuse
gvfs GNOME's userspace virtual filesystem designed to work with the
I/O abstraction of GIO, a library available with GLib. gvfs installs
several modules that are automatically used by applications using the
APIs of libgio.
This package contains FUSE support that allows applications
not using GIO to access the GVfs filesystems.
%package backend-goa
Summary: Google disk and GOA functionality for GLib
License: LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Supplements: (gvfs and gnome-online-accounts)
%description backend-goa
This package provides a gvfs backend that supports Google disk
and GNOME online accounts integration.
%package devel
Summary: Development files for the GNOME Virtual file system
License: LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
BuildArch: noarch
%description devel
gvfs GNOME's userspace virtual filesystem designed to work with the
I/O abstraction of GIO, a library available with GLib. gvfs installs
several modules that are automatically used by applications using the
APIs of libgio.
This subpackage contains libraries and header files for developing
gvfs plugins.
%lang_package
%prep
%autosetup -N
%if !0%{?sle_version}
%autopatch -p1 -M 999
%else
%patch -P 1000 -p1
%patch -P 1001 -p1
%endif
%build
%meson \
--libexecdir=%{_libexecdir}/%{name} \
-Dudisks2=true \
%{!?with_cdda: -Dcdda=false} \
-Dman=true \
-Dburn=true \
-Dsystemduserunitdir=%{_userunitdir} \
-Donedrive=%[%{with onedrive} ? "true" : "false" ] \
%{nil}
%meson_build
%install
%meson_install
# drop polkit rules files (for wheel group) - boo#1125433
rm -v %{buildroot}%{_datadir}/polkit-1/rules.d/org.gtk.vfs.file-operations.rules
find %{buildroot} -type f -name "*.la" -delete -print
%find_lang %{name}
# Rename daemon/trashlib/COPYING
mv daemon/trashlib/COPYING daemon/trashlib/COPYING.trashlib
%post
%{glib2_gio_module_post}
%post fuse
%tmpfiles_create %{_tmpfilesdir}/gvfsd-fuse-tmpfiles.conf
%post backends
%set_permissions %{_libexecdir}/%{name}/gvfsd-nfs
%verifyscript backends
%verify_permissions -e %{_libexecdir}/%{name}/gvfsd-nfs
%postun
%{glib2_gio_module_postun}
%files
%license COPYING daemon/trashlib/COPYING.trashlib
%doc NEWS README.md
%doc daemon/org.gtk.vfs.file-operations.rules.in
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/mounts
%dir %{_datadir}/%{name}/remote-volume-monitors
%{_libdir}/gio/modules/*.so
%dir %{_libdir}/gvfs
%{_libdir}/gvfs/libgvfscommon.so
%{_libdir}/gvfs/libgvfsdaemon.so
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/gvfsd
%{_datadir}/dbus-1/services/org.gtk.vfs.Daemon.service
%{_libexecdir}/%{name}/gvfsd-metadata
%{_datadir}/dbus-1/services/org.gtk.vfs.Metadata.service
%{_mandir}/man1/gvfsd.1%{?ext_man}
%{_mandir}/man1/gvfsd-metadata.1%{?ext_man}
%{_mandir}/man7/gvfs.7%{?ext_man}
%{_userunitdir}/gvfs-daemon.service
%{_userunitdir}/gvfs-metadata.service
%files fuse
%{_libexecdir}/%{name}/gvfsd-fuse
%{_tmpfilesdir}/gvfsd-fuse-tmpfiles.conf
%{_mandir}/man1/gvfsd-fuse.1%{?ext_man}
%files backend-afc
%{_libexecdir}/%{name}/gvfs-afc-volume-monitor
%{_datadir}/dbus-1/services/org.gtk.vfs.AfcVolumeMonitor.service
%{_userunitdir}/gvfs-afc-volume-monitor.service
%{_datadir}/%{name}/remote-volume-monitors/afc.monitor
%{_libexecdir}/%{name}/gvfsd-afc
%{_datadir}/%{name}/mounts/afc.mount
%files backend-samba
%{_libexecdir}/%{name}/gvfsd-smb
%{_datadir}/%{name}/mounts/smb.mount
%{_libexecdir}/%{name}/gvfsd-smb-browse
%{_datadir}/%{name}/mounts/smb-browse.mount
# GSettings schemas & conversion data
# Those schemas are used gvfsd-smb
%{_datadir}/glib-2.0/schemas/org.gnome.system.smb.gschema.xml
%{_datadir}/GConf/gsettings/gvfs-smb.convert
%files backend-goa
%{_libexecdir}/%{name}/gvfs-goa-volume-monitor
%{_userunitdir}/gvfs-goa-volume-monitor.service
%{_datadir}/%{name}/remote-volume-monitors/goa.monitor
%{_datadir}/dbus-1/services/org.gtk.vfs.GoaVolumeMonitor.service
%{_libexecdir}/%{name}/gvfsd-google
%{_datadir}/%{name}/mounts/google.mount
%if %{with onedrive}
%{_libexecdir}/gvfs/gvfsd-onedrive
%{_datadir}/gvfs/mounts/onedrive.mount
%endif
%files backends
%doc monitor/udisks2/what-is-shown.txt
%{_datadir}/dbus-1/services/org.gtk.vfs.UDisks2VolumeMonitor.service
%{_datadir}/%{name}/remote-volume-monitors/udisks2.monitor
%{_libexecdir}/%{name}/gvfs-udisks2-volume-monitor
%{_userunitdir}/gvfs-udisks2-volume-monitor.service
%{_libexecdir}/%{name}/gvfs-gphoto2-volume-monitor
%{_userunitdir}/gvfs-gphoto2-volume-monitor.service
%{_datadir}/dbus-1/services/org.gtk.vfs.GPhoto2VolumeMonitor.service
%{_datadir}/%{name}/remote-volume-monitors/gphoto2.monitor
%{_libexecdir}/%{name}/gvfsd-admin
%{_datadir}/%{name}/mounts/admin.mount
%{_datadir}/polkit-1/actions/org.gtk.vfs.file-operations.policy
%{_libexecdir}/%{name}/gvfsd-afp
%{_datadir}/%{name}/mounts/afp.mount
%{_libexecdir}/%{name}/gvfsd-afp-browse
%{_datadir}/%{name}/mounts/afp-browse.mount
%{_libexecdir}/%{name}/gvfsd-archive
%{_datadir}/%{name}/mounts/archive.mount
%{_libexecdir}/%{name}/gvfsd-burn
%{_datadir}/%{name}/mounts/burn.mount
%if %{with cdda}
%{_libexecdir}/%{name}/gvfsd-cdda
%{_datadir}/%{name}/mounts/cdda.mount
%endif
%{_libexecdir}/%{name}/gvfsd-computer
%{_datadir}/%{name}/mounts/computer.mount
%{_libexecdir}/%{name}/gvfsd-dav
%{_datadir}/%{name}/mounts/dav.mount
%{_datadir}/%{name}/mounts/dav+sd.mount
%{_libexecdir}/%{name}/gvfsd-dnssd
%{_datadir}/%{name}/mounts/dns-sd.mount
%{_libexecdir}/%{name}/gvfsd-ftp
%{_datadir}/%{name}/mounts/ftp.mount
%{_datadir}/%{name}/mounts/ftps.mount
%{_datadir}/%{name}/mounts/ftpis.mount
%{_libexecdir}/%{name}/gvfsd-gphoto2
%{_datadir}/%{name}/mounts/gphoto2.mount
%{_libexecdir}/%{name}/gvfsd-http
%{_datadir}/%{name}/mounts/http.mount
%{_libexecdir}/%{name}/gvfsd-localtest
%{_datadir}/%{name}/mounts/localtest.mount
%{_libexecdir}/%{name}/gvfsd-mtp
%{_libexecdir}/%{name}/gvfs-mtp-volume-monitor
%{_userunitdir}/gvfs-mtp-volume-monitor.service
%{_datadir}/%{name}/remote-volume-monitors/mtp.monitor
%{_datadir}/dbus-1/services/org.gtk.vfs.MTPVolumeMonitor.service
%{_datadir}/%{name}/mounts/mtp.mount
%if 0%{?sle_version}
%{_libexecdir}/%{name}/gvfsd-nds
%{_libexecdir}/%{name}/gvfsd-nvvfs
%{_datadir}/%{name}/mounts/nds.mount
%{_datadir}/%{name}/mounts/nvvfs.mount
%endif
%{_libexecdir}/%{name}/gvfsd-network
%{_datadir}/%{name}/mounts/network.mount
# allow priv ports for mounting nfs. Otherwise the nfs-service requires insecure (boo#1065864)
%verify(not mode caps) %caps(cap_net_bind_service=+ep) %{_libexecdir}/%{name}/gvfsd-nfs
%{_libexecdir}/%{name}/gvfsd-nfs
%{_datadir}/%{name}/mounts/nfs.mount
%{_libexecdir}/%{name}/gvfsd-recent
%{_datadir}/%{name}/mounts/recent.mount
%{_libexecdir}/%{name}/gvfsd-sftp
%{_datadir}/%{name}/mounts/sftp.mount
# gvfsd-trash is GPLv3 because of trashlib.
%{_libexecdir}/%{name}/gvfsd-trash
%{_datadir}/%{name}/mounts/trash.mount
# GSettings schemas & conversion data
# Those schemas are used by gvfsd-network
%{_datadir}/glib-2.0/schemas/org.gnome.system.dns_sd.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
%dir %{_datadir}/GConf
%dir %{_datadir}/GConf/gsettings
%{_datadir}/GConf/gsettings/gvfs-dns-sd.convert
%{_libexecdir}/gvfs/gvfsd-wsdd
%{_datadir}/glib-2.0/schemas/org.gnome.system.wsdd.gschema.xml
%{_datadir}/gvfs/mounts/wsdd.mount
%files devel
%doc CONTRIBUTING.md NEWS.pre-1-2
%{_includedir}/gvfs-client
%files lang -f %{name}.lang
%changelog