VFS: make vfs_class and vfs_s_subclass related macros more readable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2018-09-12 14:01:28 +03:00
parent 0fbd98fece
commit 672ba46c8b
26 changed files with 133 additions and 128 deletions

View File

@ -80,7 +80,9 @@
/*** file scope macro definitions ****************************************************************/
#define CALL(x) if (MEDATA->x) MEDATA->x
#define CALL(x) \
if (VFS_SUBCLASS (me)->x != NULL) \
VFS_SUBCLASS (me)->x
/*** file scope type declarations ****************************************************************/
@ -164,7 +166,8 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, int foll
}
}
target = MEDATA->find_entry (me, entry->dir->super->root, linkname, follow - 1, FL_NONE);
target =
VFS_SUBCLASS (me)->find_entry (me, entry->dir->super->root, linkname, follow - 1, FL_NONE);
g_free (fullname);
return target;
}
@ -269,7 +272,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
iter = g_list_find_custom (root->subdir, path, (GCompareFunc) vfs_s_entry_compare);
ent = iter != NULL ? (struct vfs_s_entry *) iter->data : NULL;
if (ent != NULL && !MEDATA->dir_uptodate (me, ent->ino))
if (ent != NULL && !VFS_SUBCLASS (me)->dir_uptodate (me, ent->ino))
{
#if 1
vfs_print_message (_("Directory cache expired for %s"), path);
@ -284,7 +287,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
ino = vfs_s_new_inode (me, root->super, vfs_s_default_stat (me, S_IFDIR | 0755));
ent = vfs_s_new_entry (me, path, ino);
if (MEDATA->dir_load (me, ino, path) == -1)
if (VFS_SUBCLASS (me)->dir_load (me, ino, path) == -1)
{
vfs_s_free_entry (me, ent);
g_free (path);
@ -329,7 +332,7 @@ vfs_s_new_super (struct vfs_class *me)
static inline void
vfs_s_insert_super (struct vfs_class *me, struct vfs_s_super *super)
{
MEDATA->supers = g_list_prepend (MEDATA->supers, super);
VFS_SUBCLASS (me)->supers = g_list_prepend (VFS_SUBCLASS (me)->supers, super);
}
/* --------------------------------------------------------------------------------------------- */
@ -353,7 +356,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
MEDATA->supers = g_list_remove (MEDATA->supers, super);
VFS_SUBCLASS (me)->supers = g_list_remove (VFS_SUBCLASS (me)->supers, super);
CALL (free_archive) (me, super);
#ifdef ENABLE_VFS_NET
@ -538,7 +541,7 @@ vfs_s_read (void *fh, char *buffer, size_t count)
if (FH->linear == LS_LINEAR_PREOPEN)
{
if (MEDATA->linear_start (me, FH, FH->pos) == 0)
if (VFS_SUBCLASS (me)->linear_start (me, FH, FH->pos) == 0)
return (-1);
}
@ -546,7 +549,7 @@ vfs_s_read (void *fh, char *buffer, size_t count)
vfs_die ("linear_start() did not set linear_state!");
if (FH->linear == LS_LINEAR_OPEN)
return MEDATA->linear_read (me, FH, buffer, count);
return VFS_SUBCLASS (me)->linear_read (me, FH, buffer, count);
if (FH->handle != -1)
{
@ -632,6 +635,7 @@ vfs_s_close (void *fh)
{
int res = 0;
struct vfs_class *me = FH_SUPER->me;
struct vfs_s_subclass *sub = VFS_SUBCLASS (me);
if (me == NULL)
return (-1);
@ -641,10 +645,10 @@ vfs_s_close (void *fh)
vfs_stamp_create (me, FH_SUPER);
if (FH->linear == LS_LINEAR_OPEN)
MEDATA->linear_close (me, fh);
if (MEDATA->fh_close != NULL)
res = MEDATA->fh_close (me, fh);
if ((me->flags & VFS_USETMP) != 0 && FH->changed && MEDATA->file_store != NULL)
sub->linear_close (me, fh);
if (sub->fh_close != NULL)
res = sub->fh_close (me, fh);
if ((me->flags & VFS_USETMP) != 0 && FH->changed && sub->file_store != NULL)
{
char *s;
@ -654,7 +658,7 @@ vfs_s_close (void *fh)
res = -1;
else
{
res = MEDATA->file_store (me, fh, s, FH->ino->localname);
res = sub->file_store (me, fh, s, FH->ino->localname);
g_free (s);
}
vfs_s_invalidate (me, FH_SUPER);
@ -663,8 +667,8 @@ vfs_s_close (void *fh)
close (FH->handle);
vfs_s_free_inode (me, FH->ino);
if (MEDATA->fh_free_data != NULL)
MEDATA->fh_free_data (fh);
if (sub->fh_free_data != NULL)
sub->fh_free_data (fh);
g_free (fh);
return res;
}
@ -691,7 +695,7 @@ vfs_s_fill_names (struct vfs_class *me, fill_names_f func)
{
GList *iter;
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
for (iter = VFS_SUBCLASS (me)->supers; iter != NULL; iter = g_list_next (iter))
{
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
char *name;
@ -785,10 +789,10 @@ vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
return 1;
}
case VFS_SETCTL_LOGFILE:
VFS_SUBCLASS (path_element)->logfile = fopen ((char *) arg, "w");
VFS_SUBCLASS (path_element->class)->logfile = fopen ((char *) arg, "w");
return 1;
case VFS_SETCTL_FLUSH:
VFS_SUBCLASS (path_element)->flush = 1;
VFS_SUBCLASS (path_element->class)->flush = 1;
return 1;
default:
return 0;
@ -836,9 +840,9 @@ vfs_s_dir_uptodate (struct vfs_class *me, struct vfs_s_inode *ino)
{
struct timeval tim;
if (MEDATA->flush != 0)
if (VFS_SUBCLASS (me)->flush != 0)
{
MEDATA->flush = 0;
VFS_SUBCLASS (me)->flush = 0;
return 0;
}
@ -865,8 +869,8 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i
ino->st = *initstat;
ino->super = super;
ino->st.st_nlink = 0;
ino->st.st_ino = MEDATA->inode_counter++;
ino->st.st_dev = MEDATA->rdev;
ino->st.st_ino = VFS_SUBCLASS (me)->inode_counter++;
ino->st.st_dev = VFS_SUBCLASS (me)->rdev;
super->ino_usage++;
@ -1050,7 +1054,7 @@ vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super,
if (((me->flags & VFS_REMOTE) == 0) && (*path == '\0'))
return super->root;
ent = MEDATA->find_entry (me, super->root, path, follow, flags);
ent = VFS_SUBCLASS (me)->find_entry (me, super->root, path, follow, flags);
return (ent != NULL ? ent->ino : NULL);
}
@ -1075,7 +1079,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 = VFS_SUBCLASS (path_element);
subclass = VFS_SUBCLASS (path_element->class);
vpath_archive = vfs_path_clone (vpath);
vfs_path_remove_element_by_index (vpath_archive, -1);
@ -1146,7 +1150,7 @@ 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 = VFS_SUBCLASS (path_element->class);
if (subclass->open_archive != NULL)
{
@ -1252,7 +1256,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
return NULL;
}
s = VFS_SUBCLASS (path_element);
s = VFS_SUBCLASS (path_element->class);
if (ino == NULL)
{
@ -1277,7 +1281,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 ((((struct vfs_class *) s)->flags & VFS_USETMP) != 0)
if ((VFS_CLASS (s)->flags & VFS_USETMP) != 0)
{
int tmp_handle;
vfs_path_t *tmp_vpath;
@ -1332,7 +1336,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
}
}
if ((((struct vfs_class *) s)->flags & VFS_USETMP) != 0 && fh->ino->localname != NULL)
if ((VFS_CLASS (s)->flags & VFS_USETMP) != 0 && fh->ino->localname != NULL)
{
fh->handle = open (fh->ino->localname, NO_LINEAR (flags), mode);
if (fh->handle == -1)
@ -1388,6 +1392,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
off_t stat_size = ino->st.st_size;
vfs_file_handler_t fh;
vfs_path_t *tmp_vpath;
struct vfs_s_subclass *s = VFS_SUBCLASS (me);
if ((me->flags & VFS_USETMP) == 0)
return (-1);
@ -1406,14 +1411,14 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
goto error_4;
}
if (MEDATA->linear_start (me, &fh, 0) == 0)
if (s->linear_start (me, &fh, 0) == 0)
goto error_3;
/* Clear the interrupt status */
tty_got_interrupt ();
tty_enable_interrupt_key ();
while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer))) != 0)
while ((n = s->linear_read (me, &fh, buffer, sizeof (buffer))) != 0)
{
int t;
@ -1434,7 +1439,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
goto error_1;
}
}
MEDATA->linear_close (me, &fh);
s->linear_close (me, &fh);
close (handle);
tty_disable_interrupt_key ();
@ -1442,7 +1447,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
return 0;
error_1:
MEDATA->linear_close (me, &fh);
s->linear_close (me, &fh);
error_3:
tty_disable_interrupt_key ();
close (handle);
@ -1460,7 +1465,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
void
vfs_s_init_class (struct vfs_s_subclass *sub)
{
struct vfs_class *vclass = (struct vfs_class *) sub;
struct vfs_class *vclass = VFS_CLASS (sub);
vclass->fill_names = vfs_s_fill_names;
vclass->open = vfs_s_open;
@ -1543,7 +1548,7 @@ vfs_s_select_on_two (int fd1, int fd2)
int
vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char term)
{
FILE *logfile = MEDATA->logfile;
FILE *logfile = VFS_SUBCLASS (me)->logfile;
int i;
char c;

View File

@ -336,7 +336,7 @@ vfs_get_class_by_name (const char *class_name)
for (i = 0; i < vfs__classes_list->len; i++)
{
struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
struct vfs_class *vfs = VFS_CLASS (g_ptr_array_index (vfs__classes_list, i));
if ((vfs->name != NULL) && (strcmp (vfs->name, class_name) == 0))
return vfs;
}
@ -461,8 +461,8 @@ vfs_path_from_str_uri_parser (char *path)
element->vfs_prefix = g_strdup (vfs_prefix_start);
url_delimiter += strlen (VFS_PATH_URL_DELIMITER);
sub = VFS_SUBCLASS (element);
if (sub != NULL && (((struct vfs_class *) sub)->flags & VFS_REMOTE) != 0)
sub = VFS_SUBCLASS (element->class);
if (sub != NULL && (VFS_CLASS (sub)->flags & VFS_REMOTE) != 0)
{
char *slash_pointer;
@ -1004,7 +1004,7 @@ vfs_prefix_to_class (const char *prefix)
{
struct vfs_class *vfs;
vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
vfs = VFS_CLASS (g_ptr_array_index (vfs__classes_list, i));
if (vfs->which != NULL)
{
if (vfs->which (vfs, prefix) == -1)

View File

@ -503,7 +503,7 @@ vfs_shut (void)
for (i = 0; i < vfs__classes_list->len; i++)
{
struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
struct vfs_class *vfs = VFS_CLASS (g_ptr_array_index (vfs__classes_list, i));
if (vfs->done != NULL)
vfs->done (vfs);
@ -534,7 +534,7 @@ vfs_fill_names (fill_names_f func)
for (i = 0; i < vfs__classes_list->len; i++)
{
struct vfs_class *vfs = (struct vfs_class *) g_ptr_array_index (vfs__classes_list, i);
struct vfs_class *vfs = VFS_CLASS (g_ptr_array_index (vfs__classes_list, i));
if (vfs->fill_names != NULL)
vfs->fill_names (vfs, func);

View File

@ -26,6 +26,8 @@
/*** typedefs(not structures) and defined constants **********************************************/
#define VFS_CLASS(a) ((struct vfs_class *) (a))
#if defined (ENABLE_VFS_FTP) || defined (ENABLE_VFS_FISH) || defined (ENABLE_VFS_SMB)
#define ENABLE_VFS_NET 1
#endif

View File

@ -34,9 +34,7 @@
#define ERRNOR(a, b) do { me->verrno = a; return b; } while (0)
#define MEDATA ((struct vfs_s_subclass *) me)
#define VFS_SUBCLASS(a) ((struct vfs_s_subclass *) a->class)
#define VFS_SUBCLASS(a) ((struct vfs_s_subclass *) (a))
#define FH ((vfs_file_handler_t *) fh)
#define FH_SUPER FH->ino->super

View File

@ -144,7 +144,7 @@ typedef struct
/*** file scope variables ************************************************************************/
static struct vfs_s_subclass cpio_subclass;
static struct vfs_class *vfs_cpiofs_ops = (struct vfs_class *) &cpio_subclass;
static struct vfs_class *vfs_cpiofs_ops = VFS_CLASS (&cpio_subclass);
static off_t cpio_position;
@ -266,7 +266,7 @@ cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super, const vfs_
root->st.st_mode = mode;
root->data_offset = -1;
root->st.st_nlink++;
root->st.st_dev = MEDATA->rdev++;
root->st.st_dev = VFS_SUBCLASS (me)->rdev++;
super->root = root;
@ -444,7 +444,7 @@ cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super, struct stat
tn++;
}
entry = MEDATA->find_entry (me, root, tn, LINK_FOLLOW, FL_NONE); /* In case entry is already there */
entry = VFS_SUBCLASS (me)->find_entry (me, root, tn, LINK_FOLLOW, FL_NONE); /* In case entry is already there */
if (entry != NULL)
{

View File

@ -142,7 +142,7 @@ static gboolean errloop;
static gboolean notadir;
static struct vfs_s_subclass extfs_subclass;
static struct vfs_class *vfs_extfs_ops = (struct vfs_class *) &extfs_subclass;
static struct vfs_class *vfs_extfs_ops = VFS_CLASS (&extfs_subclass);
static GSList *first_archive = NULL;
static int my_errno = 0;

View File

@ -156,7 +156,7 @@ typedef struct
static char reply_str[80];
static struct vfs_s_subclass fish_subclass;
static struct vfs_class *vfs_fish_ops = (struct vfs_class *) &fish_subclass;
static struct vfs_class *vfs_fish_ops = VFS_CLASS (&fish_subclass);
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
@ -267,7 +267,7 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
size_t cmd_len)
{
ssize_t status;
FILE *logfile = MEDATA->logfile;
FILE *logfile = VFS_SUBCLASS (me)->logfile;
if (cmd_len == (size_t) (-1))
cmd_len = strlen (cmd);
@ -740,10 +740,10 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
* Simple FISH debug interface :]
*/
#if 0
if (MEDATA->logfile == NULL)
MEDATA->logfile = fopen ("/tmp/mc-FISH.sh", "w");
if (VFS_SUBCLASS (me)->logfile == NULL)
VFS_SUBCLASS (me)->logfile = fopen ("/tmp/mc-FISH.sh", "w");
#endif
logfile = MEDATA->logfile;
logfile = VFS_SUBCLASS (me)->logfile;
vfs_print_message (_("fish: Reading directory %s..."), remote_path);
@ -1675,7 +1675,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
{
GList *iter;
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
for (iter = VFS_SUBCLASS (me)->supers; iter != NULL; iter = g_list_next (iter))
{
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;

View File

@ -238,7 +238,7 @@ static struct linklist *connections_list;
static char reply_str[80];
static struct vfs_s_subclass ftpfs_subclass;
static struct vfs_class *vfs_ftpfs_ops = (struct vfs_class *) &ftpfs_subclass;
static struct vfs_class *vfs_ftpfs_ops = VFS_CLASS (&ftpfs_subclass);
static GSList *no_proxy;
@ -307,10 +307,10 @@ ftpfs_translate_path (struct vfs_class *me, struct vfs_s_super *super, const cha
{
char *ret, *p;
if (MEDATA->logfile)
if (VFS_SUBCLASS (me)->logfile != NULL)
{
fprintf (MEDATA->logfile, "MC -- ftpfs_translate_path: %s\n", remote_path);
fflush (MEDATA->logfile);
fprintf (VFS_SUBCLASS (me)->logfile, "MC -- ftpfs_translate_path: %s\n", remote_path);
fflush (VFS_SUBCLASS (me)->logfile);
}
/* strip leading slash(es) */
@ -490,19 +490,19 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
va_end (ap);
g_string_append (cmdstr, "\r\n");
if (MEDATA->logfile != NULL)
if (VFS_SUBCLASS (me)->logfile != NULL)
{
if (strncmp (cmdstr->str, "PASS ", 5) == 0)
fputs ("PASS <Password not logged>\r\n", MEDATA->logfile);
fputs ("PASS <Password not logged>\r\n", VFS_SUBCLASS (me)->logfile);
else
{
size_t ret;
ret = fwrite (cmdstr->str, cmdstr->len, 1, MEDATA->logfile);
ret = fwrite (cmdstr->str, cmdstr->len, 1, VFS_SUBCLASS (me)->logfile);
(void) ret;
}
fflush (MEDATA->logfile);
fflush (VFS_SUBCLASS (me)->logfile);
}
got_sigpipe = 0;
@ -624,7 +624,7 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
super->path_element->password = g_strdup (op);
}
if (!anon || MEDATA->logfile)
if (!anon || VFS_SUBCLASS (me)->logfile != NULL)
pass = op;
else
{
@ -652,10 +652,10 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
SUP->strict = RFC_STRICT;
g_free (reply_up);
if (MEDATA->logfile)
if (VFS_SUBCLASS (me)->logfile != NULL)
{
fprintf (MEDATA->logfile, "MC -- remote_is_amiga = %d\n", SUP->remote_is_amiga);
fflush (MEDATA->logfile);
fprintf (VFS_SUBCLASS (me)->logfile, "MC -- remote_is_amiga = %d\n", SUP->remote_is_amiga);
fflush (VFS_SUBCLASS (me)->logfile);
}
vfs_print_message ("%s", _("ftpfs: sending login name"));
@ -1630,10 +1630,10 @@ resolve_symlink_with_ls_options (struct vfs_class *me, struct vfs_s_super *super
{
if (fgets (buffer, sizeof (buffer), fp) == NULL)
goto done;
if (MEDATA->logfile)
if (VFS_SUBCLASS (me)->logfile != NULL)
{
fputs (buffer, MEDATA->logfile);
fflush (MEDATA->logfile);
fputs (buffer, VFS_SUBCLASS (me)->logfile);
fflush (VFS_SUBCLASS (me)->logfile);
}
vfs_die ("This code should be commented out\n");
if (vfs_parse_ls_lga (buffer, &s, &filename, NULL))
@ -1758,11 +1758,11 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
return -1;
}
if (MEDATA->logfile)
if (VFS_SUBCLASS (me)->logfile != NULL)
{
fputs (lc_buffer, MEDATA->logfile);
fputs ("\n", MEDATA->logfile);
fflush (MEDATA->logfile);
fputs (lc_buffer, VFS_SUBCLASS (me)->logfile);
fputs ("\n", VFS_SUBCLASS (me)->logfile);
fflush (VFS_SUBCLASS (me)->logfile);
}
ent = vfs_s_generate_entry (me, NULL, dir, 0);
@ -2318,7 +2318,7 @@ ftpfs_fill_names (struct vfs_class *me, fill_names_f func)
{
GList *iter;
for (iter = MEDATA->supers; iter != NULL; iter = g_list_next (iter))
for (iter = VFS_SUBCLASS (me)->supers; iter != NULL; iter = g_list_next (iter))
{
const struct vfs_s_super *super = (const struct vfs_s_super *) iter->data;
char *name;

View File

@ -48,7 +48,7 @@
/*** file scope variables ************************************************************************/
static struct vfs_s_subclass local_subclass;
static struct vfs_class *vfs_local_ops = (struct vfs_class *) &local_subclass;
static struct vfs_class *vfs_local_ops = VFS_CLASS (&local_subclass);
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */

View File

@ -103,7 +103,7 @@ typedef struct cachedfile
static GSList *head;
static struct vfs_s_subclass sfs_subclass;
static struct vfs_class *vfs_sfs_ops = (struct vfs_class *) &sfs_subclass;
static struct vfs_class *vfs_sfs_ops = VFS_CLASS (&sfs_subclass);
static int sfs_no = 0;
static char *sfs_prefix[MAXFS];

View File

@ -35,7 +35,7 @@
/*** global variables ****************************************************************************/
struct vfs_s_subclass sftpfs_subclass;
struct vfs_class *sftpfs_class = (struct vfs_class *) &sftpfs_subclass;
struct vfs_class *sftpfs_class = VFS_CLASS (&sftpfs_subclass);
/*** file scope macro definitions ****************************************************************/

View File

@ -139,7 +139,7 @@ static pstring password;
static pstring username;
static struct vfs_s_subclass smbfs_subclass;
static struct vfs_class *vfs_smbfs_ops = (struct vfs_class *) &smbfs_subclass;
static struct vfs_class *vfs_smbfs_ops = VFS_CLASS (&smbfs_subclass);
static struct _smbfs_connection
{

View File

@ -196,7 +196,7 @@ typedef struct
/*** file scope variables ************************************************************************/
static struct vfs_s_subclass tarfs_subclass;
static struct vfs_class *vfs_tarfs_ops = (struct vfs_class *) &tarfs_subclass;
static struct vfs_class *vfs_tarfs_ops = VFS_CLASS (&tarfs_subclass);
/* As we open one archive at a time, it is safe to have this static */
static off_t current_tar_position = 0;
@ -314,7 +314,7 @@ tar_open_archive_int (struct vfs_class *me, const vfs_path_t * vpath, struct vfs
root->st.st_mode = mode;
root->data_offset = -1;
root->st.st_nlink++;
root->st.st_dev = MEDATA->rdev++;
root->st.st_dev = VFS_SUBCLASS (me)->rdev++;
archive->root = root;
@ -710,7 +710,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, int tard, si
tar_fill_stat (archive, &st, header, *h_size);
if (S_ISDIR (st.st_mode))
{
entry = MEDATA->find_entry (me, parent, p, LINK_NO_FOLLOW, FL_NONE);
entry = VFS_SUBCLASS (me)->find_entry (me, parent, p, LINK_NO_FOLLOW, FL_NONE);
if (entry)
goto done;
}

View File

@ -132,7 +132,7 @@ static int readdir_ptr;
static int undelfs_usage;
static struct vfs_s_subclass undelfs_subclass;
static struct vfs_class *vfs_undelfs_ops = (struct vfs_class *) &undelfs_subclass;
static struct vfs_class *vfs_undelfs_ops = VFS_CLASS (&undelfs_subclass);
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/

View File

@ -38,7 +38,7 @@
#include "src/vfs/local/local.c"
static struct vfs_s_subclass test_subclass;
static struct vfs_class *vfs_test_ops = (struct vfs_class *) &test_subclass;
static struct vfs_class *vfs_test_ops = VFS_CLASS (&test_subclass);
/* --------------------------------------------------------------------------------------------- */

View File

@ -34,7 +34,7 @@
#include "src/vfs/local/local.c"
static struct vfs_s_subclass test_subclass;
static struct vfs_class *vfs_test_ops = (struct vfs_class *) &test_subclass;
static struct vfs_class *vfs_test_ops = VFS_CLASS (&test_subclass);
/* --------------------------------------------------------------------------------------------- */

View File

@ -38,9 +38,9 @@
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
/* --------------------------------------------------------------------------------------------- */

View File

@ -165,7 +165,7 @@ END_PARAMETRIZED_TEST
/* --------------------------------------------------------------------------------------------- */
static struct vfs_s_subclass test_subclass1;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
/* @DataSource("test_path_to_str_flags_ds") */
/* *INDENT-OFF* */

View File

@ -38,9 +38,9 @@
#include "src/vfs/local/local.c"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
/* --------------------------------------------------------------------------------------------- */

View File

@ -34,7 +34,7 @@
struct vfs_s_subclass test_subclass1;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static int test_chdir (const vfs_path_t * vpath);

View File

@ -37,7 +37,7 @@
struct vfs_s_subclass test_subclass1;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
struct vfs_s_entry *vfs_root_entry;
static struct vfs_s_inode *vfs_root_inode;

View File

@ -38,9 +38,9 @@
#include "src/vfs/local/local.c"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
#define ETALON_PATH_STR "/#test1/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33"
#define ETALON_PATH_URL_STR "/test1://bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"
@ -114,21 +114,21 @@ static const struct test_from_to_string_ds
ETALON_PATH_URL_STR,
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 1. */
"/",
"/",
"/",
1,
(struct vfs_class *) &local_subclass
VFS_CLASS (&local_subclass)
},
{ /* 2. */
"/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33",
"/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
#ifdef HAVE_CHARSET
{ /* 3. */
@ -136,42 +136,42 @@ static const struct test_from_to_string_ds
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 4. */
"/#test1/bla-bla1/#enc:IBM866/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
"/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 5. */
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/#enc:KOI8-R/some/path#test3/111/22/33",
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 6. */
"/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/some/#enc:KOI8-R/path#test3/111/22/33",
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 7. */
"/#test1/bla-bla1/some/path/#test2/#enc:IBM866/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
"/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 8. */
"/#test1/bla-bla1/some/path/#enc:IBM866/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
"/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
"111/22/33",
4,
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
#endif /* HAVE_CHARSET */
};

View File

@ -34,9 +34,9 @@
#include "src/vfs/local/local.c"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
/* --------------------------------------------------------------------------------------------- */
@ -107,27 +107,27 @@ static const struct test_vfs_prefix_to_class_ds
{
{ /* 0 */
"test_1:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 1 */
"test_2:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 2 */
"test_3:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 3 */
"test_4:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 4 */
"test2:",
(struct vfs_class *) &test_subclass2
VFS_CLASS (&test_subclass2)
},
{ /* 5 */
"test3:",
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{
"test1:",

View File

@ -38,9 +38,9 @@
#define ETALON_VFS_URL_NAME "test2://user:pass@host.net"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
/* --------------------------------------------------------------------------------------------- */

View File

@ -34,9 +34,9 @@
#include "src/vfs/local/local.c"
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
static struct vfs_class *vfs_test_ops1 = (struct vfs_class *) &test_subclass1;
static struct vfs_class *vfs_test_ops2 = (struct vfs_class *) &test_subclass2;
static struct vfs_class *vfs_test_ops3 = (struct vfs_class *) &test_subclass3;
static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
/* --------------------------------------------------------------------------------------------- */
@ -98,21 +98,21 @@ static const struct test_vfs_split_ds
"#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/",
"qqq/www/eee.rr",
"test3:",
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 1. */
"#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/",
"#test1:/bla-bla/some/path/",
"bla-bla/some/path2/",
"test2:",
(struct vfs_class *) &test_subclass2
VFS_CLASS (&test_subclass2)
},
{ /* 2. */
"#test1:/bla-bla/some/path/",
"",
"bla-bla/some/path/",
"test1:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 3. */
"",
@ -126,21 +126,21 @@ static const struct test_vfs_split_ds
"/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2",
"qqq/www/eee.rr",
"test3:",
(struct vfs_class *) &test_subclass3
VFS_CLASS (&test_subclass3)
},
{ /* 5. split with local */
"/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2",
"/local/path/#test1:/bla-bla/some/path/",
"bla-bla/some/path2",
"test2:",
(struct vfs_class *) &test_subclass2,
VFS_CLASS (&test_subclass2)
},
{ /* 6. split with local */
"/local/path/#test1:/bla-bla/some/path/",
"/local/path/",
"bla-bla/some/path/",
"test1:",
(struct vfs_class *) &test_subclass1
VFS_CLASS (&test_subclass1)
},
{ /* 7. split with local */
"/local/path/",
@ -154,21 +154,21 @@ static const struct test_vfs_split_ds
"",
"bla-bla/some/path2",
"test2:username:passwd@somehost.net",
(struct vfs_class *) &test_subclass2
VFS_CLASS (&test_subclass2)
},
{ /* 9. split URL with semi */
"/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2",
"/local/path/#test1:/bla-bla/some/path/",
"bla-bla/some/path2",
"test2:username:p!a@s#s$w%d@somehost.net",
(struct vfs_class *) &test_subclass2
VFS_CLASS (&test_subclass2)
},
{ /* 10. split with semi in path */
"#test2:/bl#a-bl#a/so#me/pa#th2",
"",
"bl#a-bl#a/so#me/pa#th2",
"test2:",
(struct vfs_class *) &test_subclass2
VFS_CLASS (&test_subclass2)
}
};
/* *INDENT-ON* */