1
1

* extfs.c: Switch to self-registration.

* mcfs.c: Likewise.
* sfs.c: Likewise.
* smbfs.c: Likewise.
* undelfs.c: Likewise.
* vfs.s (_vfs_add_noncurrent_stamps): Temporary disable code
that uses vfs_extfs_ops.
(vfs_file_is_smb): Remove.
Этот коммит содержится в:
Pavel Roskin 2003-10-12 22:25:53 +00:00
родитель 9a5c3dda9e
Коммит 72c64a60e2
8 изменённых файлов: 199 добавлений и 324 удалений

Просмотреть файл

@ -1,5 +1,14 @@
2003-10-12 Pavel Roskin <proski@gnu.org>
* extfs.c: Switch to self-registration.
* mcfs.c: Likewise.
* sfs.c: Likewise.
* smbfs.c: Likewise.
* undelfs.c: Likewise.
* vfs.s (_vfs_add_noncurrent_stamps): Temporary disable code
that uses vfs_extfs_ops.
(vfs_file_is_smb): Remove.
* local.c: Switch to self-registration.
* vfs.c: Cache localfs class for the use in vfs_get_class().

Просмотреть файл

@ -83,6 +83,7 @@ static int extfs_which (struct vfs_class *me, char *path);
static void remove_entry (struct entry *e);
static void extfs_free (vfsid id);
static struct vfs_class vfs_extfs_ops;
static struct archive *first_archive = NULL;
static int my_errno = 0;
@ -1377,60 +1378,39 @@ static int extfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
return 0;
}
struct vfs_class vfs_extfs_ops = {
NULL, /* This is place of next pointer */
"extfs",
0, /* flags */
NULL, /* prefix */
NULL, /* data */
0, /* errno */
extfs_init,
extfs_done,
extfs_fill_names,
extfs_which,
extfs_open,
extfs_close,
extfs_read,
extfs_write,
s_opendir,
s_readdir,
s_closedir,
s_telldir,
s_seekdir,
s_stat,
s_lstat,
s_fstat,
extfs_chmod, /* chmod ... strange, returns success? */
NULL,
NULL,
s_readlink,
NULL, /* symlink */
NULL,
extfs_unlink,
NULL,
extfs_chdir,
s_errno,
extfs_lseek,
NULL,
extfs_getid,
extfs_nothingisopen,
extfs_free,
extfs_getlocalcopy,
extfs_ungetlocalcopy,
extfs_mkdir, /* mkdir */
extfs_rmdir,
NULL,
extfs_setctl
MMAPNULL
};
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 = s_opendir;
vfs_extfs_ops.readdir = s_readdir;
vfs_extfs_ops.closedir = s_closedir;
vfs_extfs_ops.telldir = s_telldir;
vfs_extfs_ops.seekdir = s_seekdir;
vfs_extfs_ops.stat = s_stat;
vfs_extfs_ops.lstat = s_lstat;
vfs_extfs_ops.fstat = s_fstat;
vfs_extfs_ops.chmod = extfs_chmod;
vfs_extfs_ops.readlink = s_readlink;
vfs_extfs_ops.unlink = extfs_unlink;
vfs_extfs_ops.chdir = extfs_chdir;
vfs_extfs_ops.ferrno = s_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);
}

Просмотреть файл

@ -77,9 +77,9 @@ typedef struct {
mcfs_connection *conn;
} mcfs_handle;
static int my_errno;
static char *mcfs_gethome (mcfs_connection * mc);
static int my_errno;
static struct vfs_class vfs_mcfs_ops;
/* Extract the hostname and username from the path */
/* path is in the form: hostname:user/remote-dir */
@ -1151,61 +1151,42 @@ mcfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
return 0;
}
struct vfs_class vfs_mcfs_ops = {
NULL, /* This is place of next pointer */
"mcfs",
0, /* flags */
"mc:", /* prefix */
NULL, /* data */
0, /* errno */
NULL,
NULL,
mcfs_fill_names,
NULL,
mcfs_open,
mcfs_close,
mcfs_read,
mcfs_write,
mcfs_opendir,
mcfs_readdir,
mcfs_closedir,
NULL,
NULL,
mcfs_stat,
mcfs_lstat,
mcfs_fstat,
mcfs_chmod,
mcfs_chown,
mcfs_utime,
mcfs_readlink,
mcfs_symlink,
mcfs_link,
mcfs_unlink,
mcfs_rename,
mcfs_chdir,
mcfs_errno,
mcfs_lseek,
mcfs_mknod,
mcfs_getid,
mcfs_nothingisopen,
mcfs_free,
NULL,
NULL,
mcfs_mkdir,
mcfs_rmdir,
NULL,
mcfs_setctl MMAPNULL
};
void
init_mcfs (void)
{
vfs_mcfs_ops.name = "mcfs";
vfs_mcfs_ops.prefix = "mc:";
vfs_mcfs_ops.fill_names = mcfs_fill_names;
vfs_mcfs_ops.open = mcfs_open;
vfs_mcfs_ops.close = mcfs_close;
vfs_mcfs_ops.read = mcfs_read;
vfs_mcfs_ops.write = mcfs_write;
vfs_mcfs_ops.opendir = mcfs_opendir;
vfs_mcfs_ops.readdir = mcfs_readdir;
vfs_mcfs_ops.closedir = mcfs_closedir;
vfs_mcfs_ops.stat = mcfs_stat;
vfs_mcfs_ops.lstat = mcfs_lstat;
vfs_mcfs_ops.fstat = mcfs_fstat;
vfs_mcfs_ops.chmod = mcfs_chmod;
vfs_mcfs_ops.chown = mcfs_chown;
vfs_mcfs_ops.utime = mcfs_utime;
vfs_mcfs_ops.readlink = mcfs_readlink;
vfs_mcfs_ops.symlink = mcfs_symlink;
vfs_mcfs_ops.link = mcfs_link;
vfs_mcfs_ops.unlink = mcfs_unlink;
vfs_mcfs_ops.rename = mcfs_rename;
vfs_mcfs_ops.chdir = mcfs_chdir;
vfs_mcfs_ops.ferrno = mcfs_errno;
vfs_mcfs_ops.lseek = mcfs_lseek;
vfs_mcfs_ops.mknod = mcfs_mknod;
vfs_mcfs_ops.getid = mcfs_getid;
vfs_mcfs_ops.nothingisopen = mcfs_nothingisopen;
vfs_mcfs_ops.free = mcfs_free;
vfs_mcfs_ops.mkdir = mcfs_mkdir;
vfs_mcfs_ops.rmdir = mcfs_rmdir;
vfs_mcfs_ops.setctl = mcfs_setctl;
vfs_register_class (&vfs_mcfs_ops);
}
static void
mcfs_free_bucket (int bucket)

Просмотреть файл

@ -31,6 +31,7 @@ struct cachedfile {
};
static struct cachedfile *head;
static struct vfs_class vfs_sfs_ops;
#define MAXFS 32
static int sfs_no = 0;
@ -392,63 +393,34 @@ sfs_which (struct vfs_class *me, char *path)
return -1;
}
struct vfs_class vfs_sfs_ops = {
NULL, /* This is place of next pointer */
"sfs",
0, /* flags */
NULL, /* prefix */
NULL, /* data */
0, /* errno */
sfs_init,
sfs_done,
sfs_fill_names,
sfs_which,
sfs_open,
local_close,
local_read,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
sfs_stat,
sfs_lstat,
local_fstat,
sfs_chmod,
sfs_chown,
sfs_utime,
sfs_readlink,
NULL,
NULL,
NULL,
NULL,
NULL,
local_errno,
local_lseek,
NULL,
sfs_getid,
sfs_nothingisopen,
sfs_free,
sfs_getlocalcopy,
sfs_ungetlocalcopy,
NULL,
NULL,
NULL,
NULL
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;
#ifdef HAVE_MMAP
,local_mmap,
local_munmap
vfs_sfs_ops.mmap = local_mmap;
vfs_sfs_ops.munmap = local_munmap;
#endif
};
vfs_register_class (&vfs_sfs_ops);
}

Просмотреть файл

@ -19,7 +19,7 @@
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Namespace: exports vfs_smbfs_ops, smbfs_set_debug(), smbfs_set_debugf() */
/* Namespace: exports init_smbfs, smbfs_set_debug(), smbfs_set_debugf() */
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
@ -66,6 +66,7 @@ static gboolean got_user = FALSE;
static gboolean got_pass = FALSE;
static pstring password;
static pstring username;
static struct vfs_class vfs_smbfs_ops;
static struct _smbfs_connection {
struct cli_state *cli;
@ -1887,59 +1888,41 @@ smbfs_fstat (void *data, struct stat *buf)
return 0;
}
struct vfs_class vfs_smbfs_ops = {
NULL, /* This is place of next pointer */
"smbfs",
VFSF_NOLINKS, /* flags */
"smb:", /* prefix */
NULL, /* data */
0, /* errno */
smbfs_init,
NULL,
smbfs_fill_names,
NULL,
smbfs_open,
smbfs_close,
smbfs_read,
smbfs_write,
smbfs_opendir,
smbfs_readdir,
smbfs_closedir,
NULL,
NULL,
smbfs_stat,
smbfs_lstat,
smbfs_fstat,
smbfs_chmod,
smbfs_chown,
smbfs_utime,
smbfs_readlink,
smbfs_symlink,
smbfs_link,
smbfs_unlink,
smbfs_rename,
smbfs_chdir,
smbfs_errno,
smbfs_lseek,
smbfs_mknod,
smbfs_getid,
smbfs_nothingisopen,
smbfs_free,
NULL,
NULL,
smbfs_mkdir,
smbfs_rmdir,
NULL,
smbfs_setctl
MMAPNULL
};
void
init_smbfs (void)
{
vfs_smbfs_ops.name = "smbfs";
vfs_smbfs_ops.prefix = "smb:";
vfs_smbfs_ops.flags = VFSF_NOLINKS;
vfs_smbfs_ops.init = smbfs_init;
vfs_smbfs_ops.fill_names = smbfs_fill_names;
vfs_smbfs_ops.open = smbfs_open;
vfs_smbfs_ops.close = smbfs_close;
vfs_smbfs_ops.read = smbfs_read;
vfs_smbfs_ops.write = smbfs_write;
vfs_smbfs_ops.opendir = smbfs_opendir;
vfs_smbfs_ops.readdir = smbfs_readdir;
vfs_smbfs_ops.closedir = smbfs_closedir;
vfs_smbfs_ops.stat = smbfs_stat;
vfs_smbfs_ops.lstat = smbfs_lstat;
vfs_smbfs_ops.fstat = smbfs_fstat;
vfs_smbfs_ops.chmod = smbfs_chmod;
vfs_smbfs_ops.chown = smbfs_chown;
vfs_smbfs_ops.utime = smbfs_utime;
vfs_smbfs_ops.readlink = smbfs_readlink;
vfs_smbfs_ops.symlink = smbfs_symlink;
vfs_smbfs_ops.link = smbfs_link;
vfs_smbfs_ops.unlink = smbfs_unlink;
vfs_smbfs_ops.rename = smbfs_rename;
vfs_smbfs_ops.chdir = smbfs_chdir;
vfs_smbfs_ops.ferrno = smbfs_errno;
vfs_smbfs_ops.lseek = smbfs_lseek;
vfs_smbfs_ops.mknod = smbfs_mknod;
vfs_smbfs_ops.getid = smbfs_getid;
vfs_smbfs_ops.nothingisopen = smbfs_nothingisopen;
vfs_smbfs_ops.free = smbfs_free;
vfs_smbfs_ops.mkdir = smbfs_mkdir;
vfs_smbfs_ops.rmdir = smbfs_rmdir;
vfs_smbfs_ops.setctl = smbfs_setctl;
vfs_register_class (&vfs_smbfs_ops);
}

Просмотреть файл

@ -76,6 +76,7 @@ static char *block_buf;
static char *undelfserr = N_(" undelfs: error ");
static int readdir_ptr;
static int undelfs_usage;
static struct vfs_class vfs_undelfs_ops;
/* To generate the . and .. entries use -2 */
#define READDIR_PTR_INIT 0
@ -666,59 +667,25 @@ undelfs_init(struct vfs_class *me) {
#define undelfs_init NULL
#endif
struct vfs_class vfs_undelfs_ops = {
NULL, /* This is place of next pointer */
"undelfs",
0, /* flags */
"undel:", /* prefix */
NULL, /* data */
0, /* errno */
undelfs_init,
NULL,
NULL, /* fill_names */
NULL,
undelfs_open,
undelfs_close,
undelfs_read,
NULL,
undelfs_opendir,
undelfs_readdir,
undelfs_closedir,
NULL,
NULL,
undelfs_stat,
undelfs_lstat,
undelfs_fstat,
NULL,
NULL,
NULL,
NULL, /* readlink */
NULL,
NULL,
NULL,
NULL,
undelfs_chdir,
NULL,
undelfs_lseek,
NULL,
undelfs_getid,
undelfs_nothingisopen,
undelfs_free,
NULL, /* get_local_copy */
NULL,
NULL,
NULL,
NULL,
NULL
MMAPNULL
};
void
init_undelfs (void)
{
vfs_undelfs_ops.name = "undelfs";
vfs_undelfs_ops.prefix = "undel:";
vfs_undelfs_ops.init = undelfs_init;
vfs_undelfs_ops.open = undelfs_open;
vfs_undelfs_ops.close = undelfs_close;
vfs_undelfs_ops.read = undelfs_read;
vfs_undelfs_ops.opendir = undelfs_opendir;
vfs_undelfs_ops.readdir = undelfs_readdir;
vfs_undelfs_ops.closedir = undelfs_closedir;
vfs_undelfs_ops.stat = undelfs_stat;
vfs_undelfs_ops.lstat = undelfs_lstat;
vfs_undelfs_ops.fstat = undelfs_fstat;
vfs_undelfs_ops.chdir = undelfs_chdir;
vfs_undelfs_ops.lseek = undelfs_lseek;
vfs_undelfs_ops.getid = undelfs_getid;
vfs_undelfs_ops.nothingisopen = undelfs_nothingisopen;
vfs_undelfs_ops.free = undelfs_free;
vfs_register_class (&vfs_undelfs_ops);
}

Просмотреть файл

@ -826,11 +826,13 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid, struct vfs
}
if ((*oldvfs->nothingisopen) (oldvfsid)){
#if 0 /* need setctl for this */
if (oldvfs == &vfs_extfs_ops && ((extfs_archive *) oldvfsid)->name == 0){
/* Free the resources immediatly when we leave a mtools fs
('cd a:') instead of waiting for the vfs-timeout */
(oldvfs->free) (oldvfsid);
} else
#endif
vfs_addstamp (oldvfs, oldvfsid, parent);
for (stamp = parent; stamp != NULL; stamp = stamp->parent){
if ((stamp->v == nvfs && stamp->id == nvfsid) ||
@ -839,10 +841,12 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid, struct vfs
stamp->id == (vfsid) - 1 ||
!(*stamp->v->nothingisopen) (stamp->id))
break;
#if 0
if (stamp->v == &vfs_extfs_ops && ((extfs_archive *) stamp->id)->name == 0){
(stamp->v->free) (stamp->id);
vfs_rmstamp (stamp->v, stamp->id, 0);
} else
#endif
vfs_addstamp (stamp->v, stamp->id, stamp->parent);
}
}
@ -959,21 +963,6 @@ vfs_file_class_flags (const char *filename)
return vfs->flags;
}
int
vfs_file_is_smb (const char *filename)
{
#ifdef WITH_SMBFS
#ifdef USE_NETCODE
struct vfs_class *vfs;
char *fname = vfs_canon (filename);
vfs = vfs_get_class (fname);
g_free (fname);
return vfs == &vfs_smbfs_ops;
#endif /* USE_NETCODE */
#endif /* WITH_SMBFS */
return 0;
}
MC_NAMEOP (mkdir, (char *path, mode_t mode), (vfs, path, mode))
MC_NAMEOP (rmdir, (char *path), (vfs, path))
MC_NAMEOP (mknod, (char *path, int mode, int dev), (vfs, path, mode, dev))
@ -1226,27 +1215,27 @@ vfs_init (void)
/* fallback value for vfs_get_class() */
localfs_class = vfs_list;
init_extfs ();
init_sfs ();
init_tarfs ();
init_cpiofs ();
#ifdef USE_EXT2FSLIB
init_undelfs ();
#endif /* USE_EXT2FSLIB */
#ifdef USE_NETCODE
tcp_init();
init_ftpfs ();
init_fish ();
#ifdef WITH_SMBFS
vfs_register_class (&vfs_smbfs_ops);
init_smbfs ();
#endif /* WITH_SMBFS */
#ifdef WITH_MCFS
vfs_register_class (&vfs_mcfs_ops);
init_mcfs ();
#endif /* WITH_SMBFS */
#endif /* USE_NETCODE */
vfs_register_class (&vfs_extfs_ops);
vfs_register_class (&vfs_sfs_ops);
init_tarfs ();
init_cpiofs ();
#ifdef USE_EXT2FSLIB
vfs_register_class (&vfs_undelfs_ops);
#endif /* USE_EXT2FSLIB */
vfs_setup_wd ();
}

Просмотреть файл

@ -99,16 +99,16 @@ union vfs_dirent {
int vfs_register_class (struct vfs_class *vfs);
void init_cpiofs (void);
void init_extfs (void);
void init_fish (void);
void init_ftpfs (void);
void init_tarfs (void);
void init_localfs (void);
extern struct vfs_class vfs_smbfs_ops;
extern struct vfs_class vfs_mcfs_ops;
extern struct vfs_class vfs_extfs_ops;
extern struct vfs_class vfs_sfs_ops;
extern struct vfs_class vfs_undelfs_ops;
void init_localfs (void);
void init_mcfs (void);
void init_sfs (void);
void init_smbfs (void);
void init_tarfs (void);
void init_undelfs (void);
void vfs_init (void);
void vfs_shut (void);
@ -271,12 +271,6 @@ void vfs_print_stats (const char *fs_name, const char *action,
* cases (ftp transfer). -- pavel@ucw.cz
*/
#ifdef HAVE_MMAP
#define MMAPNULL , NULL, NULL
#else
#define MMAPNULL
#endif
/* And now some defines for our errors. */
#ifdef ENOSYS