libgnomevfs2-mythtv/modules/mythtv-method.c
author melunko
Wed Apr 11 22:24:39 2007 +0100 (2007-04-11)
branchtrunk
changeset 527 eebe6df8aa11
parent 502 aa932d8bf85b
child 547 60c1efd70423
permissions -rwxr-xr-x
[svn r532] Fixed segmentation fault at program_info_print/debug function
     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 	return retval;
   390 }
   391 
   392 static GnomeVFSResult
   393 do_write (GnomeVFSMethod 	*method,
   394 	  GnomeVFSMethodHandle  *method_handle,
   395 	  gconstpointer 	 buffer,
   396 	  GnomeVFSFileSize 	 num_bytes,
   397 	  GnomeVFSFileSize 	*bytes_written,
   398 	  GnomeVFSContext 	*context)
   399 {
   400     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   401 }
   402 
   403 static GnomeVFSResult
   404 do_seek (GnomeVFSMethod	      *method,
   405 	 GnomeVFSMethodHandle *method_handle,
   406 	 GnomeVFSSeekPosition  whence,
   407 	 GnomeVFSFileOffset    offset,
   408 	 GnomeVFSContext      *context)
   409 {
   410 	MythtvHandle *myth_handle;
   411     //guint64 whence_p = 0;
   412     //gint64 new_offset =0;
   413 
   414      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   415 
   416      myth_handle = (MythtvHandle *) method_handle;    
   417     
   418     g_debug ("seek offset%"G_GINT64_FORMAT" whence %d", offset, whence);
   419 
   420     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   421     /*
   422     if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   423     
   424     switch (whence)
   425     {
   426         case GNOME_VFS_SEEK_START:
   427             whence_p = 0;
   428             break;
   429         case GNOME_VFS_SEEK_CURRENT:
   430             whence_p = myth_handle->offset;
   431             break;
   432         case GNOME_VFS_SEEK_END:
   433             return GNOME_VFS_ERROR_NOT_SUPPORTED;
   434     }
   435     
   436     new_offset = gmyth_file_transfer_seek (myth_handle->file_transfer, offset, whence_p);
   437     if (new_offset != 0) {
   438         myth_handle->offset = new_offset;
   439         return GNOME_VFS_OK;
   440     }
   441 
   442     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   443     */
   444 }
   445 
   446 static GnomeVFSResult
   447 do_tell (GnomeVFSMethod       *method,
   448 	 GnomeVFSMethodHandle *method_handle,
   449 	 GnomeVFSFileSize   *offset_return)
   450 {
   451 	MythtvHandle *myth_handle = NULL;
   452     
   453      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   454      
   455     myth_handle = (MythtvHandle *) method_handle;
   456     *offset_return = myth_handle->offset;
   457 
   458     return GNOME_VFS_OK;
   459 }
   460 
   461 static GnomeVFSResult
   462 do_truncate_handle (GnomeVFSMethod *method,
   463 		    GnomeVFSMethodHandle *method_handle,
   464 		    GnomeVFSFileSize where,
   465 		    GnomeVFSContext *context)
   466 {
   467     return GNOME_VFS_ERROR_READ_ONLY;
   468 }
   469 
   470 static GnomeVFSResult
   471 do_open_directory (GnomeVFSMethod 	    *method,
   472 		   GnomeVFSMethodHandle    **method_handle,
   473 		   GnomeVFSURI 		    *uri,
   474 		   GnomeVFSFileInfoOptions   options,
   475 		   GnomeVFSContext 	    *context) 
   476 {
   477     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   478 }
   479 
   480 static GnomeVFSResult
   481 do_close_directory (GnomeVFSMethod 	 *method,
   482 		    GnomeVFSMethodHandle *method_handle,
   483 		    GnomeVFSContext 	 *context) 
   484 {
   485     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   486 }
   487 
   488 static GnomeVFSResult
   489 do_read_directory (GnomeVFSMethod 	*method,
   490        		   GnomeVFSMethodHandle *method_handle,
   491        		   GnomeVFSFileInfo 	*file_info,
   492 		   GnomeVFSContext 	*context)
   493 {
   494     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   495 }
   496 
   497 
   498 static GnomeVFSResult
   499 do_get_file_info (GnomeVFSMethod * method,
   500 		  GnomeVFSURI * uri,
   501 		  GnomeVFSFileInfo * file_info,
   502 		  GnomeVFSFileInfoOptions options,
   503 		  GnomeVFSContext * context)
   504 {
   505     return myth_get_file_info (NULL, uri, file_info);
   506 }
   507 
   508 static GnomeVFSResult
   509 do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   510             			      GnomeVFSMethodHandle 	*method_handle,
   511 			                  GnomeVFSFileInfo 		*file_info,
   512             			      GnomeVFSFileInfoOptions    options,
   513 			                  GnomeVFSContext 		*context)
   514 {
   515 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   516 
   517     return myth_get_file_info (myth_handle, NULL, file_info);
   518 }
   519 
   520 static gboolean
   521 do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   522 {
   523 	return FALSE;
   524 }
   525 
   526 static GnomeVFSResult
   527 do_make_directory (GnomeVFSMethod  *method, 
   528 		            GnomeVFSURI     *uri,
   529                     guint 	    perm, 
   530 		            GnomeVFSContext *context) 
   531 {
   532     return GNOME_VFS_ERROR_READ_ONLY;
   533 }
   534 
   535 static GnomeVFSResult 
   536 do_remove_directory (GnomeVFSMethod  *method, 
   537 		             GnomeVFSURI     *uri, 
   538 		             GnomeVFSContext *context) 
   539 {
   540     return GNOME_VFS_ERROR_READ_ONLY;
   541 }
   542 
   543 static GnomeVFSResult
   544 do_move (GnomeVFSMethod  *method,
   545 	 GnomeVFSURI 	 *old_uri,
   546 	 GnomeVFSURI 	 *new_uri,
   547 	 gboolean         force_replace,
   548 	 GnomeVFSContext *context)
   549 {
   550     return GNOME_VFS_ERROR_READ_ONLY;
   551 }
   552 
   553 static GnomeVFSResult 
   554 do_unlink (GnomeVFSMethod  *method,
   555 	   GnomeVFSURI 	   *uri,
   556 	   GnomeVFSContext *context)
   557 {
   558     return GNOME_VFS_ERROR_READ_ONLY;
   559 }
   560 
   561 static GnomeVFSResult 
   562 do_check_same_fs (GnomeVFSMethod  *method,
   563 		  GnomeVFSURI 	  *a,
   564 		  GnomeVFSURI 	  *b,
   565 		  gboolean 	  *same_fs_return,
   566 		  GnomeVFSContext *context)
   567 {
   568     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   569 }
   570 
   571 static GnomeVFSResult
   572 do_set_file_info (GnomeVFSMethod 		*method,
   573 		  GnomeVFSURI 			*uri,
   574 		  const GnomeVFSFileInfo 	*info,
   575 		  GnomeVFSSetFileInfoMask 	 mask,
   576 		  GnomeVFSContext 		*context)
   577 {
   578     return GNOME_VFS_ERROR_READ_ONLY;
   579 }
   580 
   581 static GnomeVFSResult
   582 do_truncate (GnomeVFSMethod *method,
   583 	     GnomeVFSURI *uri,
   584 	     GnomeVFSFileSize where,
   585 	     GnomeVFSContext *context)
   586 {
   587     return GNOME_VFS_ERROR_READ_ONLY;
   588 }
   589 
   590 static GnomeVFSResult
   591 do_find_directory (GnomeVFSMethod *method,
   592 		   GnomeVFSURI *near_uri,
   593 		   GnomeVFSFindDirectoryKind kind,
   594 		   GnomeVFSURI **result_uri,
   595 		   gboolean create_if_needed,
   596 		   gboolean find_if_needed,
   597 		   guint permissions,
   598 		   GnomeVFSContext *context)
   599 {
   600 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   601 }
   602 
   603 static GnomeVFSResult
   604 do_create_symbolic_link (GnomeVFSMethod *method,
   605 			 GnomeVFSURI *uri,
   606 			 const char *target_reference,
   607 			 GnomeVFSContext *context)
   608 {
   609     return GNOME_VFS_ERROR_READ_ONLY;
   610 }
   611 
   612 static GnomeVFSResult
   613 do_monitor_add (GnomeVFSMethod *method,
   614 		GnomeVFSMethodHandle **method_handle_return,
   615 		GnomeVFSURI *uri,
   616 		GnomeVFSMonitorType monitor_type)
   617 {
   618 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   619 }
   620 
   621 static GnomeVFSResult
   622 do_monitor_cancel (GnomeVFSMethod *method,
   623 		   GnomeVFSMethodHandle *method_handle)
   624 {
   625 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   626 }
   627 
   628 static GnomeVFSResult
   629 do_file_control (GnomeVFSMethod *method,
   630 		 GnomeVFSMethodHandle *method_handle,
   631 		 const char *operation,
   632 		 gpointer operation_data,
   633 		 GnomeVFSContext *context)
   634 {
   635 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   636 }
   637 
   638 static GnomeVFSMethod method = {
   639 	sizeof (GnomeVFSMethod),
   640 	do_open, 
   641 	do_create,
   642 	do_close,
   643 	do_read, 
   644 	do_write,
   645 	do_seek,
   646 	do_tell,
   647 	do_truncate_handle, 
   648 	do_open_directory,
   649 	do_close_directory,
   650 	do_read_directory,
   651 	do_get_file_info,
   652 	do_get_file_info_from_handle,
   653 	do_is_local, 
   654 	do_make_directory, 
   655 	do_remove_directory,
   656 	do_move,
   657 	do_unlink,
   658 	do_check_same_fs,
   659 	do_set_file_info,
   660 	do_truncate, 
   661 	do_find_directory, 
   662 	do_create_symbolic_link,  
   663 	do_monitor_add,  
   664 	do_monitor_cancel,  
   665 	do_file_control 	
   666 };
   667 
   668 
   669 GnomeVFSMethod *
   670 vfs_module_init (const char *method_name, const char *args)
   671 {
   672 	return &method;
   673 }
   674 
   675 void
   676 vfs_module_shutdown (GnomeVFSMethod * method)
   677 {
   678 }