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> 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. * local.c: Switch to self-registration.
* vfs.c: Cache localfs class for the use in vfs_get_class(). * 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 remove_entry (struct entry *e);
static void extfs_free (vfsid id); static void extfs_free (vfsid id);
static struct vfs_class vfs_extfs_ops;
static struct archive *first_archive = NULL; static struct archive *first_archive = NULL;
static int my_errno = 0; 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; return 0;
} }
struct vfs_class vfs_extfs_ops = { void
NULL, /* This is place of next pointer */ init_extfs (void)
"extfs", {
0, /* flags */ vfs_extfs_ops.name = "extfs";
NULL, /* prefix */ vfs_extfs_ops.init = extfs_init;
NULL, /* data */ vfs_extfs_ops.done = extfs_done;
0, /* errno */ vfs_extfs_ops.fill_names = extfs_fill_names;
extfs_init, vfs_extfs_ops.which = extfs_which;
extfs_done, vfs_extfs_ops.open = extfs_open;
extfs_fill_names, vfs_extfs_ops.close = extfs_close;
extfs_which, vfs_extfs_ops.read = extfs_read;
vfs_extfs_ops.write = extfs_write;
extfs_open, vfs_extfs_ops.opendir = s_opendir;
extfs_close, vfs_extfs_ops.readdir = s_readdir;
extfs_read, vfs_extfs_ops.closedir = s_closedir;
extfs_write, vfs_extfs_ops.telldir = s_telldir;
vfs_extfs_ops.seekdir = s_seekdir;
s_opendir, vfs_extfs_ops.stat = s_stat;
s_readdir, vfs_extfs_ops.lstat = s_lstat;
s_closedir, vfs_extfs_ops.fstat = s_fstat;
s_telldir, vfs_extfs_ops.chmod = extfs_chmod;
s_seekdir, vfs_extfs_ops.readlink = s_readlink;
vfs_extfs_ops.unlink = extfs_unlink;
s_stat, vfs_extfs_ops.chdir = extfs_chdir;
s_lstat, vfs_extfs_ops.ferrno = s_errno;
s_fstat, vfs_extfs_ops.lseek = extfs_lseek;
vfs_extfs_ops.getid = extfs_getid;
extfs_chmod, /* chmod ... strange, returns success? */ vfs_extfs_ops.nothingisopen = extfs_nothingisopen;
NULL, vfs_extfs_ops.free = extfs_free;
NULL, vfs_extfs_ops.getlocalcopy = extfs_getlocalcopy;
vfs_extfs_ops.ungetlocalcopy = extfs_ungetlocalcopy;
s_readlink, vfs_extfs_ops.mkdir = extfs_mkdir;
vfs_extfs_ops.rmdir = extfs_rmdir;
NULL, /* symlink */ vfs_extfs_ops.setctl = extfs_setctl;
NULL, vfs_register_class (&vfs_extfs_ops);
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
};

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

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

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

@ -31,6 +31,7 @@ struct cachedfile {
}; };
static struct cachedfile *head; static struct cachedfile *head;
static struct vfs_class vfs_sfs_ops;
#define MAXFS 32 #define MAXFS 32
static int sfs_no = 0; static int sfs_no = 0;
@ -392,63 +393,34 @@ sfs_which (struct vfs_class *me, char *path)
return -1; return -1;
} }
struct vfs_class vfs_sfs_ops = { void
NULL, /* This is place of next pointer */ init_sfs (void)
"sfs", {
0, /* flags */ vfs_sfs_ops.name = "sfs";
NULL, /* prefix */ vfs_sfs_ops.init = sfs_init;
NULL, /* data */ vfs_sfs_ops.done = sfs_done;
0, /* errno */ vfs_sfs_ops.fill_names = sfs_fill_names;
sfs_init, vfs_sfs_ops.which = sfs_which;
sfs_done, vfs_sfs_ops.open = sfs_open;
sfs_fill_names, vfs_sfs_ops.close = local_close;
sfs_which, vfs_sfs_ops.read = local_read;
vfs_sfs_ops.stat = sfs_stat;
sfs_open, vfs_sfs_ops.lstat = sfs_lstat;
local_close, vfs_sfs_ops.fstat = local_fstat;
local_read, vfs_sfs_ops.chmod = sfs_chmod;
NULL, vfs_sfs_ops.chown = sfs_chown;
vfs_sfs_ops.utime = sfs_utime;
NULL, vfs_sfs_ops.readlink = sfs_readlink;
NULL, vfs_sfs_ops.ferrno = local_errno;
NULL, vfs_sfs_ops.lseek = local_lseek;
NULL, vfs_sfs_ops.getid = sfs_getid;
NULL, vfs_sfs_ops.nothingisopen = sfs_nothingisopen;
vfs_sfs_ops.free = sfs_free;
sfs_stat, vfs_sfs_ops.getlocalcopy = sfs_getlocalcopy;
sfs_lstat, vfs_sfs_ops.ungetlocalcopy = sfs_ungetlocalcopy;
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
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
,local_mmap, vfs_sfs_ops.mmap = local_mmap;
local_munmap vfs_sfs_ops.munmap = local_munmap;
#endif #endif
}; vfs_register_class (&vfs_sfs_ops);
}

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

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

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

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

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

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

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

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