gvfs r1088 - trunk/daemon



Author: tbzatek
Date: Thu Jan 10 10:51:45 2008
New Revision: 1088
URL: http://svn.gnome.org/viewvc/gvfs?rev=1088&view=rev

Log:
Add initial localtest backend for testing purposes incorporating error injection

Added:
   trunk/daemon/gvfsbackendlocaltest.c
   trunk/daemon/gvfsbackendlocaltest.h
   trunk/daemon/localtest.mount.in
Modified:
   trunk/daemon/Makefile.am

Modified: trunk/daemon/Makefile.am
==============================================================================
--- trunk/daemon/Makefile.am	(original)
+++ trunk/daemon/Makefile.am	Thu Jan 10 10:51:45 2008
@@ -30,10 +30,10 @@
 %.mount: %.mount.in ../config.log
 	sed -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
 
-libexec_PROGRAMS=gvfsd gvfsd-ftp gvfsd-sftp gvfsd-trash gvfsd-computer
+libexec_PROGRAMS=gvfsd gvfsd-ftp gvfsd-sftp gvfsd-trash gvfsd-computer gvfsd-localtest
 
-mount_in_files = ftp.mount.in sftp.mount.in trash.mount.in computer.mount.in
-mount_DATA = ftp.mount sftp.mount trash.mount computer.mount
+mount_in_files = ftp.mount.in sftp.mount.in trash.mount.in computer.mount.in localtest.mount.in
+mount_DATA = ftp.mount sftp.mount trash.mount computer.mount localtest.mount
 
 if HAVE_SAMBA
 mount_in_files += smb.mount.in smb-browse.mount.in
@@ -113,6 +113,18 @@
 
 gvfsd_test_LDADD = $(libraries)
 
+gvfsd_localtest_SOURCES = \
+	gvfsbackendlocaltest.c gvfsbackendlocaltest.h \
+	daemon-main.c daemon-main.h \
+	daemon-main-generic.c
+
+gvfsd_localtest_CPPFLAGS = \
+	-DBACKEND_HEADER=gvfsbackendlocaltest.h \
+	-DDEFAULT_BACKEND_TYPE=localtest \
+	-DBACKEND_TYPES='"localtest", G_VFS_TYPE_BACKEND_LOCALTEST,'
+
+gvfsd_localtest_LDADD = $(libraries)
+
 gvfsd_smb_SOURCES = \
 	gvfsbackendsmb.c gvfsbackendsmb.h \
 	daemon-main.c daemon-main.h \

Added: trunk/daemon/gvfsbackendlocaltest.c
==============================================================================
--- (empty file)
+++ trunk/daemon/gvfsbackendlocaltest.c	Thu Jan 10 10:51:45 2008
@@ -0,0 +1,1161 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *   Local testing backend wrapping error injection 
+ * 
+ * Copyright (C) 2006-2008 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: Tomas Bzatek <tbzatek redhat com>
+ */
+
+
+/***  USAGE:
+ * 
+ *  - behaviour is controlled via environment variable (i.e. set from the shell, before launching /usr/libexec/gvfsd)
+ *    GVFS_ERRORNEOUS: number, how often operation should fail (a random() is used, this number is not a sequence) 
+ *    GVFS_ERRORNEOUS_OPS: bitmask of operations to fail - see GVfsJobType enum
+ * 
+ ***/
+
+
+
+#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 <glib/gstdio.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+
+#include "gvfsbackendlocaltest.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 "gvfsjobqueryinfo.h"
+#include "gvfsjobdelete.h"
+#include "gvfsjobqueryfsinfo.h"
+#include "gvfsjobqueryattributes.h"
+#include "gvfsjobenumerate.h"
+#include "gvfsdaemonprotocol.h"
+#include "gvfsjobcreatemonitor.h"
+#include "gvfsmonitor.h"
+
+
+/* TODO:
+ *  Bugs: 
+ *   - unmounting ?
+ *   - copy dialog still visible after try_copy() finished successfully
+ * 
+ * 
+ *  Conceptual:
+ *   - closing directory/file monitor - after a Nautilus window is closed, no method is called to destroy the monitor object
+ *   - find a better way how to pass parameters to a running instance of gvfsd-localtest
+ * 
+ */
+
+
+
+
+
+/************************************************
+ * 	  Error injection
+ * 
+ */
+
+
+static void     
+inject_error (GVfsBackend *backend,
+			  GVfsJob *job,
+			  GVfsJobType job_type)
+{
+  GVfsBackendLocalTest *op_backend = G_VFS_BACKEND_LOCALTEST (backend);
+
+  if ((op_backend->errorneous > 0) && ((random() % op_backend->errorneous) == 0) && 
+	  ((op_backend->inject_op_types < 1) || ((op_backend->inject_op_types & job_type) == job_type)))
+  {
+	  g_print ("(II) inject_error: BANG! injecting error... \n");
+      g_vfs_job_failed (G_VFS_JOB (job),
+			G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+			_("Injected error"));
+  } else g_vfs_job_succeeded (job); 
+}
+
+
+
+
+
+/************************************************
+ * 	  Utility functions
+ * 
+ */
+
+/*  returned object should be freed in user's function  */
+static GFile*
+get_g_file_from_local (const char *filename, GVfsJob *job)
+{
+	GVfs *local_vfs;
+	GFile *file = NULL;
+	  
+	local_vfs = g_vfs_get_local ();
+	if (! local_vfs) {
+		g_vfs_job_failed (job,	G_IO_ERROR, G_IO_ERROR_FAILED,
+				"Cannot get local vfs"); 
+	    g_print (" (EE) get_g_file_from_local (filename = '%s'): local_vfs == NULL \n", filename);
+	    return NULL;
+	}
+
+	file = g_vfs_get_file_for_path (local_vfs, filename);
+	if (! file) {
+		g_vfs_job_failed (job,	G_IO_ERROR, G_IO_ERROR_FAILED,
+				"Cannot get file from local vfs"); 
+	    g_print (" (EE) get_g_file_from_local (filename = '%s'): file == NULL \n", filename);
+		return NULL;
+	}
+	return file;
+}
+
+/*  returned object should be freed in user's function  */
+static GFileInfo*
+get_g_file_info_from_local (const char *filename, GFile *file, 
+		const char *attributes, GFileQueryInfoFlags flags, 
+		GVfsJob *job)
+{
+	GError *error;
+	GFileInfo *info = NULL;
+
+	g_return_val_if_fail (file != NULL, NULL);
+	if (file) {
+		error = NULL;
+		info = g_file_query_info (file, attributes, flags, G_VFS_JOB (job)->cancellable, &error);
+		
+		if ((error) || (! info) ) {
+		    g_print (" (EE) get_g_file_info_from_local (filename = '%s'): g_file_query_info failed: %s \n", filename, error->message);
+		    g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+		    return NULL;
+		}
+	}
+	return info;
+}
+
+
+
+
+
+
+
+/************************************************
+ * 	  Initialization
+ * 
+ */
+
+G_DEFINE_TYPE (GVfsBackendLocalTest, g_vfs_backend_localtest, G_VFS_TYPE_BACKEND);
+
+static void
+g_vfs_backend_localtest_init (GVfsBackendLocalTest *backend)
+{
+	//  Nothing in there
+	g_print ("(II) g_vfs_backend_localtest_init \n");
+
+	//  env var conversion
+	backend->errorneous = -1;
+	backend->inject_op_types = -1;
+	
+	const char *c = g_getenv("GVFS_ERRORNEOUS");
+	if (c) {
+		backend->errorneous = g_ascii_strtoll(c, NULL, 0);
+		g_print ("(II) g_vfs_backend_localtest_init: setting 'errorneous' to '%d' \n", backend->errorneous);
+	}
+
+	c = g_getenv("GVFS_ERRORNEOUS_OPS");
+	if (c) {
+		backend->inject_op_types = g_ascii_strtoll(c, NULL, 0);
+		g_print ("(II) g_vfs_backend_localtest_init: setting 'inject_op_types' to '%lu' \n", (unsigned long)backend->inject_op_types);
+	}
+	
+	g_print ("(II) g_vfs_backend_localtest_init done.\n");
+}
+
+static void
+g_vfs_backend_localtest_finalize (GObject *object)
+{
+	g_print ("(II) g_vfs_backend_localtest_finalize \n");
+
+	GVfsBackendLocalTest *backend;
+	backend = G_VFS_BACKEND_LOCALTEST (object);
+
+    if (backend->test)
+    	g_free ((gpointer)backend->test);  
+  
+	if (G_OBJECT_CLASS (g_vfs_backend_localtest_parent_class)->finalize)
+      (*G_OBJECT_CLASS (g_vfs_backend_localtest_parent_class)->finalize) (object);
+}
+
+
+
+
+
+
+
+/************************************************
+ * 	  Mount
+ * 
+ */
+
+static void
+do_mount (GVfsBackend *backend,
+           GVfsJobMount *job,
+           GMountSpec *mount_spec,
+           GMountSource *mount_source,
+           gboolean is_automount)
+{
+  GVfsBackendLocalTest *op_backend = G_VFS_BACKEND_LOCALTEST (backend);
+
+  g_print ("(II) try_mount \n");
+
+  g_vfs_backend_set_display_name (backend, "localtest");
+
+  op_backend->mount_spec = g_mount_spec_new ("localtest");
+  g_vfs_backend_set_mount_spec (backend, op_backend->mount_spec);
+
+  g_vfs_backend_set_icon_name (backend, "folder-remote");
+
+  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_MOUNT);
+}
+
+
+static void
+do_unmount (GVfsBackend *backend, GVfsJobUnmount *job)
+{
+  g_print ("(II) try_umount \n");
+
+  GVfsBackendLocalTest *op_backend = G_VFS_BACKEND_LOCALTEST (backend);
+  g_mount_spec_unref (op_backend->mount_spec);
+  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_UNMOUNT);
+}
+
+
+
+
+
+
+
+/************************************************
+ * 	  Queries
+ * 
+ */
+
+static void
+do_enumerate (GVfsBackend *backend,
+               GVfsJobEnumerate *job,
+               const char *filename,
+               GFileAttributeMatcher *attribute_matcher,
+               GFileQueryInfoFlags flags)
+{
+  g_print ("(II) try_enumerate (filename = %s) \n", filename);
+
+  GFile *file;
+  GFileInfo *info;
+  GError *error;
+  GFileEnumerator *enumerator;
+  
+  file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  error = NULL;
+  enumerator = g_file_enumerate_children (file, "*", flags, G_VFS_JOB (job)->cancellable, &error);
+  if (enumerator) {
+	  error = NULL;
+      while ((info = g_file_enumerator_next_file (enumerator, G_VFS_JOB (job)->cancellable, &error)) != NULL) {
+    	  g_print ("  (II) try_enumerate (filename = %s): file '%s' \n", filename, g_file_info_get_attribute_string(info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME));
+    	  g_vfs_job_enumerate_add_info (job, info);
+      }
+	  if (error) {
+		  g_print ("  (EE) try_enumerate: error: %s \n", error->message);
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+	  } else 
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_ENUMERATE);
+	  error = NULL;
+      g_file_enumerator_close (enumerator, G_VFS_JOB (job)->cancellable, &error);
+	  if (error) {
+		  g_print ("  (EE) try_enumerate: g_file_enumerator_close() error: %s \n", error->message);
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+	  } 
+      g_object_unref (enumerator);
+      g_print ("  (II) try_enumerate: success. \n");
+  } else {
+	  if (error) {
+		  g_print ("  (EE) try_enumerate: error: %s \n", error->message);
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+	  } else { 
+		  g_print ("  (EE) try_enumerate: error == NULL \n");
+		  g_vfs_job_failed (G_VFS_JOB (job),
+					G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+					"Error try_enumerate");
+	  }
+  }
+  g_object_unref (file);
+  g_vfs_job_enumerate_done (job);  
+  
+  g_print ("(II) try_enumerate done. \n");
+}
+
+
+static void
+do_query_info (GVfsBackend *backend,
+                GVfsJobQueryInfo *job,
+                const char *filename,
+                GFileQueryInfoFlags flags,
+                GFileInfo *info,
+                GFileAttributeMatcher *matcher)
+{
+  g_print ("(II) try_query_info (filename = %s) \n", filename);
+  
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  GFileInfo *info2 = get_g_file_info_from_local (filename, file, "*", flags, G_VFS_JOB (job));
+
+  if (info2) {
+      g_file_info_copy_into (info2, info);
+      g_object_unref (info2);
+      g_object_unref (file);
+      inject_error (backend, G_VFS_JOB (job), GVFS_JOB_QUERY_INFO);
+      g_print ("(II) try_query_info success. \n");
+  } else
+	  g_print ("(EE) try_query_info failed. \n");
+}
+
+
+static void
+do_query_fs_info (GVfsBackend *backend,
+		  GVfsJobQueryFsInfo *job,
+		  const char *filename,
+		  GFileInfo *info,
+		  GFileAttributeMatcher *attribute_matcher)
+{
+  g_print ("(II) try_query_fs_info (filename = %s) \n", filename);
+
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  GFileInfo *info2;
+  GError *error;
+
+  if (file) {
+	  error = NULL;  
+	  info2 = g_file_query_filesystem_info (file, "fs:*", G_VFS_JOB (job)->cancellable, &error);
+	  if ((error) || (! info2) ) {
+		  g_print ("  (EE) try_query_fs_info (filename = '%s'): g_file_query_filesystem_info failed: %s \n", filename, error->message);
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+	  } else
+	  {
+	      g_file_info_copy_into (info2, info);
+	      g_object_unref (info2);
+	      g_object_unref (file);
+	      inject_error (backend, G_VFS_JOB (job), GVFS_JOB_QUERY_FS_INFO);
+	      g_print ("(II) try_query_fs_info success. \n");
+	  }
+  } else
+	  g_print ("(EE) try_query_fs_info failed. \n");
+}
+
+
+static void
+do_query_settable_attributes (GVfsBackend *backend,
+					     GVfsJobQueryAttributes *job,
+					     const char *filename)
+{
+  g_print ("(II) try_query_settable_attributes (filename = '%s') \n", filename);
+
+  GFileAttributeInfoList *attr_list;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  attr_list = g_file_query_settable_attributes (file, G_VFS_JOB (job)->cancellable, &error);
+	  if ((attr_list) && (! error)) {
+		  g_vfs_job_query_attributes_set_list (job, attr_list);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_QUERY_SETTABLE_ATTRIBUTES);
+		  g_print ("(II) try_query_settable_attributes success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_query_settable_attributes: g_file_query_settable_attributes == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_query_settable_attributes: file == NULL \n");
+}
+
+static void
+do_query_writable_namespaces (GVfsBackend *backend,
+					     GVfsJobQueryAttributes *job,
+					     const char *filename)
+{
+  g_print ("(II) try_query_writable_namespaces (filename = '%s') \n", filename);
+
+  GFileAttributeInfoList *attr_list;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  attr_list = g_file_query_writable_namespaces (file, G_VFS_JOB (job)->cancellable, &error);
+	  if ((attr_list) && (! error)) {
+		  g_vfs_job_query_attributes_set_list (job, attr_list);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_QUERY_WRITABLE_NAMESPACES);
+		  g_print ("(II) try_query_writable_namespaces success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_query_writable_namespaces: g_file_query_writable_namespaces == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_query_writable_namespaces: file == NULL \n");
+}
+
+
+
+
+
+/************************************************
+ * 	  Operations
+ * 
+ */
+
+static void
+do_make_directory (GVfsBackend *backend,
+                    GVfsJobMakeDirectory *job,
+                    const char *filename)
+{
+  g_print ("(II) try_make_directory (filename = %s) \n", filename);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_make_directory (file, G_VFS_JOB (job)->cancellable, &error)) {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_MAKE_DIRECTORY);
+		  g_print ("(II) try_make_directory success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_make_directory: g_file_make_directory == FALSE \n");
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_make_directory: file == NULL \n");
+}
+
+
+static void
+do_delete (GVfsBackend *backend,
+            GVfsJobDelete *job,
+            const char *filename)
+{
+  g_print ("(II) try_delete (filename = %s) \n", filename);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_delete (file, G_VFS_JOB (job)->cancellable, &error)) {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_DELETE);
+		  g_print ("(II) try_delete success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_delete: g_file_delete == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_delete: file == NULL \n");
+}
+
+
+static void
+do_trash (GVfsBackend *backend,
+			GVfsJobTrash *job,
+            const char *filename)
+{
+  g_print ("(II) try_trash (filename = %s) \n", filename);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_trash (file, G_VFS_JOB (job)->cancellable, &error)) {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_TRASH);
+		  g_print ("(II) try_trash success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_trash: g_file_trash == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_trash: file == NULL \n");
+}
+
+
+static void
+do_make_symlink (GVfsBackend *backend,
+                  GVfsJobMakeSymlink *job,
+                  const char *filename,
+                  const char *symlink_value)
+{
+  g_print ("(II) try_make_symlink ('%s' --> '%s') \n", filename, symlink_value);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_make_symbolic_link (file, symlink_value, G_VFS_JOB (job)->cancellable, &error)) {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_MAKE_SYMLINK);
+		  g_print ("(II) try_make_symlink success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_make_symlink: g_file_make_symbolic_link == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_make_symlink: file == NULL \n");
+}
+
+
+static void
+do_copy (GVfsBackend *backend,
+ 		 GVfsJobCopy *job,
+		 const char *source,
+		 const char *destination,
+		 GFileCopyFlags flags,
+		 GFileProgressCallback progress_callback,
+		 gpointer progress_callback_data)
+{
+  g_print ("(II) try_copy '%s' --> '%s' \n", source, destination);
+	  
+  GFile *src_file, *dst_file;
+  GError *error;
+  
+  src_file = get_g_file_from_local (source, G_VFS_JOB (job));
+  dst_file = get_g_file_from_local (destination, G_VFS_JOB (job));
+  g_assert(src_file != NULL);
+
+  if (src_file) {
+	  error = NULL;
+	  if (g_file_copy (src_file, dst_file, flags, G_VFS_JOB (job)->cancellable, 
+			  progress_callback, progress_callback_data, &error)) 
+	  {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_COPY);
+		  g_print ("  (II) try_copy: success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_copy: g_file_copy == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (src_file);
+	  g_object_unref (dst_file);
+  } else 
+	  g_print ("  (EE) try_copy: file == NULL \n");
+}
+
+
+static void
+do_move (GVfsBackend *backend,
+          GVfsJobMove *job,
+          const char *source,
+          const char *destination,
+          GFileCopyFlags flags,
+          GFileProgressCallback progress_callback,
+          gpointer progress_callback_data)
+{
+  g_print ("(II) try_move '%s' --> '%s' \n", source, destination);
+	  
+  GFile *src_file, *dst_file;
+  GError *error;
+  
+  src_file = get_g_file_from_local (source, G_VFS_JOB (job));
+  dst_file = get_g_file_from_local (destination, G_VFS_JOB (job));
+  g_assert(src_file != NULL);
+
+  if (src_file) {
+	  error = NULL;
+	  if (g_file_move (src_file, dst_file, flags, G_VFS_JOB (job)->cancellable, 
+			  progress_callback, progress_callback_data, &error)) 
+	  {
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_MOVE);
+		  g_print ("  (II) try_move: success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_move: g_file_move == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (src_file);
+	  g_object_unref (dst_file);
+  } else 
+	  g_print ("  (EE) try_move: file == NULL \n");
+}
+
+
+//  aka 'rename'
+static void
+do_set_display_name (GVfsBackend *backend,
+                      GVfsJobSetDisplayName *job,
+                      const char *filename,
+                      const char *display_name)
+{
+  g_print ("(II) try_set_display_name '%s' --> '%s' \n", filename, display_name);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_set_display_name (file, display_name, G_VFS_JOB (job)->cancellable, &error)) {
+		  char *dirname, *new_path;
+		  dirname = g_path_get_dirname (filename);
+		  new_path = g_build_filename (dirname, display_name, NULL);
+		  g_print ("(II) try_set_display_name: filename = '%s'... \n", filename);
+		  g_print ("(II) try_set_display_name: display_name = '%s'... \n", display_name);
+		  g_print ("(II) try_set_display_name: dirname = '%s'... \n", dirname);
+		  g_print ("(II) try_set_display_name: new_path = '%s'... \n", new_path);
+	      g_vfs_job_set_display_name_set_new_path (job, new_path);
+		  g_free (dirname);
+		  g_free (new_path);
+
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_SET_DISPLAY_NAME);
+		  g_print ("(II) try_set_display_name success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_set_display_name: g_file_set_display_name == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_set_display_name: file == NULL \n");
+}
+
+
+static void
+do_set_attribute (GVfsBackend *backend,
+		 GVfsJobSetAttribute *set_attribute,
+		 const char *filename,
+		 const char *attribute,
+		 GFileAttributeType type,
+		 gpointer value_p,
+		 GFileQueryInfoFlags flags)
+{
+  g_print ("(II) try_set_attribute (filename = '%s', attribute = '%s') \n", filename, attribute);
+
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (set_attribute));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  if (g_file_set_attribute (file, attribute, type,  value_p, flags, G_VFS_JOB (set_attribute)->cancellable, &error)) {
+		  inject_error (backend, G_VFS_JOB (set_attribute), GVFS_JOB_SET_ATTRIBUTE);
+		  g_print ("(II) try_set_attribute success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (set_attribute), error); 
+		  g_print ("  (EE) try_set_attribute: g_file_set_attribute == FALSE, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_set_attribute: file == NULL \n");
+}
+
+
+
+
+
+
+
+/************************************************
+ * 	  Monitors
+ * 
+ */
+
+//  MonitorProxy has been stolen from gvfsbackendtrash
+typedef struct {
+  GVfsMonitor *vfs_monitor;
+  GObject *monitor;
+  GMountSpec *mount_spec;
+} MonitorProxy;
+
+static void
+monitor_proxy_free (MonitorProxy *proxy)
+{
+  g_print ("(II) monitor_proxy_free \n");
+  g_object_unref (proxy->monitor);
+  g_mount_spec_unref (proxy->mount_spec);
+  g_free (proxy);
+}
+
+static void
+proxy_changed (GFileMonitor* monitor,
+               GFile* file,
+               GFile* other_file,
+               GFileMonitorEvent event_type,
+               MonitorProxy *proxy)
+{
+  GMountSpec *file_spec;
+  char *file_path;
+  GMountSpec *other_file_spec;
+  char *other_file_path;
+
+  file_spec = proxy->mount_spec;
+  file_path = g_file_get_path (file);
+  g_print ("(II) monitor_proxy_changed: file_path = '%s' \n", file_path);
+
+  if (other_file)
+    {
+      other_file_spec = proxy->mount_spec;
+      other_file_path = g_file_get_path (other_file);
+	  g_print ("(II) monitor_proxy_changed: other_file_path == '%s' \n", other_file_path);
+    }
+  else
+    {
+      other_file_spec = NULL;
+      other_file_path = NULL;
+    }
+  
+  g_vfs_monitor_emit_event (proxy->vfs_monitor,
+                            event_type,
+                            file_spec, file_path,
+                            other_file_spec, other_file_path);
+
+  g_free (file_path);
+  g_free (other_file_path);
+}
+
+
+static void
+create_dir_file_monitor (GVfsBackend *backend,
+				      GVfsJobCreateMonitor *job,
+				      const char *filename,
+				      GFileMonitorFlags flags,
+				      const gboolean is_dir_monitor)
+{
+  GVfsBackendLocalTest *op_backend = G_VFS_BACKEND_LOCALTEST (backend);
+
+  GObject *monitor;
+  MonitorProxy *proxy;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+  
+  if (is_dir_monitor) monitor = G_OBJECT(g_file_monitor_directory (file, flags, G_VFS_JOB (job)->cancellable));
+  else monitor = G_OBJECT(g_file_monitor_file (file, flags, G_VFS_JOB (job)->cancellable));
+	  
+  if (monitor)
+    {
+      proxy = g_new0 (MonitorProxy, 1); 
+      proxy->vfs_monitor = g_vfs_monitor_new (g_vfs_backend_get_daemon (backend));
+      proxy->monitor = monitor;
+      proxy->mount_spec = g_mount_spec_ref (op_backend->mount_spec);
+      
+      g_object_set_data_full (G_OBJECT (proxy->vfs_monitor), "monitor-proxy", proxy, (GDestroyNotify) monitor_proxy_free);  //* hmm?
+      g_signal_connect (monitor, "changed", G_CALLBACK (proxy_changed), proxy);
+
+      g_vfs_job_create_monitor_set_obj_path (job, g_vfs_monitor_get_object_path (proxy->vfs_monitor));
+
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_CREATE_DIR_MONITOR);
+	  g_print ("(II) create_dir_file_monitor success. \n");
+    }
+  else
+    {
+	  g_print ("  (EE) create_dir_file_monitor: monitor == NULL \n");
+      g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+                        G_IO_ERROR_NOT_SUPPORTED,
+                        _("Directory notification not supported"));
+    }
+  g_object_unref (file);
+}
+
+
+static void
+do_create_dir_monitor (GVfsBackend *backend,
+				      GVfsJobCreateMonitor *job,
+				      const char *filename,
+				      GFileMonitorFlags flags)
+{
+  g_print ("(II) try_create_dir_monitor (filename = '%s') \n", filename);
+  create_dir_file_monitor (backend, job, filename, flags, TRUE);
+}
+
+
+static void
+do_create_file_monitor (GVfsBackend *backend,
+				      GVfsJobCreateMonitor *job,
+				      const char *filename,
+				      GFileMonitorFlags flags)
+{
+  g_print ("(II) try_create_file_monitor (filename = '%s') \n", filename);
+  create_dir_file_monitor (backend, job, filename, flags, FALSE);
+}
+
+
+
+
+
+
+/************************************************
+ * 	  Read/write/create/close data operations
+ * 
+ */
+
+static void
+do_open_for_read (GVfsBackend *backend,
+                   GVfsJobOpenForRead *job,
+                   const char *filename)
+{
+  g_print ("(II) try_open_for_read (filename = '%s') \n", filename);
+  
+  GFileInputStream *stream;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  stream = g_file_read (file, G_VFS_JOB (job)->cancellable, &error);
+	  if (stream) {
+	      g_vfs_job_open_for_read_set_can_seek (job, g_file_input_stream_can_seek(stream));
+	      g_vfs_job_open_for_read_set_handle (job, stream);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_OPEN_FOR_READ);
+		  g_print ("(II) try_open_for_read success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_open_for_read: stream == NULL, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_open_for_read: file == NULL \n");
+}
+
+
+static void
+do_read (GVfsBackend *backend,
+          GVfsJobRead *job,
+          GVfsBackendHandle _handle,
+          char *buffer,
+          gsize bytes_requested)
+{
+  g_print ("(II) try_read (handle = '%lx', buffer = '%lx', bytes_requested = %ld) \n", 
+		  (long int)_handle, (long int)buffer, (long int)bytes_requested);
+
+  GError *error;
+  GFileInputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  gssize s = g_input_stream_read (G_INPUT_STREAM(stream), buffer, bytes_requested, G_VFS_JOB (job)->cancellable, &error); 
+  if (s >= 0) {
+      g_vfs_job_read_set_size (job, s);
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_READ);
+	  g_print ("(II) try_read success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_read: g_input_stream_read() failed, error: %s \n", error->message);
+  }
+}
+
+
+static void
+do_seek_on_read (GVfsBackend *backend,
+                  GVfsJobSeekRead *job,
+                  GVfsBackendHandle _handle,
+                  goffset    offset,
+                  GSeekType  type)
+{
+  g_print ("(II) try_seek_on_read (handle = '%lx', offset = %ld) \n", (long int)_handle, (long int)offset);
+
+  GError *error;
+  GFileInputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  if (g_file_input_stream_seek (stream, offset, type, G_VFS_JOB (job)->cancellable, &error)) {
+      g_vfs_job_seek_read_set_offset (job, g_file_input_stream_tell(stream));
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_SEEK_ON_READ);
+	  g_print ("(II) try_seek_on_read success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_seek_on_read: g_file_input_stream_seek() failed, error: %s \n", error->message);
+  }
+}
+
+
+static void
+do_close_read (GVfsBackend *backend,
+                GVfsJobCloseRead *job,
+                GVfsBackendHandle _handle)
+{
+  g_print ("(II) try_close_read (handle = '%lx') \n", (long int)_handle);
+
+  GError *error;
+  GFileInputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  if (g_input_stream_close (G_INPUT_STREAM(stream), G_VFS_JOB (job)->cancellable, &error)) {
+	  g_object_unref (stream);
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_CLOSE_READ);
+	  g_print ("(II) try_close_read success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_close_read: g_input_stream_close() failed, error: %s \n", error->message);
+  }
+}
+
+
+static void
+do_append_to (GVfsBackend *backend,
+               GVfsJobOpenForWrite *job,
+               const char *filename,
+               GFileCreateFlags flags)
+{
+  g_print ("(II) try_append_to (filename = %s) \n", filename);
+
+  GFileOutputStream *stream;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  stream = g_file_append_to (file, flags, G_VFS_JOB (job)->cancellable, &error);
+	  if (stream) {
+		  //  Should seek at the end of the file here
+		  if ((g_file_output_stream_seek (stream, 0, G_SEEK_END, G_VFS_JOB (job)->cancellable, &error)) && (! error))
+			  g_vfs_job_open_for_write_set_initial_offset (job, g_file_output_stream_tell(stream));
+		  else
+			  g_print ("  (EE) try_append_to: error during g_file_output_stream_seek(), error: %s \n", error->message);
+
+	      g_vfs_job_open_for_write_set_can_seek (job, g_file_output_stream_can_seek(stream));
+	      g_vfs_job_open_for_write_set_handle (job, stream);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_APPEND_TO);
+
+	      g_print ("(II) try_append_to success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_append_to: stream == NULL, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_append_to: file == NULL \n");
+}
+
+
+static void
+do_create (GVfsBackend *backend,
+            GVfsJobOpenForWrite *job,
+            const char *filename,
+            GFileCreateFlags flags)
+{
+  g_print ("(II) try_create (filename = %s) \n", filename);
+
+  GFileOutputStream *stream;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  stream = g_file_create (file, flags, G_VFS_JOB (job)->cancellable, &error);
+	  if (stream) {
+	      g_vfs_job_open_for_write_set_can_seek (job, g_file_output_stream_can_seek(stream));
+	      g_vfs_job_open_for_write_set_handle (job, stream);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_CREATE);
+		  g_print ("(II) try_create success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_create: stream == NULL, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_create: file == NULL \n");
+}
+
+
+static void
+do_replace (GVfsBackend *backend,
+             GVfsJobOpenForWrite *job,
+             const char *filename,
+             const char *etag,
+             gboolean make_backup,
+             GFileCreateFlags flags)
+{
+  g_print ("(II) try_replace (filename = '%s', etag = '%s') \n", filename, etag);
+
+  GFileOutputStream *stream;
+  GError *error;
+  GFile *file = get_g_file_from_local (filename, G_VFS_JOB (job));
+  g_assert(file != NULL);
+
+  if (file) {
+	  error = NULL;
+	  stream = g_file_replace (file, etag, make_backup, flags, G_VFS_JOB (job)->cancellable, &error);
+	  if (stream) {
+	      g_vfs_job_open_for_write_set_can_seek (job, g_file_output_stream_can_seek(stream));
+	      g_vfs_job_open_for_write_set_handle (job, stream);
+		  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_REPLACE);
+		  g_print ("(II) try_replace success. \n");
+	  } else {
+		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+		  g_print ("  (EE) try_replace: stream == NULL, error: %s \n", error->message);
+	  }
+	  g_object_unref (file);
+  } else
+	  g_print ("  (EE) try_replace: file == NULL \n");
+}
+
+
+static void
+do_write (GVfsBackend *backend,
+           GVfsJobWrite *job,
+           GVfsBackendHandle _handle,
+           char *buffer,
+           gsize buffer_size)
+{
+  g_print ("(II) try_write (handle = '%lx', buffer = '%lx', buffer_size = %ld) \n", 
+		  (long int)_handle, (long int)buffer, (long int)buffer_size);
+
+  GError *error;
+  GFileOutputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  gssize s = g_output_stream_write (G_OUTPUT_STREAM(stream), buffer, buffer_size, G_VFS_JOB (job)->cancellable, &error); 
+  if (s >= 0) {
+	  g_vfs_job_write_set_written_size (job, s);
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_WRITE);
+	  g_print ("(II) try_write success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_write: g_output_stream_write() failed, error: %s \n", error->message);
+  }
+}
+
+
+static void
+do_seek_on_write (GVfsBackend *backend,
+                   GVfsJobSeekWrite *job,
+                   GVfsBackendHandle _handle,
+                   goffset    offset,
+                   GSeekType  type)
+{
+  g_print ("(II) try_seek_on_write (handle = '%lx', offset = %ld) \n", (long int)_handle, (long int)offset);
+
+  GError *error;
+  GFileOutputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  if (g_file_output_stream_seek (stream, offset, type, G_VFS_JOB (job)->cancellable, &error)) {
+	  g_vfs_job_seek_write_set_offset (job, g_file_output_stream_tell(stream));
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_SEEK_ON_WRITE);
+	  g_print ("(II) try_seek_on_write success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_seek_on_write: g_file_output_stream_seek() failed, error: %s \n", error->message);
+  }
+}
+
+
+static void
+do_close_write (GVfsBackend *backend,
+                 GVfsJobCloseWrite *job,
+                 GVfsBackendHandle _handle)
+{
+  g_print ("(II) try_close_write (handle = '%lx') \n", (long int)_handle);
+
+  GError *error;
+  GFileOutputStream *stream = _handle;
+  g_assert(stream != NULL);
+  
+  error = NULL;
+  if (g_output_stream_close (G_OUTPUT_STREAM(stream), G_VFS_JOB (job)->cancellable, &error)) {
+	  g_object_unref (stream);
+	  inject_error (backend, G_VFS_JOB (job), GVFS_JOB_CLOSE_WRITE);
+	  g_print ("(II) try_close_write success. \n");
+  } else  {
+	  g_vfs_job_failed_from_error (G_VFS_JOB (job), error); 
+	  g_print ("  (EE) try_close_write: g_input_stream_close() failed, error: %s \n", error->message);
+  }
+}
+
+
+
+
+
+
+
+
+/************************************************
+ * 	  Class init
+ * 
+ */
+
+
+static void
+g_vfs_backend_localtest_class_init (GVfsBackendLocalTestClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass);
+  
+  gobject_class->finalize = g_vfs_backend_localtest_finalize;
+
+  backend_class->mount = do_mount;
+  backend_class->unmount = do_unmount;
+  backend_class->open_for_read = do_open_for_read;
+  backend_class->read = do_read;
+  backend_class->seek_on_read = do_seek_on_read;
+  backend_class->close_read = do_close_read;
+  backend_class->close_write = do_close_write;
+  backend_class->query_info = do_query_info;
+  backend_class->enumerate = do_enumerate;
+  backend_class->query_fs_info = do_query_fs_info;
+  backend_class->create = do_create;
+  backend_class->append_to = do_append_to;
+  backend_class->replace = do_replace;
+  backend_class->write = do_write;
+  backend_class->seek_on_write = do_seek_on_write;
+  backend_class->copy = do_copy;
+  backend_class->move = do_move;
+  backend_class->make_symlink = do_make_symlink;
+  backend_class->make_directory = do_make_directory;
+  backend_class->delete = do_delete;
+  backend_class->trash = do_trash;
+  backend_class->set_display_name = do_set_display_name;
+  backend_class->set_attribute = do_set_attribute;
+  backend_class->create_dir_monitor = do_create_dir_monitor;
+  backend_class->create_file_monitor = do_create_file_monitor;
+  backend_class->query_settable_attributes = do_query_settable_attributes;
+  backend_class->query_writable_namespaces = do_query_writable_namespaces;
+}

Added: trunk/daemon/gvfsbackendlocaltest.h
==============================================================================
--- (empty file)
+++ trunk/daemon/gvfsbackendlocaltest.h	Thu Jan 10 10:51:45 2008
@@ -0,0 +1,94 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *   Local testing backend wrapping error injection 
+ * 
+ * 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: Tomas Bzatek <tbzatek redhat com>
+ */
+
+#ifndef __G_VFS_BACKEND_LOCALTEST_H__
+#define __G_VFS_BACKEND_LOCALTEST_H__
+
+#include <gvfsbackend.h>
+#include <gmountspec.h>
+
+G_BEGIN_DECLS
+
+#define G_VFS_TYPE_BACKEND_LOCALTEST         (g_vfs_backend_localtest_get_type ())
+#define G_VFS_BACKEND_LOCALTEST(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_BACKEND_LOCALTEST, GVfsBackendLocalTest))
+#define G_VFS_BACKEND_LOCALTEST_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_BACKEND_LOCALTEST, GVfsBackendLocalTestClass))
+#define G_VFS_IS_BACKEND_LOCALTEST(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_BACKEND_LOCALTEST))
+#define G_VFS_IS_BACKEND_LOCALTEST_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_BACKEND_LOCALTEST))
+#define G_VFS_BACKEND_LOCALTEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_BACKEND_LOCALTEST, GVfsBackendLocalTestClass))
+
+typedef struct _GVfsBackendLocalTest        GVfsBackendLocalTest;
+typedef struct _GVfsBackendLocalTestClass   GVfsBackendLocalTestClass;
+
+
+
+typedef enum {
+  GVFS_JOB_UNMOUNT = 1<<0,
+  GVFS_JOB_MOUNT = 1<<1,
+  GVFS_JOB_OPEN_FOR_READ = 1<<2,
+  GVFS_JOB_CLOSE_READ = 1<<3,
+  GVFS_JOB_READ = 1<<4,
+  GVFS_JOB_SEEK_ON_READ = 1<<5,
+  GVFS_JOB_CREATE = 1<<6,
+  GVFS_JOB_APPEND_TO = 1<<7,
+  GVFS_JOB_REPLACE = 1<<8,
+  GVFS_JOB_CLOSE_WRITE = 1<<9,
+  GVFS_JOB_WRITE = 1<<10,
+  GVFS_JOB_SEEK_ON_WRITE = 1<<11,
+  GVFS_JOB_QUERY_INFO = 1<<12,
+  GVFS_JOB_QUERY_FS_INFO = 1<<13,
+  GVFS_JOB_ENUMERATE = 1<<14,
+  GVFS_JOB_SET_DISPLAY_NAME = 1<<15,
+  GVFS_JOB_DELETE = 1<<16,
+  GVFS_JOB_TRASH = 1<<17,
+  GVFS_JOB_MAKE_DIRECTORY = 1<<18,
+  GVFS_JOB_MAKE_SYMLINK = 1<<19,
+  GVFS_JOB_COPY = 1<<20,
+  GVFS_JOB_MOVE = 1<<21,
+  GVFS_JOB_SET_ATTRIBUTE = 1<<22,
+  GVFS_JOB_CREATE_DIR_MONITOR = 1<<23,
+  GVFS_JOB_CREATE_FILE_MONITOR = 1<<24,
+  GVFS_JOB_QUERY_SETTABLE_ATTRIBUTES = 1<<25,
+  GVFS_JOB_QUERY_WRITABLE_NAMESPACES = 1<<26
+} GVfsJobType;
+
+
+
+struct _GVfsBackendLocalTest
+{
+	  GVfsBackend parent_instance;
+	  const gchar *test;
+	  GMountSpec *mount_spec;
+	  int errorneous;
+	  GVfsJobType inject_op_types;
+};
+
+struct _GVfsBackendLocalTestClass
+{
+  GVfsBackendClass parent_class;
+};
+
+GType g_vfs_backend_localtest_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_VFS_BACKEND_LOCALTEST_H__ */

Added: trunk/daemon/localtest.mount.in
==============================================================================
--- (empty file)
+++ trunk/daemon/localtest.mount.in	Thu Jan 10 10:51:45 2008
@@ -0,0 +1,4 @@
+[Mount]
+Type=localtest
+Exec= libexecdir@/gvfsd-localtest
+AutoMount=false



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