mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-12 10:53:23 +03:00
* vfs.c (vfs_type): Rename to vfs_get_class(). Fix prototype to
avoid using internal vfs type. Adjust all dependencies. (vfs_rosplit): Rename to _vfs_get_class().
This commit is contained in:
parent
f1288c7338
commit
9d1f2aae71
12
src/file.c
12
src/file.c
@ -280,7 +280,7 @@ is_in_linklist (struct link *lp, char *path, struct stat *sb)
|
||||
ino_t ino = sb->st_ino;
|
||||
dev_t dev = sb->st_dev;
|
||||
#ifdef USE_VFS
|
||||
struct vfs_class *vfs = vfs_type (path);
|
||||
struct vfs_class *vfs = vfs_get_class (path);
|
||||
#endif /* USE_VFS */
|
||||
|
||||
while (lp) {
|
||||
@ -302,7 +302,7 @@ static int
|
||||
check_hardlinks (char *src_name, char *dst_name, struct stat *pstat)
|
||||
{
|
||||
struct link *lp;
|
||||
struct vfs_class *my_vfs = vfs_type (src_name);
|
||||
struct vfs_class *my_vfs = vfs_get_class (src_name);
|
||||
ino_t ino = pstat->st_ino;
|
||||
dev_t dev = pstat->st_dev;
|
||||
struct stat link_stat;
|
||||
@ -316,10 +316,10 @@ check_hardlinks (char *src_name, char *dst_name, struct stat *pstat)
|
||||
if (lp->vfs == my_vfs && lp->ino == ino && lp->dev == dev) {
|
||||
if (!mc_stat (lp->name, &link_stat) && link_stat.st_ino == ino
|
||||
&& link_stat.st_dev == dev
|
||||
&& vfs_type (lp->name) == my_vfs) {
|
||||
&& vfs_get_class (lp->name) == my_vfs) {
|
||||
p = strchr (lp->name, 0) + 1; /* i.e. where the `name' file
|
||||
was copied to */
|
||||
if (vfs_type (dst_name) == vfs_type (p)) {
|
||||
if (vfs_get_class (dst_name) == vfs_get_class (p)) {
|
||||
if (!mc_stat (p, &link_stat)) {
|
||||
if (!mc_link (p, dst_name))
|
||||
return 1;
|
||||
@ -925,7 +925,7 @@ copy_dir_dir (FileOpContext *ctx, char *s, char *d, int toplevel,
|
||||
}
|
||||
|
||||
lp = g_new (struct link, 1);
|
||||
lp->vfs = vfs_type (s);
|
||||
lp->vfs = vfs_get_class (s);
|
||||
lp->ino = cbuf.st_ino;
|
||||
lp->dev = cbuf.st_dev;
|
||||
lp->next = parent_dirs;
|
||||
@ -994,7 +994,7 @@ copy_dir_dir (FileOpContext *ctx, char *s, char *d, int toplevel,
|
||||
|
||||
lp = g_new (struct link, 1);
|
||||
mc_stat (dest_dir, &buf);
|
||||
lp->vfs = vfs_type (dest_dir);
|
||||
lp->vfs = vfs_get_class (dest_dir);
|
||||
lp->ino = buf.st_ino;
|
||||
lp->dev = buf.st_dev;
|
||||
lp->next = dest_dirs;
|
||||
|
@ -616,7 +616,7 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
||||
mc_get_current_wd (panel->cwd, sizeof (panel->cwd) - 2);
|
||||
|
||||
#ifdef USE_VFS
|
||||
oldvfs = vfs_type (olddir);
|
||||
oldvfs = vfs_get_class (olddir);
|
||||
oldvfsid = vfs_ncs_getid (oldvfs, olddir, &parent);
|
||||
vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
|
||||
vfs_rm_parents (parent);
|
||||
|
@ -1,5 +1,9 @@
|
||||
2003-10-11 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* vfs.c (vfs_type): Rename to vfs_get_class(). Fix prototype to
|
||||
avoid using internal vfs type. Adjust all dependencies.
|
||||
(vfs_rosplit): Rename to _vfs_get_class().
|
||||
|
||||
* cpio.c (init_cpiofs): Set vfs_cpiofs_ops.setctl to NULL, or
|
||||
bad things happen after unsuccessful deletion.
|
||||
|
||||
|
@ -461,7 +461,7 @@ vfs_s_stamp_me (vfs *me, struct vfs_s_super *psup, char *fs_name)
|
||||
struct vfs_stamping *parent;
|
||||
vfs *v;
|
||||
|
||||
v = vfs_type (fs_name);
|
||||
v = vfs_get_class (fs_name);
|
||||
if (v == &vfs_local_ops){
|
||||
parent = NULL;
|
||||
} else {
|
||||
@ -886,7 +886,7 @@ vfs_s_close (void *fh)
|
||||
struct vfs_stamping *parent;
|
||||
vfs *v;
|
||||
|
||||
v = vfs_type (FH_SUPER->name);
|
||||
v = vfs_get_class (FH_SUPER->name);
|
||||
if (v == &vfs_local_ops){
|
||||
parent = NULL;
|
||||
} else {
|
||||
@ -1083,7 +1083,7 @@ vfs_s_getid (vfs *me, char *path, struct vfs_stamping **parent)
|
||||
if (!(p = vfs_s_get_path (me, path, &archive, FL_NO_OPEN)))
|
||||
return (vfsid) -1;
|
||||
g_free(p);
|
||||
v = vfs_type (archive->name);
|
||||
v = vfs_get_class (archive->name);
|
||||
id = (*v->getid) (v, archive->name, &par);
|
||||
if (id != (vfsid)-1){
|
||||
*parent = g_new (struct vfs_stamping, 1);
|
||||
|
@ -456,7 +456,7 @@ get_path_mangle (char *inname, struct archive **archive, int is_dir,
|
||||
ERRNOR (EIO, NULL);
|
||||
|
||||
if (archive_name) {
|
||||
v = vfs_type (archive_name);
|
||||
v = vfs_get_class (archive_name);
|
||||
if (v == &vfs_local_ops) {
|
||||
parent = NULL;
|
||||
} else {
|
||||
@ -738,7 +738,7 @@ static int extfs_close (void *data)
|
||||
struct vfs_stamping *parent;
|
||||
vfs *v;
|
||||
|
||||
if (!file->archive->name || !*file->archive->name || (v = vfs_type (file->archive->name)) == &vfs_local_ops) {
|
||||
if (!file->archive->name || !*file->archive->name || (v = vfs_get_class (file->archive->name)) == &vfs_local_ops) {
|
||||
parent = NULL;
|
||||
} else {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
@ -1146,7 +1146,7 @@ static vfsid extfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
|
||||
return (vfsid) -1;
|
||||
g_free(p);
|
||||
if (archive->name){
|
||||
v = vfs_type (archive->name);
|
||||
v = vfs_get_class (archive->name);
|
||||
id = (*v->getid) (v, archive->name, &par);
|
||||
if (id != (vfsid)-1) {
|
||||
*parent = g_new (struct vfs_stamping, 1);
|
||||
|
46
vfs/vfs.c
46
vfs/vfs.c
@ -222,7 +222,7 @@ vfs_split (char *path, char **inpath, char **op)
|
||||
}
|
||||
|
||||
static vfs *
|
||||
vfs_rosplit (char *path)
|
||||
_vfs_get_class (char *path)
|
||||
{
|
||||
char *semi;
|
||||
char *slash;
|
||||
@ -244,18 +244,18 @@ vfs_rosplit (char *path)
|
||||
if (slash)
|
||||
*slash = PATH_SEP;
|
||||
if (!ret)
|
||||
ret = vfs_rosplit (path);
|
||||
ret = _vfs_get_class (path);
|
||||
|
||||
*semi = '#';
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfs *
|
||||
vfs_type (char *path)
|
||||
vfs_get_class (char *path)
|
||||
{
|
||||
vfs *vfs;
|
||||
|
||||
vfs = vfs_rosplit(path);
|
||||
vfs = _vfs_get_class(path);
|
||||
|
||||
if (!vfs)
|
||||
vfs = &vfs_local_ops;
|
||||
@ -386,7 +386,7 @@ mc_open (const char *filename, int flags, ...)
|
||||
va_list ap;
|
||||
|
||||
char *file = vfs_canon (filename);
|
||||
vfs *vfs = vfs_type (file);
|
||||
vfs *vfs = vfs_get_class (file);
|
||||
|
||||
/* Get the mode flag */ /* FIXME: should look if O_CREAT is present */
|
||||
va_start (ap, flags);
|
||||
@ -430,7 +430,7 @@ mc_open (const char *filename, int flags, ...)
|
||||
}
|
||||
|
||||
#define MC_NAMEOP(name, inarg, callarg) \
|
||||
MC_OP (name, inarg, callarg, path = vfs_canon (path); vfs = vfs_type (path);, g_free (path); )
|
||||
MC_OP (name, inarg, callarg, path = vfs_canon (path); vfs = vfs_get_class (path);, g_free (path); )
|
||||
#define MC_HANDLEOP(name, inarg, callarg) \
|
||||
MC_OP (name, inarg, callarg, if (handle == -1) return -1; vfs = vfs_op (handle);, ;)
|
||||
|
||||
@ -454,7 +454,7 @@ mc_setctl (char *path, int ctlop, char *arg)
|
||||
vfs_die("You don't want to pass NULL to mc_setctl.");
|
||||
|
||||
path = vfs_canon (path);
|
||||
vfs = vfs_type (path);
|
||||
vfs = vfs_get_class (path);
|
||||
result = vfs->setctl ? (*vfs->setctl)(vfs, path, ctlop, arg) : 0;
|
||||
g_free (path);
|
||||
return result;
|
||||
@ -491,7 +491,7 @@ mc_opendir (char *dirname)
|
||||
vfs *vfs;
|
||||
|
||||
dirname = vfs_canon (dirname);
|
||||
vfs = vfs_type (dirname);
|
||||
vfs = vfs_get_class (dirname);
|
||||
|
||||
info = vfs->opendir ? (*vfs->opendir)(vfs, dirname) : NULL;
|
||||
g_free (dirname);
|
||||
@ -565,7 +565,7 @@ int mc_stat (const char *filename, struct stat *buf) {
|
||||
vfs *vfs;
|
||||
int result;
|
||||
char *path;
|
||||
path = vfs_canon (filename); vfs = vfs_type (path);
|
||||
path = vfs_canon (filename); vfs = vfs_get_class (path);
|
||||
result = vfs->stat ? (*vfs->stat) (vfs, path, buf) : -1;
|
||||
g_free (path);
|
||||
if (result == -1)
|
||||
@ -577,7 +577,7 @@ int mc_lstat (const char *filename, struct stat *buf) {
|
||||
vfs *vfs;
|
||||
int result;
|
||||
char *path;
|
||||
path = vfs_canon (filename); vfs = vfs_type (path);
|
||||
path = vfs_canon (filename); vfs = vfs_get_class (path);
|
||||
result = vfs->lstat ? (*vfs->lstat) (vfs, path, buf) : -1;
|
||||
g_free (path);
|
||||
if (result == -1)
|
||||
@ -608,7 +608,7 @@ _vfs_get_cwd (void)
|
||||
char *p;
|
||||
struct stat my_stat, my_stat2;
|
||||
|
||||
if (!vfs_rosplit (current_dir)) {
|
||||
if (!_vfs_get_class (current_dir)) {
|
||||
p = g_get_current_dir ();
|
||||
if (!p) /* One of the directories in the path is not readable */
|
||||
return current_dir;
|
||||
@ -674,9 +674,9 @@ int mc_##name (const char *fname1, const char *fname2) \
|
||||
int result; \
|
||||
\
|
||||
char *name2, *name1 = vfs_canon (fname1); \
|
||||
vfs = vfs_type (name1); \
|
||||
vfs = vfs_get_class (name1); \
|
||||
name2 = vfs_canon (fname2); \
|
||||
if (vfs != vfs_type (name2)){ \
|
||||
if (vfs != vfs_get_class (name2)){ \
|
||||
errno = EXDEV; \
|
||||
g_free (name1); \
|
||||
g_free (name2); \
|
||||
@ -793,7 +793,7 @@ vfs_add_noncurrent_stamps (vfs * oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
|
||||
if (!cpanel)
|
||||
return;
|
||||
|
||||
nvfs = vfs_type (current_dir);
|
||||
nvfs = vfs_get_class (current_dir);
|
||||
nvfsid = vfs_ncs_getid (nvfs, current_dir, &par);
|
||||
vfs_rmstamp (nvfs, nvfsid, 1);
|
||||
|
||||
@ -804,7 +804,7 @@ vfs_add_noncurrent_stamps (vfs * oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
|
||||
}
|
||||
|
||||
if (get_current_type () == view_listing){
|
||||
n2vfs = vfs_type (cpanel->cwd);
|
||||
n2vfs = vfs_get_class (cpanel->cwd);
|
||||
n2vfsid = vfs_ncs_getid (n2vfs, cpanel->cwd, &par);
|
||||
f = is_parent (oldvfs, oldvfsid, par);
|
||||
vfs_rm_parents (par);
|
||||
@ -816,7 +816,7 @@ vfs_add_noncurrent_stamps (vfs * oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
|
||||
}
|
||||
|
||||
if (get_other_type () == view_listing){
|
||||
n3vfs = vfs_type (opanel->cwd);
|
||||
n3vfs = vfs_get_class (opanel->cwd);
|
||||
n3vfsid = vfs_ncs_getid (n3vfs, opanel->cwd, &par);
|
||||
f = is_parent (oldvfs, oldvfsid, par);
|
||||
vfs_rm_parents (par);
|
||||
@ -857,7 +857,7 @@ vfs_stamp_path (char *path)
|
||||
vfsid id;
|
||||
struct vfs_stamping *par, *stamp;
|
||||
|
||||
vfs = vfs_type (path);
|
||||
vfs = vfs_get_class (path);
|
||||
id = vfs_ncs_getid (vfs, path, &par);
|
||||
vfs_addstamp (vfs, id, par);
|
||||
|
||||
@ -896,7 +896,7 @@ mc_chdir (char *path)
|
||||
int result;
|
||||
|
||||
new_dir = vfs_canon (path);
|
||||
new_vfs = vfs_type (new_dir);
|
||||
new_vfs = vfs_get_class (new_dir);
|
||||
if (!new_vfs->chdir)
|
||||
return -1;
|
||||
|
||||
@ -944,7 +944,7 @@ int
|
||||
vfs_file_is_local (const char *file)
|
||||
{
|
||||
char *filename = vfs_canon (file);
|
||||
vfs *vfs = vfs_type (filename);
|
||||
vfs *vfs = vfs_get_class (filename);
|
||||
|
||||
g_free (filename);
|
||||
return vfs == &vfs_local_ops;
|
||||
@ -957,7 +957,7 @@ vfs_file_is_ftp (char *filename)
|
||||
vfs *vfs;
|
||||
|
||||
filename = vfs_canon (filename);
|
||||
vfs = vfs_type (filename);
|
||||
vfs = vfs_get_class (filename);
|
||||
g_free (filename);
|
||||
return vfs == &vfs_ftpfs_ops;
|
||||
#else
|
||||
@ -973,7 +973,7 @@ vfs_file_is_smb (char *filename)
|
||||
vfs *vfs;
|
||||
|
||||
filename = vfs_canon (filename);
|
||||
vfs = vfs_type (filename);
|
||||
vfs = vfs_get_class (filename);
|
||||
g_free (filename);
|
||||
return vfs == &vfs_smbfs_ops;
|
||||
#endif /* USE_NETCODE */
|
||||
@ -1101,7 +1101,7 @@ mc_getlocalcopy (const char *pathname)
|
||||
{
|
||||
char *result;
|
||||
char *path = vfs_canon (pathname);
|
||||
vfs *vfs = vfs_type (path);
|
||||
vfs *vfs = vfs_get_class (path);
|
||||
|
||||
result = vfs->getlocalcopy ? (*vfs->getlocalcopy)(vfs, path) :
|
||||
mc_def_getlocalcopy (vfs, path);
|
||||
@ -1159,7 +1159,7 @@ mc_ungetlocalcopy (const char *pathname, char *local, int has_changed)
|
||||
{
|
||||
int return_value = 0;
|
||||
char *path = vfs_canon (pathname);
|
||||
vfs *vfs = vfs_type (path);
|
||||
vfs *vfs = vfs_get_class (path);
|
||||
|
||||
return_value = vfs->ungetlocalcopy ?
|
||||
(*vfs->ungetlocalcopy)(vfs, path, local, has_changed) :
|
||||
|
460
vfs/vfs.h
460
vfs/vfs.h
@ -7,17 +7,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The following line is needed, because as usual, AIX pollutes every single
|
||||
* name space they can get their hands on
|
||||
*/
|
||||
#undef vfs_type
|
||||
|
||||
/* Our virtual file system layer */
|
||||
|
||||
typedef void * vfsid;
|
||||
|
||||
struct vfs_stamping;
|
||||
/* Our virtual file system layer */
|
||||
typedef void *vfsid;
|
||||
struct vfs_stamping;
|
||||
|
||||
/*
|
||||
* Notice: Andrej Borsenkow <borsenkow.msk@sni.de> reports system
|
||||
@ -25,265 +17,270 @@
|
||||
* has include called <sys/vfs.h>, which contains things like vfs_t.
|
||||
*/
|
||||
|
||||
typedef struct vfs_class vfs;
|
||||
typedef struct vfs_class vfs;
|
||||
|
||||
struct vfs_class {
|
||||
vfs *next;
|
||||
char *name; /* "FIles over SHell" */
|
||||
int flags;
|
||||
#define F_EXEC 1 /* Filesystem needs to execute external programs */
|
||||
#define F_NET 2 /* Filesystem needs to access network */
|
||||
char *prefix; /* "fish:" */
|
||||
void *data; /* this is for filesystem's own use */
|
||||
int verrno; /* can't use errno because glibc2 might define errno as function */
|
||||
struct vfs_class {
|
||||
vfs *next;
|
||||
char *name; /* "FIles over SHell" */
|
||||
int flags;
|
||||
#define F_EXEC 1 /* Filesystem needs to execute external programs */
|
||||
#define F_NET 2 /* Filesystem needs to access network */
|
||||
char *prefix; /* "fish:" */
|
||||
void *data; /* this is for filesystem's own use */
|
||||
int verrno; /* can't use errno because glibc2 might define errno as function */
|
||||
|
||||
int (*init) (vfs *me);
|
||||
void (*done) (vfs *me);
|
||||
void (*fill_names) (vfs *me, void (*)(char *));
|
||||
|
||||
int (*which) (vfs *me, char *path);
|
||||
|
||||
void *(*open) (vfs *me, char *fname, int flags, int mode);
|
||||
int (*close) (void *vfs_info);
|
||||
int (*read) (void *vfs_info, char *buffer, int count);
|
||||
int (*write) (void *vfs_info, char *buf, int count);
|
||||
|
||||
void *(*opendir) (vfs *me, char *dirname);
|
||||
void *(*readdir) (void *vfs_info);
|
||||
int (*closedir) (void *vfs_info);
|
||||
int (*telldir) (void *vfs_info);
|
||||
void (*seekdir) (void *vfs_info, int offset);
|
||||
|
||||
int (*stat) (vfs *me, char *path, struct stat *buf);
|
||||
int (*lstat) (vfs *me, char *path, struct stat *buf);
|
||||
int (*fstat) (void *vfs_info, struct stat *buf);
|
||||
|
||||
int (*chmod) (vfs *me, char *path, int mode);
|
||||
int (*chown) (vfs *me, char *path, int owner, int group);
|
||||
int (*utime) (vfs *me, char *path, struct utimbuf *times);
|
||||
|
||||
int (*readlink) (vfs *me, char *path, char *buf, int size);
|
||||
int (*symlink) (vfs *me, char *n1, char *n2);
|
||||
int (*link) (vfs *me, char *p1, char *p2);
|
||||
int (*unlink) (vfs *me, char *path);
|
||||
int (*rename) (vfs *me, char *p1, char *p2);
|
||||
int (*chdir) (vfs *me, char *path);
|
||||
int (*ferrno) (vfs *me);
|
||||
int (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
int (*mknod) (vfs *me, char *path, int mode, int dev);
|
||||
|
||||
vfsid (*getid) (vfs *me, char *path, struct vfs_stamping **
|
||||
parent);
|
||||
|
||||
int (*nothingisopen) (vfsid id);
|
||||
void (*free) (vfsid id);
|
||||
|
||||
char *(*getlocalcopy) (vfs *me, char *filename);
|
||||
int (*ungetlocalcopy) (vfs *me, char *filename, char *local,
|
||||
int has_changed);
|
||||
int (*init) (vfs *me);
|
||||
void (*done) (vfs *me);
|
||||
void (*fill_names) (vfs *me, void (*)(char *));
|
||||
|
||||
int (*mkdir) (vfs *me, char *path, mode_t mode);
|
||||
int (*rmdir) (vfs *me, char *path);
|
||||
|
||||
int (*ctl) (void *vfs_info, int ctlop, int arg);
|
||||
int (*setctl) (vfs *me, char *path, int ctlop, char *arg);
|
||||
int (*which) (vfs *me, char *path);
|
||||
|
||||
void *(*open) (vfs *me, char *fname, int flags, int mode);
|
||||
int (*close) (void *vfs_info);
|
||||
int (*read) (void *vfs_info, char *buffer, int count);
|
||||
int (*write) (void *vfs_info, char *buf, int count);
|
||||
|
||||
void *(*opendir) (vfs *me, char *dirname);
|
||||
void *(*readdir) (void *vfs_info);
|
||||
int (*closedir) (void *vfs_info);
|
||||
int (*telldir) (void *vfs_info);
|
||||
void (*seekdir) (void *vfs_info, int offset);
|
||||
|
||||
int (*stat) (vfs *me, char *path, struct stat * buf);
|
||||
int (*lstat) (vfs *me, char *path, struct stat * buf);
|
||||
int (*fstat) (void *vfs_info, struct stat * buf);
|
||||
|
||||
int (*chmod) (vfs *me, char *path, int mode);
|
||||
int (*chown) (vfs *me, char *path, int owner, int group);
|
||||
int (*utime) (vfs *me, char *path, struct utimbuf * times);
|
||||
|
||||
int (*readlink) (vfs *me, char *path, char *buf, int size);
|
||||
int (*symlink) (vfs *me, char *n1, char *n2);
|
||||
int (*link) (vfs *me, char *p1, char *p2);
|
||||
int (*unlink) (vfs *me, char *path);
|
||||
int (*rename) (vfs *me, char *p1, char *p2);
|
||||
int (*chdir) (vfs *me, char *path);
|
||||
int (*ferrno) (vfs *me);
|
||||
int (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
int (*mknod) (vfs *me, char *path, int mode, int dev);
|
||||
|
||||
vfsid (*getid) (vfs *me, char *path, struct vfs_stamping ** parent);
|
||||
|
||||
int (*nothingisopen) (vfsid id);
|
||||
void (*free) (vfsid id);
|
||||
|
||||
char *(*getlocalcopy) (vfs *me, char *filename);
|
||||
int (*ungetlocalcopy) (vfs *me, char *filename, char *local,
|
||||
int has_changed);
|
||||
|
||||
int (*mkdir) (vfs *me, char *path, mode_t mode);
|
||||
int (*rmdir) (vfs *me, char *path);
|
||||
|
||||
int (*ctl) (void *vfs_info, int ctlop, int arg);
|
||||
int (*setctl) (vfs *me, char *path, int ctlop, char *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t (*mmap) (vfs *me, caddr_t addr, size_t len, int prot,
|
||||
int flags, void *vfs_info, off_t offset);
|
||||
int (*munmap) (vfs *me, caddr_t addr, size_t len,
|
||||
void *vfs_info);
|
||||
#endif
|
||||
};
|
||||
caddr_t (*mmap) (vfs *me, caddr_t addr, size_t len, int prot,
|
||||
int flags, void *vfs_info, off_t offset);
|
||||
int (*munmap) (vfs *me, caddr_t addr, size_t len, void *vfs_info);
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* This union is used to ensure that there is enough space for the
|
||||
* filename (d_name) when the dirent structure is created.
|
||||
*/
|
||||
union vfs_dirent {
|
||||
struct dirent dent;
|
||||
char _extra_buffer [((int) &((struct dirent *)0)->d_name) +
|
||||
MC_MAXPATHLEN + 1];
|
||||
};
|
||||
union vfs_dirent {
|
||||
struct dirent dent;
|
||||
char _extra_buffer[((int) &((struct dirent *) 0)->d_name) +
|
||||
MC_MAXPATHLEN + 1];
|
||||
};
|
||||
|
||||
/* Register a file system class */
|
||||
int vfs_register_class (struct vfs_class *vfs);
|
||||
void init_cpiofs (void);
|
||||
void init_fish (void);
|
||||
int vfs_register_class (struct vfs_class *vfs);
|
||||
void init_cpiofs (void);
|
||||
void init_fish (void);
|
||||
|
||||
extern vfs vfs_local_ops;
|
||||
extern vfs vfs_tarfs_ops;
|
||||
extern vfs vfs_ftpfs_ops;
|
||||
extern vfs vfs_smbfs_ops;
|
||||
extern vfs vfs_mcfs_ops;
|
||||
extern vfs vfs_extfs_ops;
|
||||
extern vfs vfs_sfs_ops;
|
||||
extern vfs vfs_undelfs_ops;
|
||||
extern vfs vfs_local_ops;
|
||||
extern vfs vfs_tarfs_ops;
|
||||
extern vfs vfs_ftpfs_ops;
|
||||
extern vfs vfs_smbfs_ops;
|
||||
extern vfs vfs_mcfs_ops;
|
||||
extern vfs vfs_extfs_ops;
|
||||
extern vfs vfs_sfs_ops;
|
||||
extern vfs vfs_undelfs_ops;
|
||||
|
||||
struct vfs_stamping {
|
||||
vfs *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *parent; /* At the moment applies to tarfs only */
|
||||
struct vfs_stamping *next;
|
||||
struct timeval time;
|
||||
};
|
||||
struct vfs_stamping {
|
||||
vfs *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *parent; /* At the moment applies to tarfs only */
|
||||
struct vfs_stamping *next;
|
||||
struct timeval time;
|
||||
};
|
||||
|
||||
void vfs_init (void);
|
||||
void vfs_shut (void);
|
||||
void vfs_init (void);
|
||||
void vfs_shut (void);
|
||||
|
||||
vfs *vfs_type (char *path);
|
||||
vfs *vfs_split (char *path, char **inpath, char **op);
|
||||
vfsid vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par);
|
||||
void vfs_rm_parents (struct vfs_stamping *stamp);
|
||||
char *vfs_path (char *path);
|
||||
char *vfs_strip_suffix_from_filename (const char *filename);
|
||||
char *vfs_canon (const char *path);
|
||||
char *mc_get_current_wd (char *buffer, int bufsize);
|
||||
int vfs_current_is_local (void);
|
||||
int vfs_file_is_local (const char *name);
|
||||
int vfs_file_is_ftp (char *filename);
|
||||
int vfs_file_is_smb (char *filename);
|
||||
char *vfs_get_current_dir (void);
|
||||
struct vfs_class *vfs_get_class (char *path);
|
||||
vfs *vfs_split (char *path, char **inpath, char **op);
|
||||
vfsid vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par);
|
||||
void vfs_rm_parents (struct vfs_stamping *stamp);
|
||||
char *vfs_path (char *path);
|
||||
char *vfs_strip_suffix_from_filename (const char *filename);
|
||||
char *vfs_canon (const char *path);
|
||||
char *mc_get_current_wd (char *buffer, int bufsize);
|
||||
int vfs_current_is_local (void);
|
||||
int vfs_file_is_local (const char *name);
|
||||
int vfs_file_is_ftp (char *filename);
|
||||
int vfs_file_is_smb (char *filename);
|
||||
char *vfs_get_current_dir (void);
|
||||
|
||||
extern int vfs_timeout;
|
||||
extern int vfs_timeout;
|
||||
|
||||
void vfs_stamp (vfs *, vfsid);
|
||||
void vfs_rmstamp (vfs *, vfsid, int);
|
||||
void vfs_add_noncurrent_stamps (vfs *, vfsid, struct vfs_stamping *);
|
||||
void vfs_add_current_stamps (void);
|
||||
void vfs_timeout_handler (void);
|
||||
void vfs_expire (int);
|
||||
int vfs_timeouts (void);
|
||||
void vfs_stamp (vfs *, vfsid);
|
||||
void vfs_rmstamp (vfs *, vfsid, int);
|
||||
void vfs_add_noncurrent_stamps (vfs *, vfsid, struct vfs_stamping *);
|
||||
void vfs_add_current_stamps (void);
|
||||
void vfs_timeout_handler (void);
|
||||
void vfs_expire (int);
|
||||
int vfs_timeouts (void);
|
||||
|
||||
void vfs_fill_names (void (*)(char *));
|
||||
char *vfs_translate_url (char *);
|
||||
void vfs_fill_names (void (*)(char *));
|
||||
char *vfs_translate_url (char *);
|
||||
|
||||
void ftpfs_set_debug (const char *file);
|
||||
void ftpfs_set_debug (const char *file);
|
||||
#ifdef USE_NETCODE
|
||||
void ftpfs_hint_reread(int reread);
|
||||
void ftpfs_flushdir(void);
|
||||
extern int use_netrc;
|
||||
void ftpfs_hint_reread (int reread);
|
||||
void ftpfs_flushdir (void);
|
||||
extern int use_netrc;
|
||||
#else
|
||||
# define ftpfs_flushdir()
|
||||
# define ftpfs_hint_reread(x)
|
||||
# define ftpfs_hint_reread(x)
|
||||
#endif
|
||||
|
||||
|
||||
/* Only the routines outside of the VFS module need the emulation macros */
|
||||
|
||||
int mc_open (const char *filename, int flags, ...);
|
||||
int mc_close (int handle);
|
||||
int mc_read (int handle, char *buffer, int count);
|
||||
int mc_write (int handle, char *buffer, int count);
|
||||
off_t mc_lseek (int fd, off_t offset, int whence);
|
||||
int mc_chdir (char *);
|
||||
int mc_open (const char *filename, int flags, ...);
|
||||
int mc_close (int handle);
|
||||
int mc_read (int handle, char *buffer, int count);
|
||||
int mc_write (int handle, char *buffer, int count);
|
||||
off_t mc_lseek (int fd, off_t offset, int whence);
|
||||
int mc_chdir (char *);
|
||||
|
||||
DIR *mc_opendir (char *dirname);
|
||||
struct dirent *mc_readdir(DIR *dirp);
|
||||
int mc_closedir (DIR *dir);
|
||||
int mc_telldir (DIR *dir);
|
||||
void mc_seekdir (DIR *dir, int offset);
|
||||
DIR *mc_opendir (char *dirname);
|
||||
struct dirent *mc_readdir (DIR * dirp);
|
||||
int mc_closedir (DIR * dir);
|
||||
int mc_telldir (DIR * dir);
|
||||
void mc_seekdir (DIR * dir, int offset);
|
||||
|
||||
int mc_stat (const char *path, struct stat *buf);
|
||||
int mc_lstat (const char *path, struct stat *buf);
|
||||
int mc_fstat (int fd, struct stat *buf);
|
||||
int mc_stat (const char *path, struct stat *buf);
|
||||
int mc_lstat (const char *path, struct stat *buf);
|
||||
int mc_fstat (int fd, struct stat *buf);
|
||||
|
||||
int mc_chmod (char *path, int mode);
|
||||
int mc_chown (char *path, int owner, int group);
|
||||
int mc_utime (char *path, struct utimbuf *times);
|
||||
int mc_readlink (char *path, char *buf, int bufsiz);
|
||||
int mc_unlink (char *path);
|
||||
int mc_symlink (char *name1, char *name2);
|
||||
int mc_link (const char *name1, const char *name2);
|
||||
int mc_mknod (char *, int, int);
|
||||
int mc_rename (const char *original, const char *target);
|
||||
int mc_rmdir (char *path);
|
||||
int mc_mkdir (char *path, mode_t mode);
|
||||
int mc_chmod (char *path, int mode);
|
||||
int mc_chown (char *path, int owner, int group);
|
||||
int mc_utime (char *path, struct utimbuf *times);
|
||||
int mc_readlink (char *path, char *buf, int bufsiz);
|
||||
int mc_unlink (char *path);
|
||||
int mc_symlink (char *name1, char *name2);
|
||||
int mc_link (const char *name1, const char *name2);
|
||||
int mc_mknod (char *, int, int);
|
||||
int mc_rename (const char *original, const char *target);
|
||||
int mc_rmdir (char *path);
|
||||
int mc_mkdir (char *path, mode_t mode);
|
||||
|
||||
char *mc_getlocalcopy (const char *pathname);
|
||||
int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed);
|
||||
char *mc_def_getlocalcopy (vfs *vfs, char *filename);
|
||||
int mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed);
|
||||
int mc_ctl (int fd, int ctlop, int arg);
|
||||
int mc_setctl (char *path, int ctlop, char *arg);
|
||||
char *mc_getlocalcopy (const char *pathname);
|
||||
int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed);
|
||||
char *mc_def_getlocalcopy (vfs *vfs, char *filename);
|
||||
int mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local,
|
||||
int has_changed);
|
||||
int mc_ctl (int fd, int ctlop, int arg);
|
||||
int mc_setctl (char *path, int ctlop, char *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t);
|
||||
int mc_munmap (caddr_t addr, size_t len);
|
||||
#endif /* HAVE_MMAP */
|
||||
caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t);
|
||||
int mc_munmap (caddr_t addr, size_t len);
|
||||
#endif /* HAVE_MMAP */
|
||||
|
||||
#else
|
||||
|
||||
# undef USE_NETCODE
|
||||
#undef USE_NETCODE
|
||||
|
||||
# define vfs_fill_names(x) do { } while (0)
|
||||
# define vfs_add_current_stamps() do { } while (0)
|
||||
# define vfs_current_is_local() 1
|
||||
# define vfs_file_is_local(x) 1
|
||||
# define vfs_file_is_ftp(x) 0
|
||||
# define vfs_file_is_smb(x) 0
|
||||
# define vfs_current_is_tarfs() 0
|
||||
# define vfs_current_is_cpiofs() 0
|
||||
# define vfs_current_is_extfs() 0
|
||||
# define vfs_path(x) x
|
||||
# define vfs_strip_suffix_from_filename(x) g_strdup(x)
|
||||
# define mc_close close
|
||||
# define mc_read read
|
||||
# define mc_write write
|
||||
# define mc_lseek lseek
|
||||
# define mc_opendir opendir
|
||||
# define mc_readdir readdir
|
||||
# define mc_closedir closedir
|
||||
# define mc_telldir telldir
|
||||
# define mc_seekdir seekdir
|
||||
#define vfs_fill_names(x) do { } while (0)
|
||||
#define vfs_add_current_stamps() do { } while (0)
|
||||
#define vfs_current_is_local() 1
|
||||
#define vfs_file_is_local(x) 1
|
||||
#define vfs_file_is_ftp(x) 0
|
||||
#define vfs_file_is_smb(x) 0
|
||||
#define vfs_current_is_tarfs() 0
|
||||
#define vfs_current_is_cpiofs() 0
|
||||
#define vfs_current_is_extfs() 0
|
||||
#define vfs_path(x) x
|
||||
#define vfs_strip_suffix_from_filename(x) g_strdup(x)
|
||||
#define mc_close close
|
||||
#define mc_read read
|
||||
#define mc_write write
|
||||
#define mc_lseek lseek
|
||||
#define mc_opendir opendir
|
||||
#define mc_readdir readdir
|
||||
#define mc_closedir closedir
|
||||
#define mc_telldir telldir
|
||||
#define mc_seekdir seekdir
|
||||
|
||||
# define mc_get_current_wd(x,size) get_current_wd (x, size)
|
||||
# define mc_fstat fstat
|
||||
# define mc_lstat lstat
|
||||
#define mc_get_current_wd(x,size) get_current_wd (x, size)
|
||||
#define mc_fstat fstat
|
||||
#define mc_lstat lstat
|
||||
|
||||
# define mc_readlink readlink
|
||||
# define mc_symlink symlink
|
||||
# define mc_rename rename
|
||||
#define mc_readlink readlink
|
||||
#define mc_symlink symlink
|
||||
#define mc_rename rename
|
||||
|
||||
# define mc_open open
|
||||
# define mc_utime utime
|
||||
# define mc_chmod chmod
|
||||
# define mc_chown chown
|
||||
# define mc_chdir chdir
|
||||
# define mc_unlink unlink
|
||||
#define mc_open open
|
||||
#define mc_utime utime
|
||||
#define mc_chmod chmod
|
||||
#define mc_chown chown
|
||||
#define mc_chdir chdir
|
||||
#define mc_unlink unlink
|
||||
|
||||
# define mc_mmap mmap
|
||||
# define mc_munmap munmap
|
||||
#define mc_mmap mmap
|
||||
#define mc_munmap munmap
|
||||
|
||||
# define mc_ctl(a,b,c) 0
|
||||
static inline int mc_setctl(char *path, int ctlop, char *arg) { return 0; }
|
||||
# define vfs_translate_url(s) g_strdup(s)
|
||||
#define mc_ctl(a,b,c) 0
|
||||
static inline int
|
||||
mc_setctl (char *path, int ctlop, char *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
# define mc_stat stat
|
||||
# define mc_mknod mknod
|
||||
# define mc_link link
|
||||
# define mc_mkdir mkdir
|
||||
# define mc_rmdir rmdir
|
||||
# define vfs_type(x) (vfs *)(NULL)
|
||||
# define vfs_init() do { } while (0)
|
||||
# define vfs_shut() do { } while (0)
|
||||
# define vfs_canon(p) g_strdup (canonicalize_pathname(p))
|
||||
# define vfs_timeout_handler() do { } while (0)
|
||||
# define vfs_timeouts() 0
|
||||
# define vfs_force_expire() do { } while (0)
|
||||
#define vfs_translate_url(s) g_strdup(s)
|
||||
|
||||
# define mc_getlocalcopy(x) NULL
|
||||
# define mc_ungetlocalcopy(x,y,z) do { } while (0)
|
||||
#define mc_stat stat
|
||||
#define mc_mknod mknod
|
||||
#define mc_link link
|
||||
#define mc_mkdir mkdir
|
||||
#define mc_rmdir rmdir
|
||||
#define vfs_get_class(x) (struct vfs_class *)(NULL)
|
||||
#define vfs_init() do { } while (0)
|
||||
#define vfs_shut() do { } while (0)
|
||||
#define vfs_canon(p) g_strdup (canonicalize_pathname(p))
|
||||
#define vfs_timeout_handler() do { } while (0)
|
||||
#define vfs_timeouts() 0
|
||||
#define vfs_force_expire() do { } while (0)
|
||||
|
||||
# define ftpfs_hint_reread(x) do { } while (0)
|
||||
# define ftpfs_flushdir() do { } while (0)
|
||||
#define mc_getlocalcopy(x) NULL
|
||||
#define mc_ungetlocalcopy(x,y,z) do { } while (0)
|
||||
|
||||
#endif /* USE_VFS */
|
||||
#define ftpfs_hint_reread(x) do { } while (0)
|
||||
#define ftpfs_flushdir() do { } while (0)
|
||||
|
||||
#endif /* USE_VFS */
|
||||
|
||||
/* These functions are meant for use by vfs modules */
|
||||
|
||||
extern int vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, char **linkname);
|
||||
extern int vfs_parse_ls_lga (const char *p, struct stat *s,
|
||||
char **filename, char **linkname);
|
||||
extern int vfs_split_text (char *p);
|
||||
extern int vfs_parse_filetype (char c);
|
||||
extern int vfs_parse_filemode (const char *p);
|
||||
extern int vfs_parse_filedate(int idx, time_t *t);
|
||||
extern int vfs_parse_filedate (int idx, time_t * t);
|
||||
|
||||
extern void vfs_die (const char *msg);
|
||||
extern char *vfs_get_password (char *msg);
|
||||
@ -292,8 +289,9 @@ extern char *vfs_get_password (char *msg);
|
||||
#define URL_ALLOW_ANON 1
|
||||
#define URL_NOSLASH 2
|
||||
|
||||
extern char *vfs_split_url (const char *path, char **host, char **user,
|
||||
int *port, char **pass, int default_port, int flags);
|
||||
extern char *vfs_split_url (const char *path, char **host, char **user,
|
||||
int *port, char **pass, int default_port,
|
||||
int flags);
|
||||
|
||||
#ifdef WITH_SMBFS
|
||||
/* Interface for requesting SMB credentials. */
|
||||
@ -305,13 +303,15 @@ struct smb_authinfo {
|
||||
char *password;
|
||||
};
|
||||
|
||||
struct smb_authinfo *
|
||||
vfs_smb_get_authinfo (const char *host, const char *share, const char *domain,
|
||||
const char *user);
|
||||
#endif /* WITH_SMBFS */
|
||||
struct smb_authinfo *vfs_smb_get_authinfo (const char *host,
|
||||
const char *share,
|
||||
const char *domain,
|
||||
const char *user);
|
||||
#endif /* WITH_SMBFS */
|
||||
|
||||
extern void vfs_print_stats (const char *fs_name, const char *action,
|
||||
const char *file_name, off_t have, off_t need);
|
||||
const char *file_name, off_t have,
|
||||
off_t need);
|
||||
|
||||
/* Don't use values 0..4 for a while -- 10/98, pavel@ucw.cz */
|
||||
#define MCCTL_REMOVELOCALCOPY 5
|
||||
@ -370,7 +370,7 @@ extern void vfs_print_stats (const char *fs_name, const char *action,
|
||||
#ifdef ENOMSG
|
||||
#define E_UNKNOWN ENOMSG /* if we do not know what error happened */
|
||||
#else
|
||||
#define E_UNKNOWN EIO /* if we do not know what error happened */
|
||||
#define E_UNKNOWN EIO /* if we do not know what error happened */
|
||||
#endif
|
||||
|
||||
#ifdef EREMOTEIO
|
||||
@ -385,4 +385,4 @@ extern void vfs_print_stats (const char *fs_name, const char *action,
|
||||
#define E_PROTO EIO
|
||||
#endif
|
||||
|
||||
#endif /* __VFS_H */
|
||||
#endif /* __VFS_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user