diff --git a/gvfs-nds.patch b/gvfs-nds.patch index efd16f3..a89a814 100644 --- a/gvfs-nds.patch +++ b/gvfs-nds.patch @@ -1,10 +1,11 @@ -Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +Index: gvfs-1.34.0/daemon/gvfsbackendnds.c =================================================================== ---- /dev/null -+++ gvfs-1.9.0/daemon/gvfsbackendnds.c -@@ -0,0 +1,753 @@ +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gvfs-1.34.0/daemon/gvfsbackendnds.c 2017-09-15 10:53:24.564258329 +0200 +@@ -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 @@ -33,13 +34,13 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +#include +#include +#include -+#include -+#include ++#include ++#include + +#include +#include +#include -+#include ++#include +#include + +#include "gvfsbackendnds.h" @@ -66,9 +67,9 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + GVfsBackend parent_instance; + + char *server; -+ char *mounted_server; ++ char *mounted_server; + -+ GMutex *entries_lock; ++ GMutex entries_lock; + GList *entries; + int entry_errno; +}; @@ -114,43 +115,43 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + 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; ++ 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); ++ if(entry->name != NULL) ++ g_free (entry->name); ++ if(entry != NULL) ++ g_free (entry); +} + + @@ -161,42 +162,40 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + + 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_free (backend->entries_lock); -+ ++ 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(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); ++ (*G_OBJECT_CLASS (g_vfs_backend_nds_parent_class)->finalize) (object); +} + +static void +g_vfs_backend_nds_init (GVfsBackendNds *backend) +{ -+ backend->entries_lock = g_mutex_new (); ++ g_mutex_init(&backend->entries_lock); + + if (mount_tracker == NULL) -+ mount_tracker = g_mount_tracker_new (NULL); ++ mount_tracker = g_mount_tracker_new (NULL, FALSE); +} + + +static void +update_cache (GVfsBackendNds *backend,const char *filename) +{ -+ GString *uri; + GList *entries; + int entry_errno; + char *objectname=NULL; + char *treename=NULL; + GList *objectlist=NULL; + GList *object=NULL; -+ GList *l; + FILE *fptr=NULL; + void *handle=NULL; //handle for dlopen + int res; @@ -211,157 +210,157 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + + 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(backend->server != NULL) ++ { ++ server_name = g_strdup(backend->server); ++ if((ptr = strchr(server_name,'%')) != NULL) ++ *ptr = '\0'; + -+ 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); ++ 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); ++ } + -+ out: ++ 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; + -+ 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; -+ char *normalized; ++ BrowseEntry *entry, *found; ++ GList *l; ++ char *end; ++ int len; + -+ while (*filename == '/') -+ filename++; ++ while (*filename == '/') ++ filename++; + -+ end = strchr (filename, '/'); -+ if (end) ++ end = strchr (filename, '/'); ++ if (end) + { -+ len = end - filename; ++ len = end - filename; + -+ while (*end == '/') -+ end++; ++ while (*end == '/') ++ end++; + -+ if (*end != 0) -+ return NULL; ++ if (*end != 0) ++ return NULL; + } -+ else -+ len = strlen (filename); ++ else ++ len = strlen (filename); + -+ /* First look for an exact filename match */ -+ found = NULL; -+ for (l = backend->entries; l != NULL; l = l->next) ++ /* 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; -+ } ++ entry = l->data; ++ ++ if (strncmp (filename, entry->name, len) == 0 && ++ strlen (entry->name) == len) ++ { ++ found = entry; ++ break; ++ } + } + -+ if (found == NULL) ++ if (found == NULL) + { -+ /* 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); ++ 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; ++ ++ return found; +} + +static GMountSpec * @@ -369,11 +368,11 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +{ + 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; +} + @@ -390,7 +389,6 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + char *display_name; + char *icon; + GMountSpec *browse_mount_spec; -+ char *ptr = NULL; + + + icon = NULL; @@ -408,12 +406,12 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + 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_user_visible (backend, FALSE); + g_vfs_backend_set_mount_spec (backend, browse_mount_spec); + g_mount_spec_unref (browse_mount_spec); + @@ -428,8 +426,7 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + gboolean is_automount) +{ + GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend); -+ char *server; -+ char *share; ++ const char *server; + + server = g_mount_spec_get (mount_spec, "host"); + if (server) @@ -442,7 +439,7 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + op_backend->server = NULL; + op_backend->mounted_server = NULL; + } -+ ++ + return FALSE; +} + @@ -452,20 +449,18 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + const char *filename, + GMountSource *mount_source) +{ -+ BrowseEntry *entry; -+ GError *error = NULL; + GMountSpec *mount_spec; + -+ g_mutex_lock (backend->entries_lock); -+ -+backend->server = g_strdup(filename); ++ g_mutex_lock (&backend->entries_lock); + -+ 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); ++ backend->server = g_strdup(filename); + -+ g_vfs_job_succeeded (G_VFS_JOB (job)); ++ 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)); +} + + @@ -475,15 +470,15 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + const char *filename, + GMountSource *mount_source) +{ -+ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend); ++ GVfsBackendNds *op_backend = G_VFS_BACKEND_NDS (backend); + -+update_cache (op_backend,filename); ++ update_cache (op_backend,filename); + -+ run_mount_mountable (op_backend, -+ job, -+ filename, -+ mount_source); -+ return TRUE; ++ run_mount_mountable (op_backend, ++ job, ++ filename, ++ mount_source); ++ return TRUE; +} + +static gboolean @@ -529,7 +524,7 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + if (reserved_chars_allowed && + strchr (reserved_chars_allowed, c) != NULL) + return TRUE; -+ ++ + return FALSE; +} + @@ -544,11 +539,11 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + + 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 @@ -563,37 +558,34 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +static void +get_file_info_from_entry (GVfsBackendNds *backend, BrowseEntry *entry, GFileInfo *info) +{ -+ GMountSpec *mount_spec; + 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"); ++ icon = g_themed_icon_new ("ncl-ndstree"); + else -+ icon = g_themed_icon_new ("ncl-nwcontext"); -+ ++ icon = g_themed_icon_new ("ncl-nwcontext"); ++ + if (icon) -+ { ++ { + g_file_info_set_icon (info, icon); + g_object_unref (icon); -+ } -+ -+ mount_spec = NULL; ++ } + -+ g_file_info_set_file_type (info, G_FILE_TYPE_SHORTCUT); ++ 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, '/'); ++ 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_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, uri->str); + -+ g_string_free (uri, TRUE); ++ g_string_free (uri, TRUE); + +} + @@ -606,14 +598,14 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +{ + BrowseEntry *entry; + -+ g_mutex_lock (backend->entries_lock); -+ ++ 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); ++ ++ g_mutex_unlock (&backend->entries_lock); + + if (entry) + g_vfs_job_succeeded (G_VFS_JOB (job)); @@ -662,7 +654,7 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + g_object_unref (icon); + } + g_vfs_job_succeeded (G_VFS_JOB (job)); -+ ++ + return TRUE; + } + @@ -684,7 +676,7 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + g_vfs_job_succeeded (G_VFS_JOB (job)); + + files = NULL; -+ g_mutex_lock (backend->entries_lock); ++ g_mutex_lock (&backend->entries_lock); + for (l = backend->entries; l != NULL; l = l->next) + { + BrowseEntry *entry = l->data; @@ -694,8 +686,8 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + + files = g_list_prepend (files, info); + } -+ g_mutex_unlock (backend->entries_lock); -+ ++ g_mutex_unlock (&backend->entries_lock); ++ + files = g_list_reverse (files); + + g_vfs_job_enumerate_add_infos (job, files); @@ -749,6 +741,8 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c + 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 @@ -756,13 +750,13 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.c +{ + g_set_application_name (_("Displaying Embedded Objects")); +} -Index: gvfs-1.9.0/daemon/gvfsbackendnds.h +Index: gvfs-1.34.0/daemon/gvfsbackendnds.h =================================================================== ---- /dev/null -+++ gvfs-1.9.0/daemon/gvfsbackendnds.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gvfs-1.34.0/daemon/gvfsbackendnds.h 2017-09-15 10:53:56.159989373 +0200 @@ -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 @@ -807,18 +801,18 @@ Index: gvfs-1.9.0/daemon/gvfsbackendnds.h +}; + +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__ */ -Index: gvfs-1.9.0/daemon/Makefile.am +Index: gvfs-1.34.0/daemon/Makefile.am =================================================================== ---- gvfs-1.9.0.orig/daemon/Makefile.am -+++ gvfs-1.9.0/daemon/Makefile.am -@@ -143,6 +143,10 @@ mount_in_files += nvvfs.mount.in +--- gvfs-1.34.0.orig/daemon/Makefile.am 2017-09-15 10:15:10.715090208 +0200 ++++ gvfs-1.34.0/daemon/Makefile.am 2017-09-15 10:15:46.554940823 +0200 +@@ -144,6 +144,10 @@ mount_DATA += nvvfs.mount libexec_PROGRAMS += gvfsd-nvvfs @@ -829,7 +823,7 @@ Index: gvfs-1.9.0/daemon/Makefile.am EXTRA_DIST = \ $(service_in_files) \ $(systemd_user_in_files) \ -@@ -525,6 +529,19 @@ gvfsd_http_CPPFLAGS = \ +@@ -528,6 +532,19 @@ gvfsd_http_LDADD = $(libraries) $(HTTP_LIBS) @@ -849,10 +843,10 @@ Index: gvfs-1.9.0/daemon/Makefile.am gvfsd_nvvfs_SOURCES = \ gvfsbackendnvvfs.c gvfsbackendnvvfs.h \ daemon-main.c daemon-main.h \ -Index: gvfs-1.9.0/daemon/nds.mount.in +Index: gvfs-1.34.0/daemon/nds.mount.in =================================================================== ---- /dev/null -+++ gvfs-1.9.0/daemon/nds.mount.in +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gvfs-1.34.0/daemon/nds.mount.in 2017-09-15 10:15:46.554940823 +0200 @@ -0,0 +1,5 @@ +[Mount] +Type=nds diff --git a/gvfs.changes b/gvfs.changes index a00924c..3eaf40a 100644 --- a/gvfs.changes +++ b/gvfs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 15 09:01:05 UTC 2017 - fcrozat@suse.com + +- Rebase gvfs-nds.patch for gvfs 1.34.0, including identations and + warnings fixes. + ------------------------------------------------------------------- Mon Sep 11 16:31:55 UTC 2017 - dimstar@opensuse.org