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