libgnomevfs2-mythtv/modules/mythtv-method.c
author rosfran
Mon Apr 30 18:54:25 2007 +0100 (2007-04-30)
branchtrunk
changeset 606 45798efca6ef
parent 547 60c1efd70423
child 619 fd06870216b8
permissions -rwxr-xr-x
[svn r612] Optimizations - doesn't need to call all the time the URI functions to see if is a LiveTV, and if it is a local file URI.
     1 /*
     2  * @author Hallyson Melo <hallyson.melo@indt.org.br>
     3  *
     4  * This program is free software; you can redistribute it and/or modify
     5  * it under the terms of the GNU Lesser General Public License as published by
     6  * the Free Software Foundation; either version 2 of the License, or
     7  * (at your option) any later version.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU Lesser General Public License
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  */
    18 
    19 #ifdef HAVE_CONFIG_H
    20 #include <config.h>
    21 #endif
    22 
    23 #include <string.h>
    24 #include <glib.h>
    25 #include <glib/gprintf.h>
    26 #include <glib/gstdio.h>
    27 #include <math.h>
    28 
    29 #include <libgnomevfs/gnome-vfs-module.h>
    30 #include <libgnomevfs/gnome-vfs-utils.h>
    31 
    32 #include <gmyth/gmyth_file.h>
    33 #include <gmyth/gmyth_file_transfer.h>
    34 #include <gmyth/gmyth_file_local.h>
    35 #include <gmyth/gmyth_livetv.h>
    36 #include <gmyth/gmyth_uri.h>
    37 #include <gmyth/gmyth_recorder.h>
    38 #include <gmyth/gmyth_backendinfo.h>
    39 #include <gmyth/gmyth_util.h>
    40 #include <gmyth/gmyth_remote_util.h>
    41 #include <gmyth/gmyth_tvchain.h>
    42 #include <gmyth/gmyth_programinfo.h>
    43 
    44 #define GST_MYTHTV_ID_NUM               1
    45 #define MYTHTV_VERSION_DEFAULT          30
    46 #define MYTHTV_TRANSFER_MAX_WAITS       100
    47 
    48 /* internal GnomeVFS plug-in buffer size ( 120 Kbytes ) */
    49 #define MYTHTV_BUFFER_SIZE                          80*1024
    50 /* internally sized GnomeVFS plug-in buffer ( 4 Kbytes ) */
    51 #define MYTHTV_MAX_VFS_BUFFER_SIZE                  4096
    52 /* maximum number of bytes to be requested to the MythTV backend ( 64 Kbytes ) */
    53 #define MYTHTV_MAX_REQUEST_SIZE                     64*1024
    54 
    55 typedef struct {
    56 	GMythFile *file;
    57 	GMythLiveTV *livetv;
    58     GMythBackendInfo *backend_info;
    59     GMythURI *gmyth_uri;
    60     GMythRecorder *live_recorder;
    61     gboolean started;
    62     gint64 offset;
    63     
    64     gboolean is_livetv; /* it is, or not a Live TV content transfer */
    65     gboolean is_local_file; /* tell if the file is local to the current content transfer */
    66 
    67 	gchar *channel_name;
    68 
    69 	gint mythtv_version;
    70 	gboolean configured;
    71 } MythtvHandle;
    72 
    73 
    74 static GnomeVFSResult do_read (GnomeVFSMethod * method,
    75 			       GnomeVFSMethodHandle * method_handle,
    76 			       gpointer buffer,
    77 			       GnomeVFSFileSize num_bytes,
    78 			       GnomeVFSFileSize * bytes_read,
    79 			       GnomeVFSContext * context);
    80 
    81 static GnomeVFSResult   myth_connection_start   (MythtvHandle * method_handle);
    82 static void             myth_destroy_handle     (MythtvHandle * method_handle);
    83 static GnomeVFSResult   myth_handle_new         (GnomeVFSURI * uri,
    84                                                  MythtvHandle ** method_handle);
    85 static GnomeVFSResult   myth_get_file_info      (MythtvHandle * myth_handle,
    86                                                  GnomeVFSURI * uri,
    87                                                  GnomeVFSFileInfo * info);
    88 
    89 static GnomeVFSResult 
    90 myth_handle_new (GnomeVFSURI * uri,
    91                  MythtvHandle ** method_handle)
    92 {   
    93     gchar *tmp_str1;
    94     gchar *tmp_str2;
    95 
    96     _GNOME_VFS_METHOD_PARAM_CHECK (*method_handle == NULL);
    97     
    98 	if (gnome_vfs_uri_get_host_name (uri) == NULL) {
    99 		return GNOME_VFS_ERROR_INVALID_HOST_NAME;
   100 	}
   101 
   102     *method_handle = g_new0 (MythtvHandle, 1);
   103     (*method_handle)->mythtv_version = MYTHTV_VERSION_DEFAULT;
   104     
   105     (*method_handle)->is_livetv = FALSE;
   106     (*method_handle)->is_local_file = FALSE;
   107         
   108     tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   109     tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   110 
   111     (*method_handle)->backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   112     (*method_handle)->gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   113     g_free (tmp_str1);
   114     g_free (tmp_str2);
   115 
   116     return GNOME_VFS_OK;
   117 }   
   118 
   119 static void
   120 myth_destroy_handle (MythtvHandle * method_handle)
   121 {
   122     //TODO: abort if in tranfer state
   123     
   124     if (method_handle->backend_info != NULL) {
   125         g_object_unref (method_handle->backend_info);
   126         method_handle->backend_info = NULL;
   127     }
   128     
   129     if (method_handle->channel_name != NULL) {
   130         g_free (method_handle->channel_name);
   131         method_handle->channel_name = NULL;
   132     }
   133 
   134     if (method_handle->livetv != NULL) {
   135         g_object_unref (method_handle->livetv);
   136         method_handle->livetv = NULL;
   137     }
   138 
   139     if (method_handle->file != NULL) {
   140         g_object_unref (method_handle->file);
   141         method_handle->file = NULL;
   142     }
   143 
   144     if (method_handle->gmyth_uri != NULL) {
   145         g_object_unref (method_handle->gmyth_uri);
   146         method_handle->gmyth_uri = NULL;
   147     }
   148 
   149     g_free (method_handle);
   150 }
   151 
   152 static GnomeVFSResult
   153 myth_get_file_info (MythtvHandle * myth_handle,
   154                     GnomeVFSURI * uri,
   155                     GnomeVFSFileInfo * info)
   156 {
   157     GMythURI *gmyth_uri;
   158     GMythBackendInfo *backend_info;
   159     
   160     _GNOME_VFS_METHOD_PARAM_CHECK (info != NULL);
   161     
   162 
   163     if (myth_handle == NULL) {
   164         gchar *tmp_str1;
   165         gchar *tmp_str2;
   166         
   167         tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   168         tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   169 
   170         backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   171         gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   172         
   173         g_free (tmp_str1);
   174         g_free (tmp_str2);
   175     } else {
   176         backend_info = g_object_ref (myth_handle->backend_info);
   177         gmyth_uri = g_object_ref (myth_handle->gmyth_uri);
   178     }
   179 
   180     info->valid_fields = 0;
   181 	info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | 
   182         GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | 
   183         GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
   184     
   185 	info->type = GNOME_VFS_FILE_TYPE_REGULAR;
   186     
   187 	/* fixme: get from file extension? */
   188 	info->mime_type = g_strdup ("video/x-nuv");
   189 	info->permissions = GNOME_VFS_PERM_USER_READ | 
   190         GNOME_VFS_PERM_OTHER_READ | 
   191         GNOME_VFS_PERM_GROUP_READ;
   192 
   193    
   194 	info->name = g_strdup (gmyth_uri_get_path (gmyth_uri));
   195 
   196     /* file size for remote files */
   197     if ( ( myth_handle->is_livetv = gmyth_uri_is_livetv (gmyth_uri) ) == FALSE) {
   198         GMythFile *file = NULL;
   199         gboolean ret = FALSE;
   200 
   201         /* Verifies if the file exists */
   202         if (!gmyth_util_file_exists (backend_info, 
   203                     gmyth_uri_get_path (gmyth_uri))) {
   204             g_object_unref (file);
   205             g_object_unref (backend_info);
   206             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   207             return GNOME_VFS_ERROR_NOT_FOUND;
   208 		}
   209 
   210         if ( ( myth_handle->is_local_file = gmyth_uri_is_local_file(gmyth_uri) ) == TRUE )
   211         {
   212           file = GMYTH_FILE( gmyth_file_local_new(backend_info) );
   213           ret = gmyth_file_local_open ( GMYTH_FILE_LOCAL( file ) );
   214         } else {
   215           file = GMYTH_FILE( gmyth_file_transfer_new(backend_info) );
   216           ret = gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(file), gmyth_uri_get_path (gmyth_uri));
   217         }
   218 
   219         if (!ret) {
   220             g_object_unref (file);
   221             g_object_unref (backend_info);
   222             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   223             return GNOME_VFS_ERROR_NOT_FOUND;
   224         }
   225 	
   226 		info->size = gmyth_file_get_filesize (file);
   227         info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
   228 		g_object_unref (file);
   229 	}
   230 
   231     g_object_unref (backend_info);
   232     g_object_unref (gmyth_uri);
   233     
   234     return GNOME_VFS_OK;
   235 }
   236 
   237 static GnomeVFSResult
   238 myth_connection_start (MythtvHandle * method_handle)
   239 {
   240     GnomeVFSResult result = GNOME_VFS_OK;
   241 
   242     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   243     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL);
   244 
   245 	/* Connect to the backend */
   246 	if ( ( method_handle->is_livetv = gmyth_uri_is_livetv (method_handle->gmyth_uri) ) == TRUE) {
   247 		method_handle->livetv = gmyth_livetv_new (method_handle->backend_info);
   248 		method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri);
   249         
   250 		if (method_handle->channel_name != NULL) {
   251 		    if (gmyth_livetv_channel_name_setup (method_handle->livetv, 
   252                     method_handle->channel_name) == FALSE) {
   253                 result = GNOME_VFS_ERROR_INVALID_URI;
   254     			goto error;
   255 			}
   256 		} else if (gmyth_livetv_setup (method_handle->livetv) == FALSE) {
   257                 result = GNOME_VFS_ERROR_INVALID_URI;
   258                 goto error;
   259 		}
   260         
   261 
   262     	method_handle->file = 
   263             GMYTH_FILE( gmyth_livetv_create_file_transfer (method_handle->livetv) );
   264 
   265         if (method_handle->file == NULL) {
   266             result = GNOME_VFS_ERROR_INVALID_URI;
   267     		g_debug ("MythTV FileTransfer is NULL!\n");
   268             goto error;
   269         }
   270 
   271 	    if (!gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(method_handle->file),
   272                                         method_handle->livetv->uri != NULL ? 
   273                                         gmyth_uri_get_path (method_handle->livetv->uri) :
   274                                         method_handle->livetv->proginfo->pathname->str)) {
   275         
   276             g_debug ("Couldn't open MythTV FileTransfer is NULL!\n");
   277             result = GNOME_VFS_ERROR_NOT_OPEN;
   278             goto error;
   279         }
   280     }
   281     else {
   282         gboolean ret = TRUE;
   283 		/* Verifies if the file exists */
   284 		if (!gmyth_util_file_exists (method_handle->backend_info, 
   285                     gmyth_uri_get_path (method_handle->gmyth_uri))) {
   286 
   287             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   288             goto error;
   289 		}
   290         
   291         if ( ( method_handle->is_local_file = gmyth_uri_is_local_file(method_handle->gmyth_uri) ) == TRUE )
   292         {
   293           method_handle->file = GMYTH_FILE( gmyth_file_local_new(method_handle->backend_info) );
   294           ret = gmyth_file_local_open ( GMYTH_FILE_LOCAL( method_handle->file ) );
   295         } else {
   296           method_handle->file = GMYTH_FILE( gmyth_file_transfer_new(method_handle->backend_info) );
   297           ret = gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(method_handle->file), 
   298                   gmyth_uri_get_path (method_handle->gmyth_uri));
   299         }
   300 
   301 		/* sets the Playback monitor connection */
   302 		if (!ret) {
   303 
   304             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   305 		    result = GNOME_VFS_ERROR_NOT_FOUND;
   306             goto error;
   307         }
   308 	} /* if - LiveTV or not? */
   309 
   310 	method_handle->configured = TRUE;    
   311 
   312     if (method_handle->file == NULL) {
   313         result = GNOME_VFS_ERROR_NOT_OPEN;
   314     }
   315 
   316 error:
   317     
   318     return result; 
   319 }
   320 
   321 static GnomeVFSResult
   322 do_open (GnomeVFSMethod * method,
   323 	 GnomeVFSMethodHandle ** method_handle,
   324 	 GnomeVFSURI * uri,
   325 	 GnomeVFSOpenMode mode, GnomeVFSContext * context)
   326 {
   327 	MythtvHandle *myth_handle = NULL;
   328     GnomeVFSResult result = GNOME_VFS_OK;
   329 
   330 	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   331 	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
   332 
   333 	if (mode & GNOME_VFS_OPEN_WRITE) {
   334 		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   335 	}
   336 
   337     result = myth_handle_new (uri, &myth_handle);
   338     if (result != GNOME_VFS_OK) 
   339         return result;
   340 
   341     result = myth_connection_start (myth_handle);
   342     if (result != GNOME_VFS_OK) {
   343         myth_destroy_handle (myth_handle);
   344         myth_handle = NULL;
   345         return result;
   346     }
   347 
   348     *method_handle = (GnomeVFSMethodHandle *) myth_handle;
   349     
   350     return result;
   351 }
   352 
   353 static GnomeVFSResult
   354 do_create (GnomeVFSMethod	 *method,
   355 	   GnomeVFSMethodHandle **method_handle,
   356 	   GnomeVFSURI 		 *uri,
   357 	   GnomeVFSOpenMode 	  mode,
   358 	   gboolean 		  exclusive,
   359 	   guint 		  perm,
   360 	   GnomeVFSContext 	 *context)
   361 {
   362     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   363 }
   364 
   365 static GnomeVFSResult
   366 do_close (GnomeVFSMethod * method,
   367         GnomeVFSMethodHandle * method_handle, 
   368         GnomeVFSContext * context)
   369 {
   370 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   371 
   372     myth_destroy_handle (myth_handle);
   373     
   374 	return GNOME_VFS_OK;
   375 }
   376 
   377 
   378 static GnomeVFSResult
   379 do_read (GnomeVFSMethod * method,
   380 	 GnomeVFSMethodHandle * method_handle,
   381 	 gpointer buffer,
   382 	 GnomeVFSFileSize num_bytes,
   383 	 GnomeVFSFileSize * bytes_read, 
   384          GnomeVFSContext * context)
   385 {
   386     GnomeVFSResult retval = GNOME_VFS_OK;
   387     MythtvHandle *myth_handle;
   388     GMythFileReadResult result;
   389     GByteArray *myth_buffer = g_byte_array_new ();
   390 
   391     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   392 
   393     myth_handle = (MythtvHandle *) method_handle;
   394     if ( myth_handle->is_local_file )
   395         result = gmyth_file_local_read ( GMYTH_FILE_LOCAL(myth_handle->file),
   396                                        myth_buffer,
   397                                        num_bytes, myth_handle->is_livetv );
   398     else
   399         result = gmyth_file_transfer_read ( GMYTH_FILE_TRANSFER(myth_handle->file),
   400                               		   myth_buffer,
   401                              		   num_bytes, myth_handle->is_livetv );
   402 
   403     if (result == GMYTH_FILE_READ_ERROR) {
   404         retval = GNOME_VFS_ERROR_IO;
   405     }
   406 
   407     if (result == GMYTH_FILE_READ_EOF) {
   408         retval = GNOME_VFS_ERROR_EOF;
   409     }
   410 
   411     if (myth_buffer->len > 0) {
   412 	    g_memmove (buffer, myth_buffer->data, myth_buffer->len);
   413         *bytes_read = (GnomeVFSFileSize) myth_buffer->len;
   414         myth_handle->offset += myth_buffer->len;
   415         g_byte_array_free (myth_buffer, TRUE);
   416     } 
   417 
   418 	return retval;
   419 }
   420 
   421 static GnomeVFSResult
   422 do_write (GnomeVFSMethod 	*method,
   423 	  GnomeVFSMethodHandle  *method_handle,
   424 	  gconstpointer 	 buffer,
   425 	  GnomeVFSFileSize 	 num_bytes,
   426 	  GnomeVFSFileSize 	*bytes_written,
   427 	  GnomeVFSContext 	*context)
   428 {
   429     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   430 }
   431 
   432 static GnomeVFSResult
   433 do_seek (GnomeVFSMethod	      *method,
   434 	 GnomeVFSMethodHandle *method_handle,
   435 	 GnomeVFSSeekPosition  whence,
   436 	 GnomeVFSFileOffset    offset,
   437 	 GnomeVFSContext      *context)
   438 {
   439 	MythtvHandle *myth_handle;
   440     //guint64 whence_p = 0;
   441     //gint64 new_offset =0;
   442 
   443      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   444 
   445      myth_handle = (MythtvHandle *) method_handle;    
   446     
   447     g_debug ("seek offset%"G_GINT64_FORMAT" whence %d", offset, whence);
   448 
   449     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   450     /*
   451     if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   452     
   453     switch (whence)
   454     {
   455         case GNOME_VFS_SEEK_START:
   456             whence_p = 0;
   457             break;
   458         case GNOME_VFS_SEEK_CURRENT:
   459             whence_p = myth_handle->offset;
   460             break;
   461         case GNOME_VFS_SEEK_END:
   462             return GNOME_VFS_ERROR_NOT_SUPPORTED;
   463     }
   464     
   465     new_offset = gmyth_file_transfer_seek (myth_handle->file, offset, whence_p);
   466     if (new_offset != 0) {
   467         myth_handle->offset = new_offset;
   468         return GNOME_VFS_OK;
   469     }
   470 
   471     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   472     */
   473 }
   474 
   475 static GnomeVFSResult
   476 do_tell (GnomeVFSMethod       *method,
   477 	 GnomeVFSMethodHandle *method_handle,
   478 	 GnomeVFSFileSize   *offset_return)
   479 {
   480 	MythtvHandle *myth_handle = NULL;
   481     
   482      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   483      
   484     myth_handle = (MythtvHandle *) method_handle;
   485     *offset_return = myth_handle->offset;
   486 
   487     return GNOME_VFS_OK;
   488 }
   489 
   490 static GnomeVFSResult
   491 do_truncate_handle (GnomeVFSMethod *method,
   492 		    GnomeVFSMethodHandle *method_handle,
   493 		    GnomeVFSFileSize where,
   494 		    GnomeVFSContext *context)
   495 {
   496     return GNOME_VFS_ERROR_READ_ONLY;
   497 }
   498 
   499 static GnomeVFSResult
   500 do_open_directory (GnomeVFSMethod 	    *method,
   501 		   GnomeVFSMethodHandle    **method_handle,
   502 		   GnomeVFSURI 		    *uri,
   503 		   GnomeVFSFileInfoOptions   options,
   504 		   GnomeVFSContext 	    *context) 
   505 {
   506     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   507 }
   508 
   509 static GnomeVFSResult
   510 do_close_directory (GnomeVFSMethod 	 *method,
   511 		    GnomeVFSMethodHandle *method_handle,
   512 		    GnomeVFSContext 	 *context) 
   513 {
   514     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   515 }
   516 
   517 static GnomeVFSResult
   518 do_read_directory (GnomeVFSMethod 	*method,
   519        		   GnomeVFSMethodHandle *method_handle,
   520        		   GnomeVFSFileInfo 	*file_info,
   521 		   GnomeVFSContext 	*context)
   522 {
   523     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   524 }
   525 
   526 
   527 static GnomeVFSResult
   528 do_get_file_info (GnomeVFSMethod * method,
   529 		  GnomeVFSURI * uri,
   530 		  GnomeVFSFileInfo * file_info,
   531 		  GnomeVFSFileInfoOptions options,
   532 		  GnomeVFSContext * context)
   533 {
   534     return myth_get_file_info (NULL, uri, file_info);
   535 }
   536 
   537 static GnomeVFSResult
   538 do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   539             			      GnomeVFSMethodHandle 	*method_handle,
   540 			                  GnomeVFSFileInfo 		*file_info,
   541             			      GnomeVFSFileInfoOptions    options,
   542 			                  GnomeVFSContext 		*context)
   543 {
   544 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   545 
   546     return myth_get_file_info (myth_handle, NULL, file_info);
   547 }
   548 
   549 static gboolean
   550 do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   551 {
   552 	return FALSE;
   553 }
   554 
   555 static GnomeVFSResult
   556 do_make_directory (GnomeVFSMethod  *method, 
   557 		            GnomeVFSURI     *uri,
   558                     guint 	    perm, 
   559 		            GnomeVFSContext *context) 
   560 {
   561     return GNOME_VFS_ERROR_READ_ONLY;
   562 }
   563 
   564 static GnomeVFSResult 
   565 do_remove_directory (GnomeVFSMethod  *method, 
   566 		             GnomeVFSURI     *uri, 
   567 		             GnomeVFSContext *context) 
   568 {
   569     return GNOME_VFS_ERROR_READ_ONLY;
   570 }
   571 
   572 static GnomeVFSResult
   573 do_move (GnomeVFSMethod  *method,
   574 	 GnomeVFSURI 	 *old_uri,
   575 	 GnomeVFSURI 	 *new_uri,
   576 	 gboolean         force_replace,
   577 	 GnomeVFSContext *context)
   578 {
   579     return GNOME_VFS_ERROR_READ_ONLY;
   580 }
   581 
   582 static GnomeVFSResult 
   583 do_unlink (GnomeVFSMethod  *method,
   584 	   GnomeVFSURI 	   *uri,
   585 	   GnomeVFSContext *context)
   586 {
   587     return GNOME_VFS_ERROR_READ_ONLY;
   588 }
   589 
   590 static GnomeVFSResult 
   591 do_check_same_fs (GnomeVFSMethod  *method,
   592 		  GnomeVFSURI 	  *a,
   593 		  GnomeVFSURI 	  *b,
   594 		  gboolean 	  *same_fs_return,
   595 		  GnomeVFSContext *context)
   596 {
   597     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   598 }
   599 
   600 static GnomeVFSResult
   601 do_set_file_info (GnomeVFSMethod 		*method,
   602 		  GnomeVFSURI 			*uri,
   603 		  const GnomeVFSFileInfo 	*info,
   604 		  GnomeVFSSetFileInfoMask 	 mask,
   605 		  GnomeVFSContext 		*context)
   606 {
   607     return GNOME_VFS_ERROR_READ_ONLY;
   608 }
   609 
   610 static GnomeVFSResult
   611 do_truncate (GnomeVFSMethod *method,
   612 	     GnomeVFSURI *uri,
   613 	     GnomeVFSFileSize where,
   614 	     GnomeVFSContext *context)
   615 {
   616     return GNOME_VFS_ERROR_READ_ONLY;
   617 }
   618 
   619 static GnomeVFSResult
   620 do_find_directory (GnomeVFSMethod *method,
   621 		   GnomeVFSURI *near_uri,
   622 		   GnomeVFSFindDirectoryKind kind,
   623 		   GnomeVFSURI **result_uri,
   624 		   gboolean create_if_needed,
   625 		   gboolean find_if_needed,
   626 		   guint permissions,
   627 		   GnomeVFSContext *context)
   628 {
   629 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   630 }
   631 
   632 static GnomeVFSResult
   633 do_create_symbolic_link (GnomeVFSMethod *method,
   634 			 GnomeVFSURI *uri,
   635 			 const char *target_reference,
   636 			 GnomeVFSContext *context)
   637 {
   638     return GNOME_VFS_ERROR_READ_ONLY;
   639 }
   640 
   641 static GnomeVFSResult
   642 do_monitor_add (GnomeVFSMethod *method,
   643 		GnomeVFSMethodHandle **method_handle_return,
   644 		GnomeVFSURI *uri,
   645 		GnomeVFSMonitorType monitor_type)
   646 {
   647 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   648 }
   649 
   650 static GnomeVFSResult
   651 do_monitor_cancel (GnomeVFSMethod *method,
   652 		   GnomeVFSMethodHandle *method_handle)
   653 {
   654 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   655 }
   656 
   657 static GnomeVFSResult
   658 do_file_control (GnomeVFSMethod *method,
   659 		 GnomeVFSMethodHandle *method_handle,
   660 		 const char *operation,
   661 		 gpointer operation_data,
   662 		 GnomeVFSContext *context)
   663 {
   664 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   665 }
   666 
   667 static GnomeVFSMethod method = {
   668 	sizeof (GnomeVFSMethod),
   669 	do_open, 
   670 	do_create,
   671 	do_close,
   672 	do_read, 
   673 	do_write,
   674 	do_seek,
   675 	do_tell,
   676 	do_truncate_handle, 
   677 	do_open_directory,
   678 	do_close_directory,
   679 	do_read_directory,
   680 	do_get_file_info,
   681 	do_get_file_info_from_handle,
   682 	do_is_local, 
   683 	do_make_directory, 
   684 	do_remove_directory,
   685 	do_move,
   686 	do_unlink,
   687 	do_check_same_fs,
   688 	do_set_file_info,
   689 	do_truncate, 
   690 	do_find_directory, 
   691 	do_create_symbolic_link,  
   692 	do_monitor_add,  
   693 	do_monitor_cancel,  
   694 	do_file_control 	
   695 };
   696 
   697 
   698 GnomeVFSMethod *
   699 vfs_module_init (const char *method_name, const char *args)
   700 {
   701 	return &method;
   702 }
   703 
   704 void
   705 vfs_module_shutdown (GnomeVFSMethod * method)
   706 {
   707 }