Browse Source

VFS: (vfs_s_subclass): make the derived class from vfs_class.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 8 years ago
parent
commit
5d1284c4a6
10 changed files with 153 additions and 140 deletions
  1. 3 2
      lib/utilunix.c
  2. 16 14
      lib/vfs/direntry.c
  3. 1 1
      lib/vfs/path.c
  4. 0 1
      lib/vfs/vfs.h
  5. 6 4
      lib/vfs/xdirentry.h
  6. 11 12
      src/vfs/cpio/cpio.c
  7. 41 35
      src/vfs/extfs/extfs.c
  8. 23 24
      src/vfs/fish/fish.c
  9. 20 21
      src/vfs/ftpfs/ftpfs.c
  10. 32 26
      src/vfs/sfs/sfs.c

+ 3 - 2
lib/utilunix.c

@@ -980,8 +980,9 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
 
                     if (vclass != NULL)
                     {
-                        struct vfs_s_subclass *sub = (struct vfs_s_subclass *) vclass->data;
-                        if (sub != NULL && sub->flags & VFS_S_REMOTE)
+                        struct vfs_s_subclass *sub = (struct vfs_s_subclass *) vclass;
+
+                        if ((sub->flags & VFS_S_REMOTE) != 0)
                         {
                             s = vfs_prefix;
                             continue;

+ 16 - 14
lib/vfs/direntry.c

@@ -785,10 +785,10 @@ vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
             return 1;
         }
     case VFS_SETCTL_LOGFILE:
-        ((struct vfs_s_subclass *) path_element->class->data)->logfile = fopen ((char *) arg, "w");
+        VFS_SUBCLASS (path_element)->logfile = fopen ((char *) arg, "w");
         return 1;
     case VFS_SETCTL_FLUSH:
-        ((struct vfs_s_subclass *) path_element->class->data)->flush = 1;
+        VFS_SUBCLASS (path_element)->flush = 1;
         return 1;
     default:
         return 0;
@@ -1075,9 +1075,7 @@ vfs_get_super_by_vpath (const vfs_path_t * vpath)
     vfs_path_t *vpath_archive;
 
     path_element = vfs_path_get_by_index (vpath, -1);
-    subclass = (struct vfs_s_subclass *) path_element->class->data;
-    if (subclass == NULL)
-        return NULL;
+    subclass = VFS_SUBCLASS (path_element);
 
     vpath_archive = vfs_path_clone (vpath);
     vfs_path_remove_element_by_index (vpath_archive, -1);
@@ -1089,6 +1087,9 @@ vfs_get_super_by_vpath (const vfs_path_t * vpath)
             goto ret;
     }
 
+    if (subclass->archive_same == NULL)
+        goto ret;
+
     for (iter = subclass->supers; iter != NULL; iter = g_list_next (iter))
     {
         int i;
@@ -1145,8 +1146,8 @@ vfs_s_get_path (const vfs_path_t * vpath, struct vfs_s_super **archive, int flag
     }
 
     super = vfs_s_new_super (path_element->class);
+    subclass = VFS_SUBCLASS (path_element);
 
-    subclass = (struct vfs_s_subclass *) path_element->class->data;
     if (subclass->open_archive != NULL)
     {
         vfs_path_t *vpath_archive;
@@ -1237,6 +1238,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
     const char *q;
     struct vfs_s_inode *ino;
     const vfs_path_element_t *path_element;
+    struct vfs_s_subclass *s;
 
     path_element = vfs_path_get_by_index (vpath, -1);
 
@@ -1250,6 +1252,8 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
         return NULL;
     }
 
+    s = VFS_SUBCLASS (path_element);
+
     if (ino == NULL)
     {
         char *dirname, *name;
@@ -1273,7 +1277,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
         ent = vfs_s_generate_entry (path_element->class, name, dir, 0755);
         ino = ent->ino;
         vfs_s_insert_entry (path_element->class, dir, ent);
-        if ((VFSDATA (path_element)->flags & VFS_S_USETMP) != 0)
+        if ((s->flags & VFS_S_USETMP) != 0)
         {
             int tmp_handle;
             vfs_path_t *tmp_vpath;
@@ -1311,7 +1315,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
 
     if (IS_LINEAR (flags))
     {
-        if (VFSDATA (path_element)->linear_start != NULL)
+        if (s->linear_start != NULL)
         {
             vfs_print_message ("%s", _("Starting linear transfer..."));
             fh->linear = LS_LINEAR_PREOPEN;
@@ -1319,9 +1323,6 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
     }
     else
     {
-        struct vfs_s_subclass *s;
-
-        s = VFSDATA (path_element);
         if (s->fh_open != NULL && s->fh_open (path_element->class, fh, flags, mode) != 0)
         {
             if (s->fh_free_data != NULL)
@@ -1331,7 +1332,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
         }
     }
 
-    if ((VFSDATA (path_element)->flags & VFS_S_USETMP) != 0 && fh->ino->localname != NULL)
+    if ((s->flags & VFS_S_USETMP) != 0 && fh->ino->localname != NULL)
     {
         fh->handle = open (fh->ino->localname, NO_LINEAR (flags), mode);
         if (fh->handle == -1)
@@ -1457,9 +1458,10 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
 
 /* Initialize one of our subclasses - fill common functions */
 void
-vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub)
+vfs_s_init_class (struct vfs_s_subclass *sub)
 {
-    vclass->data = sub;
+    struct vfs_class *vclass = (struct vfs_class *) sub;
+
     vclass->fill_names = vfs_s_fill_names;
     vclass->open = vfs_s_open;
     vclass->close = vfs_s_close;

+ 1 - 1
lib/vfs/path.c

@@ -461,7 +461,7 @@ vfs_path_from_str_uri_parser (char *path)
         element->vfs_prefix = g_strdup (vfs_prefix_start);
 
         url_delimiter += strlen (VFS_PATH_URL_DELIMITER);
-        sub = VFSDATA (element);
+        sub = VFS_SUBCLASS (element);
         if (sub != NULL && (sub->flags & VFS_S_REMOTE) != 0)
         {
             char *slash_pointer;

+ 0 - 1
lib/vfs/vfs.h

@@ -141,7 +141,6 @@ typedef struct vfs_class
     const char *name;           /* "FIles over SHell" */
     vfs_class_flags_t flags;
     const char *prefix;         /* "fish:" */
-    void *data;                 /* this is for filesystem's own use */
     int verrno;                 /* can't use errno because glibc2 might define errno as function */
 
     /* *INDENT-OFF* */

+ 6 - 4
lib/vfs/xdirentry.h

@@ -34,9 +34,9 @@
 
 #define ERRNOR(a, b) do { me->verrno = a; return b; } while (0)
 
-#define MEDATA ((struct vfs_s_subclass *) me->data)
+#define MEDATA ((struct vfs_s_subclass *) me)
 
-#define VFSDATA(a) ((a->class != NULL) ? (struct vfs_s_subclass *) a->class->data : NULL)
+#define VFS_SUBCLASS(a) ((struct vfs_s_subclass *) a->class)
 
 #define FH ((vfs_file_handler_t *) fh)
 #define FH_SUPER FH->ino->super
@@ -116,10 +116,12 @@ typedef struct
 
 /*
  * One of our subclasses (tar, cpio, fish, ftpfs) with data and methods.
- * Extends vfs_class.  Stored in the "data" field of vfs_class.
+ * Extends vfs_class.
  */
 struct vfs_s_subclass
 {
+    struct vfs_class base;      /* base class */
+
     GList *supers;
     int inode_counter;
     vfs_subclass_flags_t flags; /* whether the subclass is remove, read-only etc */
@@ -179,7 +181,7 @@ struct vfs_s_inode *vfs_s_find_inode (struct vfs_class *me,
 struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me, struct vfs_s_entry *entry);
 
 /* outside interface */
-void vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub);
+void vfs_s_init_class (struct vfs_s_subclass *sub);
 const char *vfs_s_get_path (const vfs_path_t * vpath, struct vfs_s_super **archive, int flags);
 struct vfs_s_super *vfs_get_super_by_vpath (const vfs_path_t * vpath);
 

+ 11 - 12
src/vfs/cpio/cpio.c

@@ -143,7 +143,8 @@ typedef struct
 
 /*** file scope variables ************************************************************************/
 
-static struct vfs_class vfs_cpiofs_ops;
+static struct vfs_s_subclass cpio_subclass;
+static struct vfs_class *vfs_cpiofs_ops = (struct vfs_class *) &cpio_subclass;
 
 static off_t cpio_position;
 
@@ -828,12 +829,12 @@ cpio_super_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *p
         && ((cpio_super_data_t *) parc->data)->st.st_mtime < archive_stat->st_mtime)
     {
         /* Yes, reload! */
-        (*vfs_cpiofs_ops.free) ((vfsid) parc);
-        vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc);
+        vfs_cpiofs_ops->free ((vfsid) parc);
+        vfs_rmstamp (vfs_cpiofs_ops, (vfsid) parc);
         return 2;
     }
     /* Hasn't been modified, give it a new timeout */
-    vfs_stamp (&vfs_cpiofs_ops, (vfsid) parc);
+    vfs_stamp (vfs_cpiofs_ops, (vfsid) parc);
     return 1;
 }
 
@@ -881,8 +882,6 @@ cpio_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m
 void
 init_cpiofs (void)
 {
-    static struct vfs_s_subclass cpio_subclass;
-
     cpio_subclass.flags = VFS_S_READONLY;       /* FIXME: cpiofs used own temp files */
     cpio_subclass.archive_check = cpio_super_check;
     cpio_subclass.archive_same = cpio_super_same;
@@ -890,12 +889,12 @@ init_cpiofs (void)
     cpio_subclass.free_archive = cpio_free_archive;
     cpio_subclass.fh_open = cpio_fh_open;
 
-    vfs_s_init_class (&vfs_cpiofs_ops, &cpio_subclass);
-    vfs_cpiofs_ops.name = "cpiofs";
-    vfs_cpiofs_ops.prefix = "ucpio";
-    vfs_cpiofs_ops.read = cpio_read;
-    vfs_cpiofs_ops.setctl = NULL;
-    vfs_register_class (&vfs_cpiofs_ops);
+    vfs_s_init_class (&cpio_subclass);
+    vfs_cpiofs_ops->name = "cpiofs";
+    vfs_cpiofs_ops->prefix = "ucpio";
+    vfs_cpiofs_ops->read = cpio_read;
+    vfs_cpiofs_ops->setctl = NULL;
+    vfs_register_class (vfs_cpiofs_ops);
 }
 
 /* --------------------------------------------------------------------------------------------- */

+ 41 - 35
src/vfs/extfs/extfs.c

@@ -60,6 +60,7 @@
 
 #include "lib/vfs/vfs.h"
 #include "lib/vfs/utilvfs.h"
+#include "lib/vfs/xdirentry.h"
 #include "lib/vfs/gc.h"         /* vfs_rmstamp */
 
 #include "extfs.h"
@@ -138,7 +139,9 @@ static GArray *extfs_plugins = NULL;
 static gboolean errloop;
 static gboolean notadir;
 
-static struct vfs_class vfs_extfs_ops;
+static struct vfs_s_subclass extfs_subclass;
+static struct vfs_class *vfs_extfs_ops = (struct vfs_class *) &extfs_subclass;
+
 static struct archive *first_archive = NULL;
 static int my_errno = 0;
 
@@ -689,7 +692,7 @@ extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean
         {
             if (strcmp (parc->name, archive_name) == 0)
             {
-                vfs_stamp (&vfs_extfs_ops, (vfsid) parc);
+                vfs_stamp (vfs_extfs_ops, (vfsid) parc);
                 g_free (archive_name);
                 goto return_success;
             }
@@ -960,7 +963,7 @@ extfs_open (const vfs_path_t * vpath, int flags, mode_t mode)
     extfs_info->local_handle = local_handle;
 
     /* i.e. we had no open files and now we have one */
-    vfs_rmstamp (&vfs_extfs_ops, (vfsid) archive);
+    vfs_rmstamp (vfs_extfs_ops, (vfsid) archive);
     archive->fd_usage++;
     return extfs_info;
 }
@@ -1003,7 +1006,7 @@ extfs_close (void *data)
     }
 
     if (--file->archive->fd_usage == 0)
-        vfs_stamp_create (&vfs_extfs_ops, file->archive);
+        vfs_stamp_create (vfs_extfs_ops, file->archive);
 
     g_free (data);
     if (errno_code != 0)
@@ -1724,37 +1727,40 @@ extfs_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
 void
 init_extfs (void)
 {
-    vfs_extfs_ops.name = "extfs";
-    vfs_extfs_ops.init = extfs_init;
-    vfs_extfs_ops.done = extfs_done;
-    vfs_extfs_ops.fill_names = extfs_fill_names;
-    vfs_extfs_ops.which = extfs_which;
-    vfs_extfs_ops.open = extfs_open;
-    vfs_extfs_ops.close = extfs_close;
-    vfs_extfs_ops.read = extfs_read;
-    vfs_extfs_ops.write = extfs_write;
-    vfs_extfs_ops.opendir = extfs_opendir;
-    vfs_extfs_ops.readdir = extfs_readdir;
-    vfs_extfs_ops.closedir = extfs_closedir;
-    vfs_extfs_ops.stat = extfs_stat;
-    vfs_extfs_ops.lstat = extfs_lstat;
-    vfs_extfs_ops.fstat = extfs_fstat;
-    vfs_extfs_ops.chmod = extfs_chmod;
-    vfs_extfs_ops.chown = extfs_chown;
-    vfs_extfs_ops.readlink = extfs_readlink;
-    vfs_extfs_ops.unlink = extfs_unlink;
-    vfs_extfs_ops.chdir = extfs_chdir;
-    vfs_extfs_ops.ferrno = extfs_errno;
-    vfs_extfs_ops.lseek = extfs_lseek;
-    vfs_extfs_ops.getid = extfs_getid;
-    vfs_extfs_ops.nothingisopen = extfs_nothingisopen;
-    vfs_extfs_ops.free = extfs_free;
-    vfs_extfs_ops.getlocalcopy = extfs_getlocalcopy;
-    vfs_extfs_ops.ungetlocalcopy = extfs_ungetlocalcopy;
-    vfs_extfs_ops.mkdir = extfs_mkdir;
-    vfs_extfs_ops.rmdir = extfs_rmdir;
-    vfs_extfs_ops.setctl = extfs_setctl;
-    vfs_register_class (&vfs_extfs_ops);
+    memset (&extfs_subclass, 0, sizeof (extfs_subclass));
+    vfs_s_init_class (&extfs_subclass);
+
+    vfs_extfs_ops->name = "extfs";
+    vfs_extfs_ops->init = extfs_init;
+    vfs_extfs_ops->done = extfs_done;
+    vfs_extfs_ops->fill_names = extfs_fill_names;
+    vfs_extfs_ops->which = extfs_which;
+    vfs_extfs_ops->open = extfs_open;
+    vfs_extfs_ops->close = extfs_close;
+    vfs_extfs_ops->read = extfs_read;
+    vfs_extfs_ops->write = extfs_write;
+    vfs_extfs_ops->opendir = extfs_opendir;
+    vfs_extfs_ops->readdir = extfs_readdir;
+    vfs_extfs_ops->closedir = extfs_closedir;
+    vfs_extfs_ops->stat = extfs_stat;
+    vfs_extfs_ops->lstat = extfs_lstat;
+    vfs_extfs_ops->fstat = extfs_fstat;
+    vfs_extfs_ops->chmod = extfs_chmod;
+    vfs_extfs_ops->chown = extfs_chown;
+    vfs_extfs_ops->readlink = extfs_readlink;
+    vfs_extfs_ops->unlink = extfs_unlink;
+    vfs_extfs_ops->chdir = extfs_chdir;
+    vfs_extfs_ops->ferrno = extfs_errno;
+    vfs_extfs_ops->lseek = extfs_lseek;
+    vfs_extfs_ops->getid = extfs_getid;
+    vfs_extfs_ops->nothingisopen = extfs_nothingisopen;
+    vfs_extfs_ops->free = extfs_free;
+    vfs_extfs_ops->getlocalcopy = extfs_getlocalcopy;
+    vfs_extfs_ops->ungetlocalcopy = extfs_ungetlocalcopy;
+    vfs_extfs_ops->mkdir = extfs_mkdir;
+    vfs_extfs_ops->rmdir = extfs_rmdir;
+    vfs_extfs_ops->setctl = extfs_setctl;
+    vfs_register_class (vfs_extfs_ops);
 }
 
 /* --------------------------------------------------------------------------------------------- */

+ 23 - 24
src/vfs/fish/fish.c

@@ -155,7 +155,8 @@ typedef struct
 
 static char reply_str[80];
 
-static struct vfs_class vfs_fish_ops;
+static struct vfs_s_subclass fish_subclass;
+static struct vfs_class *vfs_fish_ops = (struct vfs_class *) &fish_subclass;
 
 /* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
@@ -343,7 +344,7 @@ fish_send_command (struct vfs_class *me, struct vfs_s_super *super, int flags, c
     va_start (ap, vars);
     r = fish_command_va (me, super, WAIT_REPLY, scr, vars, ap);
     va_end (ap);
-    vfs_stamp_create (&vfs_fish_ops, super);
+    vfs_stamp_create (vfs_fish_ops, super);
 
     if (r != COMPLETE)
         ERRNOR (E_REMOTE, -1);
@@ -1700,7 +1701,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
         }
 
         name =
-            g_strconcat (vfs_fish_ops.prefix, VFS_PATH_URL_DELIMITER,
+            g_strconcat (vfs_fish_ops->prefix, VFS_PATH_URL_DELIMITER,
                          super->path_element->user, "@", super->path_element->host, flags,
                          PATH_SEP_STR, super->path_element->path, (char *) NULL);
         func (name);
@@ -1728,8 +1729,6 @@ fish_open (const vfs_path_t * vpath, int flags, mode_t mode)
 void
 init_fish (void)
 {
-    static struct vfs_s_subclass fish_subclass;
-
     tcp_init ();
 
     fish_subclass.flags = VFS_S_REMOTE | VFS_S_USETMP;
@@ -1744,25 +1743,25 @@ init_fish (void)
     fish_subclass.linear_read = fish_linear_read;
     fish_subclass.linear_close = fish_linear_close;
 
-    vfs_s_init_class (&vfs_fish_ops, &fish_subclass);
-    vfs_fish_ops.name = "fish";
-    vfs_fish_ops.prefix = "sh";
-    vfs_fish_ops.fill_names = fish_fill_names;
-    vfs_fish_ops.stat = fish_stat;
-    vfs_fish_ops.lstat = fish_lstat;
-    vfs_fish_ops.fstat = fish_fstat;
-    vfs_fish_ops.chmod = fish_chmod;
-    vfs_fish_ops.chown = fish_chown;
-    vfs_fish_ops.utime = fish_utime;
-    vfs_fish_ops.open = fish_open;
-    vfs_fish_ops.symlink = fish_symlink;
-    vfs_fish_ops.link = fish_link;
-    vfs_fish_ops.unlink = fish_unlink;
-    vfs_fish_ops.rename = fish_rename;
-    vfs_fish_ops.mkdir = fish_mkdir;
-    vfs_fish_ops.rmdir = fish_rmdir;
-    vfs_fish_ops.ctl = fish_ctl;
-    vfs_register_class (&vfs_fish_ops);
+    vfs_s_init_class (&fish_subclass);
+    vfs_fish_ops->name = "fish";
+    vfs_fish_ops->prefix = "sh";
+    vfs_fish_ops->fill_names = fish_fill_names;
+    vfs_fish_ops->stat = fish_stat;
+    vfs_fish_ops->lstat = fish_lstat;
+    vfs_fish_ops->fstat = fish_fstat;
+    vfs_fish_ops->chmod = fish_chmod;
+    vfs_fish_ops->chown = fish_chown;
+    vfs_fish_ops->utime = fish_utime;
+    vfs_fish_ops->open = fish_open;
+    vfs_fish_ops->symlink = fish_symlink;
+    vfs_fish_ops->link = fish_link;
+    vfs_fish_ops->unlink = fish_unlink;
+    vfs_fish_ops->rename = fish_rename;
+    vfs_fish_ops->mkdir = fish_mkdir;
+    vfs_fish_ops->rmdir = fish_rmdir;
+    vfs_fish_ops->ctl = fish_ctl;
+    vfs_register_class (vfs_fish_ops);
 }
 
 /* --------------------------------------------------------------------------------------------- */

+ 20 - 21
src/vfs/ftpfs/ftpfs.c

@@ -237,7 +237,8 @@ static struct linklist *connections_list;
 
 static char reply_str[80];
 
-static struct vfs_class vfs_ftpfs_ops;
+static struct vfs_s_subclass ftpfs_subclass;
+static struct vfs_class *vfs_ftpfs_ops = (struct vfs_class *) &ftpfs_subclass;
 
 static GSList *no_proxy;
 
@@ -2024,7 +2025,7 @@ ftpfs_send_command (const vfs_path_t * vpath, const char *cmd, int flags)
     p = ftpfs_translate_path (path_element->class, super, rpath);
     r = ftpfs_command (path_element->class, super, WAIT_REPLY, cmd, p);
     g_free (p);
-    vfs_stamp_create (&vfs_ftpfs_ops, super);
+    vfs_stamp_create (vfs_ftpfs_ops, super);
     if (flags & OPT_IGNORE_ERROR)
         r = COMPLETE;
     if (r != COMPLETE)
@@ -2639,8 +2640,6 @@ ftpfs_init_passwd (void)
 void
 init_ftpfs (void)
 {
-    static struct vfs_s_subclass ftpfs_subclass;
-
     tcp_init ();
 
     ftpfs_subclass.flags = VFS_S_REMOTE | VFS_S_USETMP;
@@ -2656,23 +2655,23 @@ init_ftpfs (void)
     ftpfs_subclass.linear_read = ftpfs_linear_read;
     ftpfs_subclass.linear_close = ftpfs_linear_close;
 
-    vfs_s_init_class (&vfs_ftpfs_ops, &ftpfs_subclass);
-    vfs_ftpfs_ops.name = "ftpfs";
-    vfs_ftpfs_ops.flags = VFSF_NOLINKS;
-    vfs_ftpfs_ops.prefix = "ftp";
-    vfs_ftpfs_ops.done = &ftpfs_done;
-    vfs_ftpfs_ops.fill_names = ftpfs_fill_names;
-    vfs_ftpfs_ops.stat = ftpfs_stat;
-    vfs_ftpfs_ops.lstat = ftpfs_lstat;
-    vfs_ftpfs_ops.fstat = ftpfs_fstat;
-    vfs_ftpfs_ops.chmod = ftpfs_chmod;
-    vfs_ftpfs_ops.chown = ftpfs_chown;
-    vfs_ftpfs_ops.unlink = ftpfs_unlink;
-    vfs_ftpfs_ops.rename = ftpfs_rename;
-    vfs_ftpfs_ops.mkdir = ftpfs_mkdir;
-    vfs_ftpfs_ops.rmdir = ftpfs_rmdir;
-    vfs_ftpfs_ops.ctl = ftpfs_ctl;
-    vfs_register_class (&vfs_ftpfs_ops);
+    vfs_s_init_class (&ftpfs_subclass);
+    vfs_ftpfs_ops->name = "ftpfs";
+    vfs_ftpfs_ops->flags = VFSF_NOLINKS;
+    vfs_ftpfs_ops->prefix = "ftp";
+    vfs_ftpfs_ops->done = &ftpfs_done;
+    vfs_ftpfs_ops->fill_names = ftpfs_fill_names;
+    vfs_ftpfs_ops->stat = ftpfs_stat;
+    vfs_ftpfs_ops->lstat = ftpfs_lstat;
+    vfs_ftpfs_ops->fstat = ftpfs_fstat;
+    vfs_ftpfs_ops->chmod = ftpfs_chmod;
+    vfs_ftpfs_ops->chown = ftpfs_chown;
+    vfs_ftpfs_ops->unlink = ftpfs_unlink;
+    vfs_ftpfs_ops->rename = ftpfs_rename;
+    vfs_ftpfs_ops->mkdir = ftpfs_mkdir;
+    vfs_ftpfs_ops->rmdir = ftpfs_rmdir;
+    vfs_ftpfs_ops->ctl = ftpfs_ctl;
+    vfs_register_class (vfs_ftpfs_ops);
 }
 
 /* --------------------------------------------------------------------------------------------- */

+ 32 - 26
src/vfs/sfs/sfs.c

@@ -52,6 +52,7 @@
 
 #include "lib/vfs/vfs.h"
 #include "lib/vfs/utilvfs.h"
+#include "lib/vfs/xdirentry.h"
 #include "src/vfs/local/local.h"
 #include "lib/vfs/gc.h"         /* vfs_stamp_create */
 
@@ -100,7 +101,9 @@ typedef struct cachedfile
 /*** file scope variables ************************************************************************/
 
 static GSList *head;
-static struct vfs_class vfs_sfs_ops;
+
+static struct vfs_s_subclass sfs_subclass;
+static struct vfs_class *vfs_sfs_ops = (struct vfs_class *) &sfs_subclass;
 
 static int sfs_no = 0;
 static char *sfs_prefix[MAXFS];
@@ -233,7 +236,7 @@ sfs_redirect (const vfs_path_t * vpath)
     if (cur != NULL)
     {
         cf = (cachedfile *) cur->data;
-        vfs_stamp (&vfs_sfs_ops, cf);
+        vfs_stamp (vfs_sfs_ops, cf);
         return cf->cache;
     }
 
@@ -252,7 +255,7 @@ sfs_redirect (const vfs_path_t * vpath)
         head = g_slist_prepend (head, cf);
         vfs_path_free (cache_vpath);
 
-        vfs_stamp_create (&vfs_sfs_ops, (cachedfile *) head->data);
+        vfs_stamp_create (vfs_sfs_ops, (cachedfile *) head->data);
         return cf->cache;
     }
 
@@ -547,29 +550,32 @@ sfs_which (struct vfs_class *me, const char *path)
 void
 init_sfs (void)
 {
-    vfs_sfs_ops.name = "sfs";
-    vfs_sfs_ops.init = sfs_init;
-    vfs_sfs_ops.done = sfs_done;
-    vfs_sfs_ops.fill_names = sfs_fill_names;
-    vfs_sfs_ops.which = sfs_which;
-    vfs_sfs_ops.open = sfs_open;
-    vfs_sfs_ops.close = local_close;
-    vfs_sfs_ops.read = local_read;
-    vfs_sfs_ops.stat = sfs_stat;
-    vfs_sfs_ops.lstat = sfs_lstat;
-    vfs_sfs_ops.fstat = local_fstat;
-    vfs_sfs_ops.chmod = sfs_chmod;
-    vfs_sfs_ops.chown = sfs_chown;
-    vfs_sfs_ops.utime = sfs_utime;
-    vfs_sfs_ops.readlink = sfs_readlink;
-    vfs_sfs_ops.ferrno = local_errno;
-    vfs_sfs_ops.lseek = local_lseek;
-    vfs_sfs_ops.getid = sfs_getid;
-    vfs_sfs_ops.nothingisopen = sfs_nothingisopen;
-    vfs_sfs_ops.free = sfs_free;
-    vfs_sfs_ops.getlocalcopy = sfs_getlocalcopy;
-    vfs_sfs_ops.ungetlocalcopy = sfs_ungetlocalcopy;
-    vfs_register_class (&vfs_sfs_ops);
+    memset (&sfs_subclass, 0, sizeof (sfs_subclass));
+    vfs_s_init_class (&sfs_subclass);
+
+    vfs_sfs_ops->name = "sfs";
+    vfs_sfs_ops->init = sfs_init;
+    vfs_sfs_ops->done = sfs_done;
+    vfs_sfs_ops->fill_names = sfs_fill_names;
+    vfs_sfs_ops->which = sfs_which;
+    vfs_sfs_ops->open = sfs_open;
+    vfs_sfs_ops->close = local_close;
+    vfs_sfs_ops->read = local_read;
+    vfs_sfs_ops->stat = sfs_stat;
+    vfs_sfs_ops->lstat = sfs_lstat;
+    vfs_sfs_ops->fstat = local_fstat;
+    vfs_sfs_ops->chmod = sfs_chmod;
+    vfs_sfs_ops->chown = sfs_chown;
+    vfs_sfs_ops->utime = sfs_utime;
+    vfs_sfs_ops->readlink = sfs_readlink;
+    vfs_sfs_ops->ferrno = local_errno;
+    vfs_sfs_ops->lseek = local_lseek;
+    vfs_sfs_ops->getid = sfs_getid;
+    vfs_sfs_ops->nothingisopen = sfs_nothingisopen;
+    vfs_sfs_ops->free = sfs_free;
+    vfs_sfs_ops->getlocalcopy = sfs_getlocalcopy;
+    vfs_sfs_ops->ungetlocalcopy = sfs_ungetlocalcopy;
+    vfs_register_class (vfs_sfs_ops);
 }
 
 /* --------------------------------------------------------------------------------------------- */

Some files were not shown because too many files changed in this diff