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