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