mirror of https://github.com/MidnightCommander/mc
Ticket #2501: continue split of VFS core library and VFS plugins.
Use GList for list of vfs_s_super objects in vfs_s_subclass. Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
6b09134a01
commit
401aaa5014
|
@ -332,15 +332,10 @@ vfs_s_new_super (struct vfs_class *me)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
static inline void
|
||||
vfs_s_insert_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
{
|
||||
super->next = MEDATA->supers;
|
||||
super->prevp = &MEDATA->supers;
|
||||
|
||||
if (MEDATA->supers != NULL)
|
||||
MEDATA->supers->prevp = &super->next;
|
||||
MEDATA->supers = super;
|
||||
MEDATA->supers = g_list_prepend (MEDATA->supers, super);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -364,12 +359,7 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
|||
message (D_ERROR, "Direntry warning", "%s", "Super has want_stale set");
|
||||
#endif
|
||||
|
||||
if (super->prevp)
|
||||
{
|
||||
*super->prevp = super->next;
|
||||
if (super->next)
|
||||
super->next->prevp = super->prevp;
|
||||
}
|
||||
MEDATA->supers = g_list_remove (MEDATA->supers, super);
|
||||
|
||||
CALL (free_archive) (me, super);
|
||||
g_free (super->name);
|
||||
|
@ -721,16 +711,17 @@ vfs_s_print_stats (const char *fs_name, const char *action,
|
|||
static void
|
||||
vfs_s_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
{
|
||||
struct vfs_s_super *a = MEDATA->supers;
|
||||
char *name;
|
||||
GList *iter;
|
||||
|
||||
while (a)
|
||||
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
|
||||
{
|
||||
name = g_strconcat (a->name, "#", me->prefix, "/",
|
||||
/* a->current_dir->name, */ (char *) NULL);
|
||||
(*func) (name);
|
||||
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
|
||||
char *name;
|
||||
|
||||
name = g_strconcat (super->name, "#", me->prefix, "/",
|
||||
/* super->current_dir->name, */ (char *) NULL);
|
||||
func (name);
|
||||
g_free (name);
|
||||
a = a->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1031,6 +1022,7 @@ vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super,
|
|||
const char *
|
||||
vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **archive, int flags)
|
||||
{
|
||||
GList *iter;
|
||||
const char *retval;
|
||||
char *local, *op;
|
||||
const char *archive_name;
|
||||
|
@ -1049,16 +1041,19 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for (super = MEDATA->supers; super != NULL; super = super->next)
|
||||
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
|
||||
{
|
||||
int i;
|
||||
|
||||
super = (struct vfs_s_super *) iter->data;
|
||||
|
||||
/* 0 == other, 1 == same, return it, 2 == other but stop scanning */
|
||||
int i = MEDATA->archive_same (me, super, archive_name, op, cookie);
|
||||
i = MEDATA->archive_same (me, super, archive_name, op, cookie);
|
||||
if (i != 0)
|
||||
{
|
||||
if (i == 1)
|
||||
goto return_success;
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "lib/global.h" /* GList */
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
#define LINK_FOLLOW 15
|
||||
|
@ -52,7 +54,6 @@
|
|||
/* Single connection or archive */
|
||||
struct vfs_s_super
|
||||
{
|
||||
struct vfs_s_super **prevp, *next;
|
||||
struct vfs_class *me;
|
||||
struct vfs_s_inode *root;
|
||||
char *name; /* My name, whatever it means */
|
||||
|
@ -182,7 +183,7 @@ struct vfs_s_fh
|
|||
*/
|
||||
struct vfs_s_subclass
|
||||
{
|
||||
struct vfs_s_super *supers;
|
||||
GList *supers;
|
||||
int inode_counter;
|
||||
int flags; /* whether the subclass is remove, read-only etc */
|
||||
dev_t rdev;
|
||||
|
|
|
@ -1385,14 +1385,16 @@ fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, mode_t mode)
|
|||
static void
|
||||
fish_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
{
|
||||
struct vfs_s_super *super = MEDATA->supers;
|
||||
char *name;
|
||||
GList *iter;
|
||||
|
||||
char gbuf[10];
|
||||
|
||||
while (super)
|
||||
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
|
||||
{
|
||||
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
|
||||
|
||||
char *name;
|
||||
char gbuf[10];
|
||||
const char *flags = "";
|
||||
|
||||
switch (SUP.flags)
|
||||
{
|
||||
case FISH_FLAG_RSH:
|
||||
|
@ -1411,9 +1413,8 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
|
|||
}
|
||||
|
||||
name = g_strconcat ("/#sh:", SUP.user, "@", SUP.host, flags, "/", SUP.cwdir, (char *) NULL);
|
||||
(*func) (name);
|
||||
func (name);
|
||||
g_free (name);
|
||||
super = super->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2202,15 +2202,16 @@ ftpfs_done (struct vfs_class *me)
|
|||
static void
|
||||
ftpfs_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
{
|
||||
struct vfs_s_super *super = MEDATA->supers;
|
||||
char *name;
|
||||
GList *iter;
|
||||
|
||||
while (super)
|
||||
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
|
||||
{
|
||||
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
|
||||
char *name;
|
||||
|
||||
name = g_strconcat ("/#ftp:", SUP.user, "@", SUP.host, "/", SUP.cwdir, (char *) NULL);
|
||||
(*func) (name);
|
||||
func (name);
|
||||
g_free (name);
|
||||
super = super->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue