mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
* vfs.h: Rename "struct _vfs" to "struct vfs_class". Allow
calling vfs_register() in the file defining the VFS class. * vfs.c (vfs_init): Register cpiofs in cpio.c. (vfs_register): Rename to vfs_register_class(), remove "static". * direntry.c (vfs_s_init_class): New function - generic VFS class registraction for vfs_s descendants. * cpio.c: Register VFS class locally.
This commit is contained in:
parent
6a9f6d29c4
commit
b2edfddd7e
@ -1,3 +1,13 @@
|
|||||||
|
2003-10-10 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* vfs.h: Rename "struct _vfs" to "struct vfs_class". Allow
|
||||||
|
calling vfs_register() in the file defining the VFS class.
|
||||||
|
* vfs.c (vfs_init): Register cpiofs in cpio.c.
|
||||||
|
(vfs_register): Rename to vfs_register_class(), remove "static".
|
||||||
|
* direntry.c (vfs_s_init_class): New function - generic VFS
|
||||||
|
class registraction for vfs_s descendants.
|
||||||
|
* cpio.c: Register VFS class locally.
|
||||||
|
|
||||||
2003-10-07 Pavel Roskin <proski@gnu.org>
|
2003-10-07 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* direntry.c: Make functions static when possible.
|
* direntry.c: Make functions static when possible.
|
||||||
|
72
vfs/cpio.c
72
vfs/cpio.c
@ -45,6 +45,8 @@ enum {
|
|||||||
CPIO_CRC /* New ASCII format + CRC */
|
CPIO_CRC /* New ASCII format + CRC */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct vfs_class vfs_cpiofs_ops;
|
||||||
|
|
||||||
struct old_cpio_header
|
struct old_cpio_header
|
||||||
{
|
{
|
||||||
unsigned short c_magic;
|
unsigned short c_magic;
|
||||||
@ -620,61 +622,15 @@ static struct vfs_s_data cpiofs_data = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
vfs vfs_cpiofs_ops = {
|
void
|
||||||
NULL, /* next pointer */
|
init_cpiofs (void)
|
||||||
"cpiofs",
|
{
|
||||||
0, /* flags */
|
vfs_s_init_class (&vfs_cpiofs_ops);
|
||||||
"ucpio", /* prefix */
|
vfs_cpiofs_ops.name = "cpiofs";
|
||||||
&cpiofs_data, /* vfs_s_data */
|
vfs_cpiofs_ops.prefix = "ucpio";
|
||||||
0, /* errno */
|
vfs_cpiofs_ops.data = &cpiofs_data;
|
||||||
|
vfs_cpiofs_ops.read = cpio_read;
|
||||||
NULL,
|
vfs_cpiofs_ops.write = NULL;
|
||||||
NULL,
|
vfs_cpiofs_ops.ungetlocalcopy = cpio_ungetlocalcopy;
|
||||||
vfs_s_fill_names,
|
vfs_register_class (&vfs_cpiofs_ops);
|
||||||
|
}
|
||||||
NULL,
|
|
||||||
|
|
||||||
vfs_s_open,
|
|
||||||
vfs_s_close,
|
|
||||||
cpio_read,
|
|
||||||
NULL,
|
|
||||||
|
|
||||||
vfs_s_opendir,
|
|
||||||
vfs_s_readdir,
|
|
||||||
vfs_s_closedir,
|
|
||||||
vfs_s_telldir,
|
|
||||||
vfs_s_seekdir,
|
|
||||||
|
|
||||||
vfs_s_stat,
|
|
||||||
vfs_s_lstat,
|
|
||||||
vfs_s_fstat,
|
|
||||||
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
|
|
||||||
vfs_s_readlink,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
|
|
||||||
NULL,
|
|
||||||
vfs_s_chdir,
|
|
||||||
vfs_s_ferrno,
|
|
||||||
vfs_s_lseek,
|
|
||||||
NULL,
|
|
||||||
|
|
||||||
vfs_s_getid,
|
|
||||||
vfs_s_nothingisopen,
|
|
||||||
vfs_s_free,
|
|
||||||
|
|
||||||
vfs_s_getlocalcopy,
|
|
||||||
cpio_ungetlocalcopy,
|
|
||||||
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
|
|
||||||
MMAPNULL
|
|
||||||
};
|
|
||||||
|
@ -1108,6 +1108,32 @@ vfs_s_free (vfsid id)
|
|||||||
vfs_s_free_super (((vfs_s_super *)id)->me, (vfs_s_super *)id);
|
vfs_s_free_super (((vfs_s_super *)id)->me, (vfs_s_super *)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vfs_s_init_class (struct vfs_class *vclass)
|
||||||
|
{
|
||||||
|
vclass->fill_names = vfs_s_fill_names;
|
||||||
|
vclass->open = vfs_s_open;
|
||||||
|
vclass->close = vfs_s_close;
|
||||||
|
vclass->read = vfs_s_read;
|
||||||
|
vclass->write = vfs_s_write;
|
||||||
|
vclass->opendir = vfs_s_opendir;
|
||||||
|
vclass->readdir = vfs_s_readdir;
|
||||||
|
vclass->closedir = vfs_s_closedir;
|
||||||
|
vclass->telldir = vfs_s_telldir;
|
||||||
|
vclass->seekdir = vfs_s_seekdir;
|
||||||
|
vclass->stat = vfs_s_stat;
|
||||||
|
vclass->lstat = vfs_s_lstat;
|
||||||
|
vclass->fstat = vfs_s_fstat;
|
||||||
|
vclass->readlink = vfs_s_readlink;
|
||||||
|
vclass->chdir = vfs_s_chdir;
|
||||||
|
vclass->ferrno = vfs_s_ferrno;
|
||||||
|
vclass->lseek = vfs_s_lseek;
|
||||||
|
vclass->getid = vfs_s_getid;
|
||||||
|
vclass->nothingisopen = vfs_s_nothingisopen;
|
||||||
|
vclass->free = vfs_s_free;
|
||||||
|
vclass->getlocalcopy = vfs_s_getlocalcopy;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------- Utility functions for networked filesystems -------------- */
|
/* ----------- Utility functions for networked filesystems -------------- */
|
||||||
|
|
||||||
#ifdef USE_NETCODE
|
#ifdef USE_NETCODE
|
||||||
|
22
vfs/vfs.c
22
vfs/vfs.c
@ -94,8 +94,8 @@ get_bucket (void)
|
|||||||
/* vfs_local_ops needs to be the first one */
|
/* vfs_local_ops needs to be the first one */
|
||||||
static vfs *vfs_list = &vfs_local_ops;
|
static vfs *vfs_list = &vfs_local_ops;
|
||||||
|
|
||||||
static int
|
int
|
||||||
vfs_register (vfs *vfs)
|
vfs_register_class (vfs *vfs)
|
||||||
{
|
{
|
||||||
if (!vfs)
|
if (!vfs)
|
||||||
vfs_die("You cannot register NULL.");
|
vfs_die("You cannot register NULL.");
|
||||||
@ -1239,23 +1239,23 @@ vfs_init (void)
|
|||||||
|
|
||||||
#ifdef USE_NETCODE
|
#ifdef USE_NETCODE
|
||||||
tcp_init();
|
tcp_init();
|
||||||
vfs_register (&vfs_ftpfs_ops);
|
vfs_register_class (&vfs_ftpfs_ops);
|
||||||
vfs_register (&vfs_fish_ops);
|
vfs_register_class (&vfs_fish_ops);
|
||||||
#ifdef WITH_SMBFS
|
#ifdef WITH_SMBFS
|
||||||
vfs_register (&vfs_smbfs_ops);
|
vfs_register_class (&vfs_smbfs_ops);
|
||||||
#endif /* WITH_SMBFS */
|
#endif /* WITH_SMBFS */
|
||||||
#ifdef WITH_MCFS
|
#ifdef WITH_MCFS
|
||||||
vfs_register (&vfs_mcfs_ops);
|
vfs_register_class (&vfs_mcfs_ops);
|
||||||
#endif /* WITH_SMBFS */
|
#endif /* WITH_SMBFS */
|
||||||
#endif /* USE_NETCODE */
|
#endif /* USE_NETCODE */
|
||||||
|
|
||||||
vfs_register (&vfs_extfs_ops);
|
vfs_register_class (&vfs_extfs_ops);
|
||||||
vfs_register (&vfs_sfs_ops);
|
vfs_register_class (&vfs_sfs_ops);
|
||||||
vfs_register (&vfs_tarfs_ops);
|
vfs_register_class (&vfs_tarfs_ops);
|
||||||
vfs_register (&vfs_cpiofs_ops);
|
init_cpiofs ();
|
||||||
|
|
||||||
#ifdef USE_EXT2FSLIB
|
#ifdef USE_EXT2FSLIB
|
||||||
vfs_register (&vfs_undelfs_ops);
|
vfs_register_class (&vfs_undelfs_ops);
|
||||||
#endif /* USE_EXT2FSLIB */
|
#endif /* USE_EXT2FSLIB */
|
||||||
|
|
||||||
vfs_setup_wd ();
|
vfs_setup_wd ();
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
* has include called <sys/vfs.h>, which contains things like vfs_t.
|
* has include called <sys/vfs.h>, which contains things like vfs_t.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _vfs vfs;
|
typedef struct vfs_class vfs;
|
||||||
|
|
||||||
struct _vfs {
|
struct vfs_class {
|
||||||
vfs *next;
|
vfs *next;
|
||||||
char *name; /* "FIles over SHell" */
|
char *name; /* "FIles over SHell" */
|
||||||
int flags;
|
int flags;
|
||||||
@ -105,11 +105,12 @@
|
|||||||
MC_MAXPATHLEN + 1];
|
MC_MAXPATHLEN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Other file systems */
|
/* Register a file system class */
|
||||||
|
int vfs_register_class (struct vfs_class *vfs);
|
||||||
extern vfs vfs_local_ops;
|
extern vfs vfs_local_ops;
|
||||||
extern vfs vfs_nil_ops;
|
extern vfs vfs_nil_ops;
|
||||||
extern vfs vfs_tarfs_ops;
|
extern vfs vfs_tarfs_ops;
|
||||||
extern vfs vfs_cpiofs_ops;
|
void init_cpiofs (void);
|
||||||
|
|
||||||
extern vfs vfs_ftpfs_ops;
|
extern vfs vfs_ftpfs_ops;
|
||||||
extern vfs vfs_smbfs_ops;
|
extern vfs vfs_smbfs_ops;
|
||||||
|
@ -194,6 +194,7 @@ vfs_s_inode *vfs_s_find_inode (vfs *me, vfs_s_inode *root, char *path,
|
|||||||
vfs_s_inode *vfs_s_find_root (vfs *me, vfs_s_entry *entry);
|
vfs_s_inode *vfs_s_find_root (vfs *me, vfs_s_entry *entry);
|
||||||
|
|
||||||
/* outside interface */
|
/* outside interface */
|
||||||
|
void vfs_s_init_class (struct vfs_class *vclass);
|
||||||
char *vfs_s_get_path_mangle (vfs *me, char *inname, vfs_s_super **archive,
|
char *vfs_s_get_path_mangle (vfs *me, char *inname, vfs_s_super **archive,
|
||||||
int flags);
|
int flags);
|
||||||
void vfs_s_invalidate (vfs *me, vfs_s_super *super);
|
void vfs_s_invalidate (vfs *me, vfs_s_super *super);
|
||||||
|
Loading…
Reference in New Issue
Block a user