Index: nfs-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/nfs-method.c,v
retrieving revision 1.10
diff -u -r1.10 nfs-method.c
--- nfs-method.c	29 Nov 2005 16:35:05 -0000	1.10
+++ nfs-method.c	9 Feb 2006 23:00:24 -0000
@@ -30,9 +30,15 @@
 #include <config.h>
 #include "nfs-method.h"
 
+#include <libgen.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <glib.h>
+#include <gconf/gconf-client.h>
+#include <libgnomevfs/gnome-vfs.h>
+#include <libgnomevfs/gnome-vfs-module-callback-module-api.h>
+#include <libgnomevfs/gnome-vfs-standard-callbacks.h>
 #include <libgnomevfs/gnome-vfs-cancellation.h>
 #include <libgnomevfs/gnome-vfs-context.h>
 #include <libgnomevfs/gnome-vfs-method.h>
@@ -52,8 +58,10 @@
 /* this is a work-around for some systems, which define these 
  * symbols without guards
  */
+#if 0
 #undef MIN
 #undef MAX
+#endif
 
 #include <netdb.h>
 #include <rpc/rpc.h>
@@ -67,7 +75,7 @@
 /* how many times to retry a given RPC call */
 #define NFS_RETRY 5
 /* define this for verbose debugging */
-// #define NFS_VERBOSE_DEBUG
+#define NFS_VERBOSE_DEBUG
 
 /* until there's a way to specify this at run time (configuration option)
  * define this at compile time. The run down - use TCP if you're in a bad 
@@ -90,6 +98,56 @@
 				        const char     *args);
 void            vfs_module_shutdown  (GnomeVFSMethod *method);
 
+static NfsFileHandle *
+file_handle_new (char *data)
+{
+	NfsFileHandle *result;
+	result = g_new0 (NfsFileHandle, 1);
+
+	if (data) {
+		result->data = g_strdup (data);
+		result->len = strlen (data);
+		result->pos = 0;
+		result->is_data = 1;
+	} else {
+		result->is_data = 0;
+		result->pos = 0;
+	}
+
+	return result;
+}
+
+static NfsUriType
+nfs_uri_type (GnomeVFSURI *uri)
+{
+	GnomeVFSToplevelURI *toplevel;
+	char *first_slash;
+
+	toplevel = (GnomeVFSToplevelURI *)uri;
+
+	if (toplevel->host_name == NULL || toplevel->host_name[0] == 0) {
+		if (uri->text == NULL ||
+		    uri->text[0] == 0 ||
+		    strcmp (uri->text, "/") == 0) {
+			return NFS_URI_WHOLE_NETWORK;
+		}
+		if (strchr (uri->text + 1, '/')) {
+			return NFS_URI_ERROR;
+		}
+		return NFS_URI_ERROR;
+	}
+	if (uri->text == NULL || uri->text[0] == 0 || strcmp (uri->text, "/") == 0) {
+		return NFS_URI_SERVER;
+	}
+	first_slash = strchr (uri->text + 1, '/');
+	if ( (first_slash == NULL) && (strstr(uri->text,".desktop")!=NULL) ){
+		g_print("NFS: type: SHARE\n");
+		return NFS_URI_SHARE;
+	}
+	g_print("NFS: type: FILE\n");
+	return NFS_URI_SHARE_FILE;
+}
+
 static GnomeVFSResult
 nfs_get_attr(GnomeVFSURI *uri, NfsServerConnection *conn, GnomeVFSFileInfo *info);
 
@@ -107,7 +165,6 @@
 	}
 }
 
-
 /* a wrapper for the RPC function clnt_call. This handles doing a retry on 
  * certain errors, etc. The final argument, `success', should be a pointer 
  * to an integer that will be zero if the call was completely successful. 
@@ -134,7 +191,7 @@
 			/* this error is evil, only way around it is 
 			   to destroy the RPC connection and start over
 			*/
-
+			g_warning("NFS_METHOD: ecomm rpc error\n");
 			/* FIXME
 			 * do something intelligent, don't just fail out
 			 * FIXME
@@ -154,6 +211,7 @@
 			 * something like a lost UDP packet or a cosmic ray :)
 			 */
 			g_print("NFS_METHOD: retrying due to an error (retry_count = %d.\n", retry_count);
+			clnt_perror(clnt, "nfs_clnt_call");
 		} else {
 			/* unknown error probably no point retrying, all bad */
 			g_print("Error fatal, giving up.\n");
@@ -310,8 +368,10 @@
 	diropargs args;
 	diropres res;
 	enum clnt_stat clnt_stat;
-	NfsFileHandle *new = g_malloc(sizeof(struct NfsFileHandle));
 	int retval;
+	NfsFileHandle *new;
+
+	new=file_handle_new(NULL);
 	
 	g_assert(uri != NULL);
 	g_assert(conn != NULL);
@@ -426,14 +486,14 @@
 	/* lock the file handle hash */
 	g_mutex_lock(conn->file_handle_hash_mutex);
 
-	path = g_strdup(gnome_vfs_uri_get_path(uri));
+	path = gnome_vfs_unescape_string( gnome_vfs_uri_get_path(uri), "");
 	nfs_strip_last_slash(path);
 
 	/* now, try and get a file handle for ourselves.. */
 	retval = fhandle_recurse(uri, conn, &f);
 
 	if (!f) {
-		f = g_malloc(sizeof(struct NfsFileHandle));
+		f = file_handle_new(NULL);
 
 		/* this call informs the server we want a mount on the specified 
 		 * export, and gives us a file handle.
@@ -478,6 +538,18 @@
 	return retval;
 }
 
+static char *
+get_computer_data (const char *display_name, const char *uri, const char *host)
+{
+	return g_strdup_printf ("[Desktop Entry]\n"
+			"Encoding=UTF-8\n"
+			"Name=%s on %s\n"
+			"Type=Link\n"
+			"URL=%s\n"
+			"Icon=gnome-fs-server\n",
+			display_name, host, uri);
+}
+
 static GnomeVFSResult
 do_open (GnomeVFSMethod *method,
 	 GnomeVFSMethodHandle **method_handle,
@@ -487,16 +559,71 @@
 
 {
 	GnomeVFSResult result;
-	NfsOpenHandle *handle = g_new(NfsOpenHandle, 1);
+	char *first_slash;
+	NfsOpenHandle *handle;
+	NfsUriType type;
+
+	g_print("NFS: open (%s)\n", gnome_vfs_uri_to_string(uri,0));
 
 	if ((mode != GNOME_VFS_OPEN_READ) && (mode != GNOME_VFS_OPEN_WRITE)) {
 		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
 	}
+
+	type = nfs_uri_type (uri);
+
+	if (type == NFS_URI_ERROR) {
+		g_warning("NFS: invalid uri\n");
+		return GNOME_VFS_ERROR_INVALID_URI;
+	}
+	
+	if (type == NFS_URI_WHOLE_NETWORK) {
+		g_warning("NFS: can't browse for nfs shares\n");
+		return GNOME_VFS_ERROR_IS_DIRECTORY;
+	}
+
+	if (type == NFS_URI_SHARE ) {
+		char *name, *filename;
+		char *s;
+
+		g_print("NFS: creating fake share file\n");
+		if (mode & GNOME_VFS_OPEN_WRITE) {
+			return GNOME_VFS_ERROR_READ_ONLY;
+		}
+
+		name = gnome_vfs_uri_extract_short_path_name (uri);
+		filename = gnome_vfs_unescape_string(name, "");
+		g_free(name);
+
+		while ((s=strchr(filename,'@'))!=NULL)
+			*s='/';
+
+		s=strstr(filename,".desktop");
+		*s=0;
+
+		name = g_strdup_printf("nfs://%s%s/",gnome_vfs_uri_get_host_name(uri),filename);
+
+		g_print("NFS: %s", name);
+
+		handle = g_new(NfsOpenHandle, 1);
+		handle->handle = file_handle_new(get_computer_data (filename, name, gnome_vfs_uri_get_host_name(uri)));
+		
+		*method_handle = (GnomeVFSMethodHandle *)handle;
+
+		g_free(name);
+		g_free(filename);
+
+		g_print("NFS: done");
+		
+		return GNOME_VFS_OK;
+	}
+
+	handle = g_new(NfsOpenHandle, 1);
 	
 	result = server_connection_acquire(uri, &handle->conn);
 	if (result != GNOME_VFS_OK) {
 		goto error;
 	}
+
 	result = fhandle_acquire(uri, handle->conn, &handle->handle);
 	if (result != GNOME_VFS_OK) {	
 		goto error;
@@ -516,6 +643,7 @@
 	if (result == GNOME_VFS_OK) {
 		*method_handle = (GnomeVFSMethodHandle *)handle;
 	} else {
+		g_print("NFS: open failed\n");
 		*method_handle = NULL;
 		g_free(handle);
 	}
@@ -535,7 +663,7 @@
 	diropres res;
 	enum clnt_stat clnt_stat;
 
-	g_print("NFS_METHOD: nfs_create -- %s\n", gnome_vfs_uri_get_path(uri));
+	g_print("NFS: nfs_create -- %s\n", gnome_vfs_uri_get_path(uri));
 	memcpy(c.where.dir.data, fh->handle.data, NFS_FHSIZE * sizeof(char));
 	c.where.name = g_strdup(gnome_vfs_uri_extract_short_path_name (uri));
 	c.attributes.mode = perm;
@@ -545,7 +673,7 @@
 	gettimeofday((struct timeval *)&c.attributes.atime, (struct timezone *)NULL);
 	gettimeofday((struct timeval *)&c.attributes.mtime, (struct timezone *)NULL);
 	
-	g_print("NFS_METHOD: Creating file: %s\n", c.where.name);
+	g_print("NFS: Creating file: %s\n", c.where.name);
 
 	g_mutex_lock(conn->nfs_sock_mutex);
 	if ((clnt_stat = nfs_clnt_call(conn->nfs_client, NFSPROC_CREATE,
@@ -562,11 +690,11 @@
 	g_mutex_unlock(conn->nfs_sock_mutex);
 
 	if(res.status != 0) {
-		g_print("NFS_METHOD: create error... %s\n", strerror(res.status));
+		g_print("NFS: create error... %s\n", strerror(res.status));
 		result = gnome_vfs_result_from_errno_code(res.status);
 		goto error;
 	}
-	g_print("NFS_METHOD: File created!\n");
+	g_print("NFS: File created!\n");
 	result = GNOME_VFS_OK;
 
 error:
@@ -594,6 +722,8 @@
 		result = GNOME_VFS_ERROR_INVALID_OPEN_MODE;
 		goto error;
 	}
+
+	g_print("NFS: create (%s)\n", gnome_vfs_uri_to_string(uri,0));
 	
 	result = server_connection_acquire(uri, &handle->conn);
 	if (result != GNOME_VFS_OK) {
@@ -639,6 +769,8 @@
 	handle = (NfsOpenHandle *)method_handle;
 	g_free(handle);
 
+	g_print("NFS: close\n");
+
 	return GNOME_VFS_OK;
 }
 
@@ -659,11 +791,29 @@
 	readokres o;
 	fattr f;
 
-
 	h = (NfsOpenHandle *)method_handle;
 
+	g_print("NFS: read\n");
+
+	if (h->handle->is_data==1) {
+		int read_len;
+		*bytes_read = 0;
+		
+		if (h->handle->pos >= h->handle->len) {
+			return GNOME_VFS_ERROR_EOF;
+		}
+		
+		read_len = MIN (num_bytes, h->handle->len - h->handle->pos);
+		
+		memcpy (buffer, h->handle->data + h->handle->pos, read_len);
+		*bytes_read = read_len;
+		h->handle->pos += read_len;
+	
+		return GNOME_VFS_OK;
+	}
+
 #ifdef NFS_VERBOSE_DEBUG
-	g_print("NFS_METHOD: do_read %s at offset %d (%lld bytes)\n", 
+	g_print("NFS: do_read %s at offset %d (%lld bytes)\n", 
 			gnome_vfs_uri_to_string(h->uri, 0), 
 			h->position, 
 			(unsigned long long)num_bytes);
@@ -687,7 +837,7 @@
 	}
 	g_mutex_unlock(h->conn->nfs_sock_mutex);
 	if (res.status) {
-		g_print("NFS_METHOD: read error: %s\n", strerror(res.status));
+		g_print("NFS: read error: %s\n", strerror(res.status));
 		result = gnome_vfs_result_from_errno_code(res.status);
 		goto error;
 	}
@@ -711,7 +861,7 @@
 		free(o.data.data_val);
 	}
 #ifdef NFS_VERBOSE_DEBUG
-	g_print("NFS_METHOD: do_read %s complete (%lld bytes read)\n", 
+	g_print("NFS: do_read %s complete (%lld bytes read)\n", 
 			gnome_vfs_uri_to_string(h->uri, 0), 
 			(unsigned long long)*bytes_read);
 #endif
@@ -728,6 +878,7 @@
 
 
 {
+	g_print("NFS: write\n");
 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
 }
 
@@ -785,7 +936,7 @@
 static GnomeVFSResult
 do_tell (GnomeVFSMethod *method,
 	 GnomeVFSMethodHandle *method_handle,
-	 GnomeVFSFileOffset *offset_return)
+	 GnomeVFSFileSize *offset_return)
 
 
 {
@@ -813,10 +964,10 @@
 	     GnomeVFSContext *context)
 
 {
+	g_print("NFS_METHOD: truncate\n");
 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
 }
 
-#if 0
 static GnomeVFSResult 
 nfs_export_list(GnomeVFSURI *uri, 
 		GList **exportlist) 
@@ -824,10 +975,11 @@
 	CLIENT *client;
 	struct timeval timeval = { NFS_TIMEOUT, 0 };
 	char *argp;
+	nfsstat s;
 	exports e;
 	groups g;
 
-	printf("NFS export list called.\n");
+	g_print("NFS: get export list from host: %s\n", gnome_vfs_uri_get_host_name(uri));
 
 	client = clnt_create(gnome_vfs_uri_get_host_name(uri), 
 			MOUNTPROG, MOUNTVERS, "udp");
@@ -839,13 +991,16 @@
 	memset(&e, 0, sizeof(e));
 	if (nfs_clnt_call(client, MOUNTPROC_EXPORT, 
 		(xdrproc_t)xdr_void, (char *)&argp, 
-		(xdrproc_t)xdr_exports, (char *)&e, timeval, NULL) != RPC_SUCCESS) {
+		(xdrproc_t)xdr_exports, (char *)&e, timeval, &s) != RPC_SUCCESS) {
+		clnt_perror(client, "export");
 		return GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
 	}
 	while (e != NULL) {
 		GnomeVFSFileInfo *info = gnome_vfs_file_info_new();
 		char *name;
-		const char *basename;
+		char *basename;
+		char *s;
+
 		basename = gnome_vfs_uri_extract_short_path_name (uri);
 		if (basename[0]=='/' && basename[1]) {
 			name = e->ex_dir+1;
@@ -854,20 +1009,26 @@
 		}
 		g_free (basename);
 
-		info->name = g_strdup(name);
-		info->mime_type = g_strdup("x-directory/normal");
-		info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
-		info->flags = GNOME_VFS_FILE_FLAGS_SYMLINK;
-		info->symlink_name = g_strdup(name);
-		info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE |
-			GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE |
-			GNOME_VFS_FILE_INFO_FIELDS_FLAGS |
-			GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME;
-		g_print("NFS_METHOD: got: %s (%s) ", e->ex_dir, name);
+		while ((s=strchr(name,'/'))!=NULL)
+			*s='@';
+
+		info->name = g_strdup_printf("%s.desktop", name);
+		info->mime_type = g_strdup("application/x-desktop");
+		info->type = GNOME_VFS_FILE_TYPE_REGULAR;
+
+		info->permissions = GNOME_VFS_PERM_USER_READ |
+			GNOME_VFS_PERM_OTHER_READ |
+			GNOME_VFS_PERM_GROUP_READ;
+
+		info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | 
+			GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | 
+			GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
+
+		g_print("NFS: %s (%s) ", e->ex_dir, name);
 		g = e->ex_groups;
 		while (g != NULL) {
 			/* TODO guess permissions */
-			g_print("NFS_METHOD: %s ", g->gr_name);
+			g_print("NFS: %s ", g->gr_name);
 			g = g->gr_next;
 		}
 		e = e->ex_next;
@@ -875,11 +1036,10 @@
 
 		*exportlist = g_list_append(*exportlist, info);
 	}
-	printf("NFS_METHOD: And returned.\n");
+	g_print("NFS: returned.\n");
 
 	return GNOME_VFS_OK;
 }
-#endif 
 
 static GnomeVFSResult
 nfs_attr_to_file_info(fattr f, GnomeVFSFileInfo *info)
@@ -965,7 +1125,7 @@
 	}
 	g_mutex_unlock(conn->nfs_sock_mutex);
 	if (a.status) {
-		g_print("NFS_METHOD: getattr error - %s\n", strerror(a.status));
+		g_print("NFS: getattr error - %s\n", strerror(a.status));
 		result = gnome_vfs_result_from_errno_code(a.status);
 		goto error;
 	}
@@ -999,7 +1159,7 @@
 	g_mutex_unlock(conn->nfs_sock_mutex);
 
 	if (res.status) {
-		g_print("NFS_METHOD: lookup error - %s\n", strerror(res.status));
+		g_print("NFS: lookup error - %s\n", strerror(res.status));
 		result = gnome_vfs_result_from_errno_code(res.status);
 		goto error;
 	}
@@ -1140,14 +1300,14 @@
 					       conn->nfs_timeval, 
 					       &rdres->status)) != RPC_SUCCESS) {
 			clnt_perror(conn->nfs_client, "readdir");
-			g_print("NFS_METHOD: %d - bailing\n", clnt_stat);
+			g_print("NFS: %d - bailing\n", clnt_stat);
 			result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
 			g_mutex_unlock(conn->nfs_sock_mutex);
 			goto error;
 		}
 		g_mutex_unlock(conn->nfs_sock_mutex);
 		if(rdres->status != 0) {
-			g_print("NFS_METHOD: readdir error... %s\n", strerror(rdres->status));
+			g_print("NFS: readdir error... %s\n", strerror(rdres->status));
 			result = gnome_vfs_result_from_errno_code(rdres->status);
 			goto error;
 		}
@@ -1202,26 +1362,50 @@
 		   GnomeVFSMethodHandle **method_handle,
 		   GnomeVFSURI *uri,
 		   GnomeVFSFileInfoOptions options,
-		   const GnomeVFSDirectoryFilter *filter,
 		   GnomeVFSContext *context)
 
+
 {
 	NfsServerConnection *conn;
 	NfsFileHandle *f;
        	GnomeVFSResult result;
 	NfsDirectoryHandle *handle = g_new(NfsDirectoryHandle, 1);
 
+	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
+	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
+
 	handle->files = NULL;
 
+	g_print("NFS: open_dir (%s)\n", gnome_vfs_uri_to_string(uri,0));
+	g_print("NFS: uri (%s)\n", uri->text);
+
+#if 0
+	if (strcmp (uri->text, "") != 0 &&
+	    strcmp (uri->text, "/") != 0) {
+		return GNOME_VFS_ERROR_NOT_A_DIRECTORY;
+	}
+#endif
+
+	g_print("NFS: connecting\n");
 	result = server_connection_acquire(uri, &conn);
 	if (result != GNOME_VFS_OK) goto error;
-	result = fhandle_acquire(uri, conn, &f);
-	if (result != GNOME_VFS_OK) goto error;
 
-	result = nfs_file_list(conn, f, &handle->files);
-	if (result != GNOME_VFS_OK) goto error;
+	if ( uri->text == NULL || uri->text[0]==0 || (strcmp(uri->text,"/")==0) ) {
+		g_print("NFS: reading export list from server\n");
+		result = nfs_export_list(uri, &handle->files);
+		if (result != GNOME_VFS_OK) goto error;
+	} else {
+		g_print("NFS: get filelist\n");
 
-	result = GNOME_VFS_OK;
+		result = fhandle_acquire(uri, conn, &f);
+		if (result != GNOME_VFS_OK) goto error;
+
+		result = nfs_file_list(conn, f, &handle->files);
+		if (result != GNOME_VFS_OK) goto error;
+
+		result = GNOME_VFS_OK;
+		g_print("NFS: open_dir ok\n");
+	}
 
 error:	
 	if (result != GNOME_VFS_OK) {
@@ -1262,9 +1446,9 @@
 		handle->pointer = handle->pointer->next;
 
 		if (file_info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {
-			printf("symbollic link debug: %s\n", file_info->symlink_name);
+			g_print("Symbollic link debug: %s\n", file_info->symlink_name);
 		} else {
-//			printf("Not a symlink: %s\n", file_info->name);
+//			g_print("Not a symlink: %s\n", file_info->name);
 		}
 
 		return GNOME_VFS_OK;
@@ -1282,8 +1466,36 @@
 
 {
 	GnomeVFSResult result;
+	NfsUriType type;
 
-	if (uri->text == NULL || uri->text[0] == '\0') {
+	g_print("NFS: get_file_info (%s)\n", gnome_vfs_uri_to_string(uri,0));
+
+	type = nfs_uri_type (uri);
+
+	if (type == NFS_URI_ERROR) {
+		g_warning("NFS: invalid uri\n");
+		return GNOME_VFS_ERROR_INVALID_URI;
+	}
+	
+	if (type == NFS_URI_WHOLE_NETWORK) {
+		return GNOME_VFS_ERROR_IS_DIRECTORY;
+	}
+
+	if (type == NFS_URI_SHARE) {
+		file_info->mime_type = g_strdup ("application/x-desktop");
+		file_info->type = GNOME_VFS_FILE_TYPE_REGULAR;
+		file_info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE |
+			GNOME_VFS_FILE_INFO_FIELDS_TYPE;
+		
+		file_info->permissions = GNOME_VFS_PERM_USER_READ |
+			GNOME_VFS_PERM_OTHER_READ |
+			GNOME_VFS_PERM_GROUP_READ;
+		file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
+		
+		return GNOME_VFS_OK;
+	}
+
+	if (type == NFS_URI_SERVER) {
 		file_info->name = g_strdup(gnome_vfs_uri_get_host_name(uri));
 		file_info->mime_type = g_strdup("x-directory/normal");
 		file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
@@ -1327,6 +1539,8 @@
 	NfsOpenHandle *h = (NfsOpenHandle *)method_handle;
 	GnomeVFSResult result;
 
+	g_print("NFS: get_file_info_from_handle (%s)\n", gnome_vfs_uri_to_string(h->uri,0));
+
 	result = server_connection_acquire(h->uri, &conn);
 	if (result == GNOME_VFS_OK) return result;
 
@@ -1345,7 +1559,7 @@
 		file_info->valid_fields |= 
 			GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
 	}
-	g_print("NFS_METHOD: get_file_info worked...\n");
+	g_print("NFS: get_file_info worked...\n");
 	return GNOME_VFS_OK;
 }
 
@@ -1375,7 +1589,7 @@
 	c.attributes.mode = perm;
 	c.attributes.uid = getuid();
 	c.attributes.gid = getgid();
-	printf("creating directory with uid, gid = %d, %d\n", c.attributes.uid, c.attributes.gid);
+	g_print("creating directory with uid, gid = %d, %d\n", c.attributes.uid, c.attributes.gid);
 	c.attributes.size = -1;
 	gettimeofday((struct timeval *)&c.attributes.atime, (struct timezone *)NULL);
 	gettimeofday((struct timeval *)&c.attributes.mtime, (struct timezone *)NULL);
@@ -1395,12 +1609,12 @@
 	g_free(c.where.name);
 	if (res.status != 0) {
 		g_free (c.where.name);
-		g_print("NFS_METHOD: mkdir error... %s\n", strerror(res.status));
+		g_print("NFS: mkdir error... %s\n", strerror(res.status));
 		result = gnome_vfs_result_from_errno_code(res.status);
 		goto error;
 	}
 	g_free (c.where.name);
-	g_print("NFS_METHOD: Directory created! (%d, %d)\n", res.diropres_u.diropres.attributes.uid, res.diropres_u.diropres.attributes.gid);
+	g_print("NFS: Directory created! (%d, %d)\n", res.diropres_u.diropres.attributes.uid, res.diropres_u.diropres.attributes.gid);
 
 	result = GNOME_VFS_OK;
 
@@ -1418,7 +1632,7 @@
 	GnomeVFSResult result;
 	GnomeVFSURI *parent;
 
-	g_print("NFS_METHOD: make directory(%s)\n", gnome_vfs_uri_to_string(uri,0));
+	g_print("NFS: make directory(%s)\n", gnome_vfs_uri_to_string(uri,0));
 	if (uri->text == NULL || uri->text[0] == '\0') {
 		/* remove the root? */
 		return GNOME_VFS_ERROR_GENERIC;
@@ -1439,7 +1653,7 @@
 		result = nfs_mkdir(uri, conn, fh, perm);
 		if (result != GNOME_VFS_OK) return result;
 
-		g_print("NFS_METHOD: mkdir worked...\n");
+		g_print("NFS: mkdir worked...\n");
 		return GNOME_VFS_OK;
 	}
 }
@@ -1471,11 +1685,11 @@
 	g_mutex_unlock(conn->nfs_sock_mutex);
 	g_free (d.name);
 	if(s != 0) {
-		g_print("NFS_METHOD: rmdir error... %s\n", strerror(s));
+		g_print("NFS: rmdir error... %s\n", strerror(s));
 		result = gnome_vfs_result_from_errno_code(s);
 		goto error;
 	}
-	g_print("NFS_METHOD: Directory removed!\n");
+	g_print("NFS: Directory removed!\n");
 	result = GNOME_VFS_OK;
 error:
 	return result;
@@ -1489,7 +1703,7 @@
 	GnomeVFSResult result;
 	GnomeVFSURI *parent;
 
-	g_print("NFS_METHOD: remove directory(%s)\n", gnome_vfs_uri_to_string(uri,0));
+	g_print("NFS: remove directory(%s)\n", gnome_vfs_uri_to_string(uri,0));
 	if (uri->text == NULL || uri->text[0] == '\0') {
 		/* remove the root? */
 		return GNOME_VFS_ERROR_GENERIC;
@@ -1510,7 +1724,7 @@
 		result = nfs_rmdir(uri, conn, fh);
 		if (result != GNOME_VFS_OK) return result;
 
-		g_print("NFS_METHOD: rmdir worked...\n");
+		g_print("NFS: rmdir worked...\n");
 		return GNOME_VFS_OK;
 	}
 }
@@ -1554,9 +1768,9 @@
 	}
 	g_free (d.name);
 	g_mutex_unlock(conn->nfs_sock_mutex);
-	g_print("NFS_METHOD: status = %d\n", s);
+	g_print("NFS: status = %d\n", s);
 	if(s != 0) {
-		g_print("NFS_METHOD: remove error... %s\n", strerror(s));
+		g_print("NFS: remove error... %s\n", strerror(s));
 		result = gnome_vfs_result_from_errno_code(s);
 		goto error;
 	}
@@ -1574,7 +1788,7 @@
 	GnomeVFSResult result;
 	GnomeVFSURI *parent;
 
-	g_print("NFS_METHOD: remove file(%s)\n", gnome_vfs_uri_to_string(uri,0));
+	g_print("NFS: remove file(%s)\n", gnome_vfs_uri_to_string(uri,0));
 	if (uri->text == NULL || uri->text[0] == '\0') {
 		/* remove the root? */
 		return GNOME_VFS_ERROR_GENERIC;
@@ -1595,7 +1809,7 @@
 		result = nfs_unlink(uri, conn, f);
 		if (result != GNOME_VFS_OK) return result;
 
-		g_print("NFS_METHOD: unlink worked...\n");
+		g_print("NFS: unlink worked...\n");
 		return GNOME_VFS_OK;
 	}
 }
@@ -1628,13 +1842,13 @@
 		goto error;
 	}
 	g_mutex_unlock(from_conn->nfs_sock_mutex);
-	g_print("NFS_METHOD: status = %d\n", s);
+	g_print("NFS: status = %d\n", s);
 	if(s != 0) {
-		g_print("NFS_METHOD: mkdir error... %s\n", strerror(s));
+		g_print("NFS: mkdir error... %s\n", strerror(s));
 		result = gnome_vfs_result_from_errno_code(s);
 		goto error;
 	}
-	g_print("NFS_METHOD: File moved!\n");
+	g_print("NFS: File moved!\n");
 
 	result = GNOME_VFS_OK;
 error:
@@ -1653,7 +1867,7 @@
 	GnomeVFSURI *from_parent, *to_parent;
 
 
-	g_print("NFS_METHOD: move file(%s) to (%s)\n", gnome_vfs_uri_to_string(old_uri,0), 
+	g_print("NFS: move file(%s) to (%s)\n", gnome_vfs_uri_to_string(old_uri,0), 
 		gnome_vfs_uri_to_string(new_uri,0));
 	if ((new_uri->text == NULL || new_uri->text[0] == '\0')
 		|| (old_uri->text == NULL || old_uri->text[0] == '\0')) {
@@ -1686,7 +1900,7 @@
 		result = nfs_rename(old_uri, new_uri, from_conn, to_conn, from_handle, to_handle);
 		if (result != GNOME_VFS_OK) return result;
 
-		g_print("NFS_METHOD: move worked...\n");
+		g_print("NFS: move worked...\n");
 		return GNOME_VFS_OK;
 	}
 }
@@ -1785,7 +1999,7 @@
 	GList *next;
 	NfsServerConnection *c;
 
-	printf("<-- module shutdown called -->\n");
+	g_print("<-- module shutdown called -->\n");
 	next = server_connection_list;
 	while (next) {
 		c = (NfsServerConnection *)next->data;
@@ -1804,5 +2018,3 @@
 		g_free(c);
 	}
 }
-
-
