Re: ssh method speed up



> 
> Umm ... ENOPATCH. :-)
> 
> Please attach and try again.

Of course there is no patch, I had a change to make before sending it,
so I told evolution to send the mail later while I should have told it
to save as draft :)

Here it is,

Christophe

> 
> Malcolm
> 
> -- 
> Works better when plugged in.
> _______________________________________________
> gnome-vfs-list mailing list
> gnome-vfs-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
> 


Index: modules/ssh-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/ssh-method.c,v
retrieving revision 1.13
diff -u -r1.13 ssh-method.c
--- modules/ssh-method.c	29 Oct 2002 13:44:59 -0000	1.13
+++ modules/ssh-method.c	7 Nov 2002 13:43:37 -0000
@@ -51,6 +51,7 @@
 	int read_fd;
 	int write_fd;
 	pid_t pid;
+	GnomeVFSFileInfoOptions info_opts;
 } SshHandle;
 
 static GnomeVFSResult do_open           (GnomeVFSMethod *method,
@@ -431,7 +432,7 @@
 	if (result != GNOME_VFS_OK) {
 		return result;
 	}
-
+	handle->info_opts = options;
 	handle->open_mode = GNOME_VFS_OPEN_NONE;
 	handle->type = SSH_LIST;
 	*method_handle = (GnomeVFSMethodHandle *)handle;
@@ -460,7 +461,6 @@
      struct param params[2] = {{'r', GNOME_VFS_PERM_ACCESS_READABLE},
                                {'w', GNOME_VFS_PERM_ACCESS_WRITABLE}};
 
-     
      name = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
 
 
@@ -570,17 +570,24 @@
 
 		/* FIXME: support symlinks correctly */
 
-		file_info->mime_type = g_strdup 
-			(gnome_vfs_get_file_mime_type (filename, &st, FALSE));
+		if (((SshHandle*)method_handle)->info_opts
+		    & GNOME_VFS_FILE_INFO_GET_MIME_TYPE) {
+			file_info->mime_type = g_strdup 
+				(gnome_vfs_get_file_mime_type (filename, &st, 
+							       FALSE));
+			file_info->valid_fields 
+				|= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
+		}
 
-		file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
 		file_info->valid_fields &= 
 			~GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT;
 		file_info->valid_fields &= 
 			~GNOME_VFS_FILE_INFO_FIELDS_IO_BLOCK_SIZE;
-
-		get_access_info (((SshHandle*)method_handle)->uri, 
-				 file_info);
+		if (((SshHandle*)method_handle)->info_opts 
+		    & GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS) {
+			get_access_info (((SshHandle*)method_handle)->uri, 
+					 file_info);
+		}
 
 		/* Break out.
 		   We are in a loop so we get the first 'ls' line;
@@ -622,7 +629,7 @@
 	if (result != GNOME_VFS_OK) {
 		return result;
 	}
-
+	handle->info_opts = options;
 	handle->open_mode = GNOME_VFS_OPEN_NONE;
 	handle->type = SSH_LIST;
 
Index: libgnomevfs/gnome-vfs-file-info.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-file-info.h,v
retrieving revision 1.24
diff -u -r1.24 gnome-vfs-file-info.h
--- libgnomevfs/gnome-vfs-file-info.h	29 Oct 2002 13:44:58 -0000	1.24
+++ libgnomevfs/gnome-vfs-file-info.h	7 Nov 2002 13:43:37 -0000
@@ -222,6 +222,9 @@
  * (sniffing, algorithmic detection, etc)
  * @GNOME_VFS_FILE_INFO_FOLLOW_LINKS: automatically follow symbolic links and retrieve the
  * properties of their target (recommended)
+ * @GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS: tries to get data similar to what
+ * would return access(2) on a local file system (ie is the file readable,
+ * writable and/or executable). Can be really slow on remote file systems
  *
  * Packed boolean bitfield representing options that can
  * be passed into a gnome_vfs_get_file_info() call (or other
@@ -229,7 +232,7 @@
  * of get_file_info.
  **/
 typedef enum {
-	GNOME_VFS_FILE_INFO_DEFAULT = 0, /* FIXME bugzilla.eazel.com 1203: name sucks */
+	GNOME_VFS_FILE_INFO_DEFAULT = 0,
 	GNOME_VFS_FILE_INFO_GET_MIME_TYPE = 1 << 0,
 	GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE = 1 << 1,
 	GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE = 1 << 2,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]