mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* xdirentry.h: Rename vfs_s_data to vfs_s_subclass.
* cpio.c: Initialize only non-zero fields in vfs_s_subclass. * fish.c: Likewise. * ftpfs.c: Likewise. * tar.c: Likewise.
This commit is contained in:
parent
52844a3092
commit
63740624ea
@ -1,5 +1,11 @@
|
||||
2003-10-16 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* xdirentry.h: Rename vfs_s_data to vfs_s_subclass.
|
||||
* cpio.c: Initialize only non-zero fields in vfs_s_subclass.
|
||||
* fish.c: Likewise.
|
||||
* ftpfs.c: Likewise.
|
||||
* tar.c: Likewise.
|
||||
|
||||
* vfs.h: Rename commands for mc_ctl() and mc_setctl() to make it
|
||||
clear which function they are used with.
|
||||
* vfs.c (mc_ctl): Change last argument to (void*).
|
||||
|
39
vfs/cpio.c
39
vfs/cpio.c
@ -594,41 +594,22 @@ static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vfs_s_data cpiofs_data = {
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
|
||||
NULL, /* init inode */
|
||||
NULL, /* free inode */
|
||||
NULL, /* init entry */
|
||||
|
||||
cpio_super_check,
|
||||
cpio_super_same,
|
||||
cpio_open_archive,
|
||||
cpio_free_archive,
|
||||
|
||||
cpio_fh_open,
|
||||
NULL,
|
||||
|
||||
vfs_s_find_entry_tree,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
init_cpiofs (void)
|
||||
{
|
||||
static struct vfs_s_subclass cpiofs_subclass;
|
||||
|
||||
cpiofs_subclass.archive_check = cpio_super_check;
|
||||
cpiofs_subclass.archive_same = cpio_super_same;
|
||||
cpiofs_subclass.open_archive = cpio_open_archive;
|
||||
cpiofs_subclass.free_archive = cpio_free_archive;
|
||||
cpiofs_subclass.fh_open = cpio_fh_open;
|
||||
cpiofs_subclass.find_entry = vfs_s_find_entry_tree;
|
||||
|
||||
vfs_s_init_class (&vfs_cpiofs_ops);
|
||||
vfs_cpiofs_ops.name = "cpiofs";
|
||||
vfs_cpiofs_ops.prefix = "ucpio";
|
||||
vfs_cpiofs_ops.data = &cpiofs_data;
|
||||
vfs_cpiofs_ops.data = &cpiofs_subclass;
|
||||
vfs_cpiofs_ops.read = cpio_read;
|
||||
vfs_cpiofs_ops.write = NULL;
|
||||
vfs_cpiofs_ops.setctl = NULL;
|
||||
|
46
vfs/fish.c
46
vfs/fish.c
@ -833,38 +833,10 @@ static int fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vfs_s_data fish_data = {
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
|
||||
NULL, /* init_inode */
|
||||
NULL, /* free_inode */
|
||||
NULL, /* init_entry */
|
||||
|
||||
NULL, /* archive_check */
|
||||
archive_same,
|
||||
open_archive,
|
||||
free_archive,
|
||||
|
||||
fish_fh_open, /* fh_open */
|
||||
NULL, /* fh_close */
|
||||
|
||||
vfs_s_find_entry_linear,
|
||||
dir_load,
|
||||
dir_uptodate,
|
||||
file_store,
|
||||
|
||||
linear_start,
|
||||
linear_read,
|
||||
linear_close
|
||||
};
|
||||
|
||||
static void
|
||||
fish_fill_names (struct vfs_class *me, void (*func)(char *))
|
||||
{
|
||||
struct vfs_s_super *super = fish_data.supers;
|
||||
struct vfs_s_super *super = MEDATA->supers;
|
||||
char *flags;
|
||||
char *name;
|
||||
|
||||
@ -895,10 +867,24 @@ fish_fill_names (struct vfs_class *me, void (*func)(char *))
|
||||
void
|
||||
init_fish (void)
|
||||
{
|
||||
static struct vfs_s_subclass fish_subclass;
|
||||
|
||||
fish_subclass.archive_same = archive_same;
|
||||
fish_subclass.open_archive = open_archive;
|
||||
fish_subclass.free_archive = free_archive;
|
||||
fish_subclass.fh_open = fish_fh_open;
|
||||
fish_subclass.find_entry = vfs_s_find_entry_linear;
|
||||
fish_subclass.dir_load = dir_load;
|
||||
fish_subclass.dir_uptodate = dir_uptodate;
|
||||
fish_subclass.file_store = file_store;
|
||||
fish_subclass.linear_start = linear_start;
|
||||
fish_subclass.linear_read = linear_read;
|
||||
fish_subclass.linear_close = linear_close;
|
||||
|
||||
vfs_s_init_class (&vfs_fish_ops);
|
||||
vfs_fish_ops.name = "fish";
|
||||
vfs_fish_ops.prefix = "sh:";
|
||||
vfs_fish_ops.data = &fish_data;
|
||||
vfs_fish_ops.data = &fish_subclass;
|
||||
vfs_fish_ops.fill_names = fish_fill_names;
|
||||
vfs_fish_ops.chmod = fish_chmod;
|
||||
vfs_fish_ops.chown = fish_chown;
|
||||
|
49
vfs/ftpfs.c
49
vfs/ftpfs.c
@ -1719,34 +1719,6 @@ static int ftpfs_fh_close (struct vfs_class *me, struct vfs_s_fh *fh)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vfs_s_data ftp_data = {
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL, /* logfile */
|
||||
|
||||
NULL, /* init_inode */
|
||||
NULL, /* free_inode */
|
||||
NULL, /* init_entry */
|
||||
|
||||
NULL, /* archive_check */
|
||||
archive_same,
|
||||
open_archive,
|
||||
free_archive,
|
||||
|
||||
ftpfs_fh_open, /* fh_open */
|
||||
ftpfs_fh_close, /* fh_close */
|
||||
|
||||
vfs_s_find_entry_linear,
|
||||
dir_load,
|
||||
dir_uptodate,
|
||||
file_store,
|
||||
|
||||
linear_start,
|
||||
linear_read,
|
||||
linear_close
|
||||
};
|
||||
|
||||
static void
|
||||
ftpfs_done (struct vfs_class *me)
|
||||
{
|
||||
@ -1765,7 +1737,7 @@ ftpfs_done (struct vfs_class *me)
|
||||
static void
|
||||
ftpfs_fill_names (struct vfs_class *me, void (*func)(char *))
|
||||
{
|
||||
struct vfs_s_super * super = ftp_data.supers;
|
||||
struct vfs_s_super *super = MEDATA->supers;
|
||||
char *name;
|
||||
|
||||
while (super){
|
||||
@ -1776,11 +1748,13 @@ ftpfs_fill_names (struct vfs_class *me, void (*func)(char *))
|
||||
}
|
||||
}
|
||||
|
||||
static struct vfs_s_subclass ftpfs_subclass;
|
||||
|
||||
void ftpfs_set_debug (const char *file)
|
||||
{
|
||||
logfile = fopen (file, "w+");
|
||||
if (logfile)
|
||||
ftp_data.logfile = logfile;
|
||||
ftpfs_subclass.logfile = logfile;
|
||||
}
|
||||
|
||||
static char buffer[BUF_MEDIUM];
|
||||
@ -2053,11 +2027,24 @@ static int lookup_netrc (const char *host, char **login, char **pass)
|
||||
void
|
||||
init_ftpfs (void)
|
||||
{
|
||||
ftpfs_subclass.archive_same = archive_same;
|
||||
ftpfs_subclass.open_archive = open_archive;
|
||||
ftpfs_subclass.free_archive = free_archive;
|
||||
ftpfs_subclass.fh_open = ftpfs_fh_open;
|
||||
ftpfs_subclass.fh_close = ftpfs_fh_close;
|
||||
ftpfs_subclass.find_entry = vfs_s_find_entry_linear;
|
||||
ftpfs_subclass.dir_load = dir_load;
|
||||
ftpfs_subclass.dir_uptodate = dir_uptodate;
|
||||
ftpfs_subclass.file_store = file_store;
|
||||
ftpfs_subclass.linear_start = linear_start;
|
||||
ftpfs_subclass.linear_read = linear_read;
|
||||
ftpfs_subclass.linear_close = linear_close;
|
||||
|
||||
vfs_s_init_class (&vfs_ftpfs_ops);
|
||||
vfs_ftpfs_ops.name = "ftpfs";
|
||||
vfs_ftpfs_ops.flags = VFSF_NOLINKS;
|
||||
vfs_ftpfs_ops.prefix = "ftp:";
|
||||
vfs_ftpfs_ops.data = &ftp_data;
|
||||
vfs_ftpfs_ops.data = &ftpfs_subclass;
|
||||
vfs_ftpfs_ops.done = &ftpfs_done;
|
||||
vfs_ftpfs_ops.fill_names = ftpfs_fill_names;
|
||||
vfs_ftpfs_ops.chmod = ftpfs_chmod;
|
||||
|
39
vfs/tar.c
39
vfs/tar.c
@ -496,41 +496,22 @@ static int tar_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vfs_s_data tarfs_data = {
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL, /* logfile */
|
||||
|
||||
NULL, /* init_inode */
|
||||
NULL, /* free_inode */
|
||||
NULL, /* init_entry */
|
||||
|
||||
tar_super_check,
|
||||
tar_super_same,
|
||||
open_archive,
|
||||
tar_free_archive,
|
||||
|
||||
tar_fh_open, /* fh_open */
|
||||
NULL, /* fh_close */
|
||||
|
||||
vfs_s_find_entry_tree,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
init_tarfs (void)
|
||||
{
|
||||
static struct vfs_s_subclass tarfs_subclass;
|
||||
|
||||
tarfs_subclass.archive_check = tar_super_check;
|
||||
tarfs_subclass.archive_same = tar_super_same;
|
||||
tarfs_subclass.open_archive = open_archive;
|
||||
tarfs_subclass.free_archive = tar_free_archive;
|
||||
tarfs_subclass.fh_open = tar_fh_open;
|
||||
tarfs_subclass.find_entry = vfs_s_find_entry_tree;
|
||||
|
||||
vfs_s_init_class (&vfs_tarfs_ops);
|
||||
vfs_tarfs_ops.name = "tarfs";
|
||||
vfs_tarfs_ops.prefix = "utar";
|
||||
vfs_tarfs_ops.data = &tarfs_data;
|
||||
vfs_tarfs_ops.data = &tarfs_subclass;
|
||||
vfs_tarfs_ops.read = tar_read;
|
||||
vfs_tarfs_ops.write = NULL;
|
||||
vfs_tarfs_ops.ungetlocalcopy = tar_ungetlocalcopy;
|
||||
|
@ -114,7 +114,7 @@ struct vfs_s_fh {
|
||||
* One of our subclasses (tar, cpio, fish, ftpfs) with data and methods.
|
||||
* Extends vfs_class. Stored in the "data" field of vfs_class.
|
||||
*/
|
||||
struct vfs_s_data {
|
||||
struct vfs_s_subclass {
|
||||
struct vfs_s_super *supers;
|
||||
int inode_counter;
|
||||
dev_t rdev;
|
||||
@ -202,7 +202,7 @@ int vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino);
|
||||
|
||||
#define ERRNOR(a, b) do { me->verrno = a; return b; } while (0)
|
||||
|
||||
#define MEDATA ((struct vfs_s_data *) me->data)
|
||||
#define MEDATA ((struct vfs_s_subclass *) me->data)
|
||||
|
||||
#define FH ((struct vfs_s_fh *) fh)
|
||||
#define FH_SUPER FH->ino->super
|
||||
|
Loading…
Reference in New Issue
Block a user