* vfs.h: Remove typedef vfs, it's too ambiguous. Massive

changes to use struct vfs_class instead.
This commit is contained in:
Pavel Roskin 2003-10-12 00:24:00 +00:00
parent 4b1ec7399b
commit 00b57fd4bf
16 changed files with 394 additions and 395 deletions

View File

@ -1,5 +1,8 @@
2003-10-11 Pavel Roskin <proski@gnu.org> 2003-10-11 Pavel Roskin <proski@gnu.org>
* vfs.h: Remove typedef vfs, it's too ambiguous. Massive
changes to use struct vfs_class instead.
* vfs.c (vfs_setup_wd): Initialize current_vfs here, not * vfs.c (vfs_setup_wd): Initialize current_vfs here, not
globally. globally.
(vfs_type_from_op): Rename to vfs_prefix_to_class(), avoid using (vfs_type_from_op): Rename to vfs_prefix_to_class(), avoid using

View File

@ -89,11 +89,11 @@ struct defer_inode {
static int cpio_position; static int cpio_position;
static int cpio_find_head(vfs *me, vfs_s_super *super); static int cpio_find_head(struct vfs_class *me, vfs_s_super *super);
static int cpio_read_bin_head(vfs *me, vfs_s_super *super); static int cpio_read_bin_head(struct vfs_class *me, vfs_s_super *super);
static int cpio_read_oldc_head(vfs *me, vfs_s_super *super); static int cpio_read_oldc_head(struct vfs_class *me, vfs_s_super *super);
static int cpio_read_crc_head(vfs *me, vfs_s_super *super); static int cpio_read_crc_head(struct vfs_class *me, vfs_s_super *super);
static int cpio_create_entry(vfs *me, vfs_s_super *super, struct stat *stat, char *name); static int cpio_create_entry(struct vfs_class *me, vfs_s_super *super, struct stat *stat, char *name);
static int cpio_read(void *fh, char *buffer, int count); static int cpio_read(void *fh, char *buffer, int count);
#define CPIO_POS(super) cpio_position #define CPIO_POS(super) cpio_position
@ -127,13 +127,13 @@ static int cpio_skip_padding(vfs_s_super *super)
} }
} }
static void cpio_free_archive(vfs *me, vfs_s_super *super) static void cpio_free_archive(struct vfs_class *me, vfs_s_super *super)
{ {
if(super->u.cpio.fd != -1) if(super->u.cpio.fd != -1)
mc_close(super->u.cpio.fd); mc_close(super->u.cpio.fd);
} }
static int cpio_open_cpio_file(vfs *me, vfs_s_super *super, char *name) static int cpio_open_cpio_file(struct vfs_class *me, vfs_s_super *super, char *name)
{ {
int fd, type; int fd, type;
mode_t mode; mode_t mode;
@ -182,7 +182,7 @@ static int cpio_open_cpio_file(vfs *me, vfs_s_super *super, char *name)
return fd; return fd;
} }
static int cpio_read_head(vfs *me, vfs_s_super *super) static int cpio_read_head(struct vfs_class *me, vfs_s_super *super)
{ {
switch(cpio_find_head(me, super)) { switch(cpio_find_head(me, super)) {
case CPIO_UNKNOWN: case CPIO_UNKNOWN:
@ -205,7 +205,7 @@ static int cpio_read_head(vfs *me, vfs_s_super *super)
#define SEEKBACK CPIO_SEEK_CUR(super, ptr - top) #define SEEKBACK CPIO_SEEK_CUR(super, ptr - top)
#define RETURN(x) return(super->u.cpio.type = (x)) #define RETURN(x) return(super->u.cpio.type = (x))
#define TYPEIS(x) ((super->u.cpio.type == CPIO_UNKNOWN) || (super->u.cpio.type == (x))) #define TYPEIS(x) ((super->u.cpio.type == CPIO_UNKNOWN) || (super->u.cpio.type == (x)))
static int cpio_find_head(vfs *me, vfs_s_super *super) static int cpio_find_head(struct vfs_class *me, vfs_s_super *super)
{ {
char buf[256]; char buf[256];
int ptr = 0; int ptr = 0;
@ -246,7 +246,7 @@ static int cpio_find_head(vfs *me, vfs_s_super *super)
#undef SEEKBACK #undef SEEKBACK
#define HEAD_LENGTH (26) #define HEAD_LENGTH (26)
static int cpio_read_bin_head(vfs *me, vfs_s_super *super) static int cpio_read_bin_head(struct vfs_class *me, vfs_s_super *super)
{ {
struct old_cpio_header buf; struct old_cpio_header buf;
int len; int len;
@ -291,7 +291,7 @@ static int cpio_read_bin_head(vfs *me, vfs_s_super *super)
#undef HEAD_LENGTH #undef HEAD_LENGTH
#define HEAD_LENGTH (76) #define HEAD_LENGTH (76)
static int cpio_read_oldc_head(vfs *me, vfs_s_super *super) static int cpio_read_oldc_head(struct vfs_class *me, vfs_s_super *super)
{ {
struct new_cpio_header hd; struct new_cpio_header hd;
struct stat stat; struct stat stat;
@ -340,7 +340,7 @@ static int cpio_read_oldc_head(vfs *me, vfs_s_super *super)
#undef HEAD_LENGTH #undef HEAD_LENGTH
#define HEAD_LENGTH (110) #define HEAD_LENGTH (110)
static int cpio_read_crc_head(vfs *me, vfs_s_super *super) static int cpio_read_crc_head(struct vfs_class *me, vfs_s_super *super)
{ {
struct new_cpio_header hd; struct new_cpio_header hd;
struct stat stat; struct stat stat;
@ -393,7 +393,7 @@ static int cpio_read_crc_head(vfs *me, vfs_s_super *super)
return cpio_create_entry(me, super, &stat, name); return cpio_create_entry(me, super, &stat, name);
} }
static int cpio_create_entry(vfs *me, vfs_s_super *super, struct stat *stat, char *name) static int cpio_create_entry(struct vfs_class *me, vfs_s_super *super, struct stat *stat, char *name)
{ {
vfs_s_inode *inode = NULL; vfs_s_inode *inode = NULL;
vfs_s_inode *root = super->root; vfs_s_inode *root = super->root;
@ -509,7 +509,7 @@ static int cpio_create_entry(vfs *me, vfs_s_super *super, struct stat *stat, cha
/* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */ /* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */
static int cpio_open_archive(vfs *me, vfs_s_super *super, char *name, char *op) static int cpio_open_archive(struct vfs_class *me, vfs_s_super *super, char *name, char *op)
{ {
int status = STATUS_START; int status = STATUS_START;
@ -535,7 +535,7 @@ static int cpio_open_archive(vfs *me, vfs_s_super *super, char *name, char *op)
} }
/* Remaining functions are exactly same as for tarfs (and were in fact just copied) */ /* Remaining functions are exactly same as for tarfs (and were in fact just copied) */
static void *cpio_super_check(vfs *me, char *archive_name, char *op) static void *cpio_super_check(struct vfs_class *me, char *archive_name, char *op)
{ {
static struct stat sb; static struct stat sb;
if(mc_stat(archive_name, &sb)) if(mc_stat(archive_name, &sb))
@ -544,7 +544,7 @@ static void *cpio_super_check(vfs *me, char *archive_name, char *op)
} }
static int static int
cpio_super_same (vfs *me, struct vfs_s_super *parc, char *archive_name, cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc, char *archive_name,
char *op, void *cookie) char *op, void *cookie)
{ {
struct stat *archive_stat = cookie; /* stat of main archive */ struct stat *archive_stat = cookie; /* stat of main archive */
@ -568,7 +568,7 @@ static int cpio_read(void *fh, char *buffer, int count)
{ {
off_t begin = FH->ino->u.tar.data_offset; off_t begin = FH->ino->u.tar.data_offset;
int fd = FH_SUPER->u.tar.fd; int fd = FH_SUPER->u.tar.fd;
vfs *me = FH_SUPER->me; struct vfs_class *me = FH_SUPER->me;
if (mc_lseek (fd, begin + FH->pos, SEEK_SET) != if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
begin + FH->pos) ERRNOR (EIO, -1); begin + FH->pos) ERRNOR (EIO, -1);
@ -581,14 +581,14 @@ static int cpio_read(void *fh, char *buffer, int count)
return count; return count;
} }
static int cpio_ungetlocalcopy(vfs *me, char *path, char *local, int has_changed) static int cpio_ungetlocalcopy(struct vfs_class *me, char *path, char *local, int has_changed)
{ {
/* We do just nothing. (We are read only and do not need to free local, /* We do just nothing. (We are read only and do not need to free local,
since it will be freed when tar archive will be freed */ since it will be freed when tar archive will be freed */
return 0; return 0;
} }
static int cpio_fh_open(vfs *me, vfs_s_fh *fh, int flags, int mode) static int cpio_fh_open(struct vfs_class *me, vfs_s_fh *fh, int flags, int mode)
{ {
if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1); if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1);
return 0; return 0;

View File

@ -34,11 +34,11 @@
static volatile int total_inodes = 0, total_entries = 0; static volatile int total_inodes = 0, total_entries = 0;
static vfs_s_entry *vfs_s_resolve_symlink (vfs * me, vfs_s_entry * entry, static vfs_s_entry *vfs_s_resolve_symlink (struct vfs_class * me, vfs_s_entry * entry,
char *path, int follow); char *path, int follow);
vfs_s_inode * vfs_s_inode *
vfs_s_new_inode (vfs *me, vfs_s_super *super, struct stat *initstat) vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct stat *initstat)
{ {
vfs_s_inode *ino; vfs_s_inode *ino;
@ -62,7 +62,7 @@ vfs_s_new_inode (vfs *me, vfs_s_super *super, struct stat *initstat)
} }
vfs_s_entry * vfs_s_entry *
vfs_s_new_entry (vfs *me, char *name, vfs_s_inode *inode) vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode)
{ {
vfs_s_entry *entry; vfs_s_entry *entry;
@ -80,7 +80,7 @@ vfs_s_new_entry (vfs *me, char *name, vfs_s_inode *inode)
} }
static void static void
vfs_s_free_inode (vfs *me, vfs_s_inode *ino) vfs_s_free_inode (struct vfs_class *me, vfs_s_inode *ino)
{ {
if (!ino) if (!ino)
vfs_die ("Don't pass NULL to me"); vfs_die ("Don't pass NULL to me");
@ -104,7 +104,7 @@ vfs_s_free_inode (vfs *me, vfs_s_inode *ino)
} }
void void
vfs_s_free_entry (vfs *me, vfs_s_entry *ent) vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent)
{ {
int is_dot = 0; int is_dot = 0;
if (ent->prevp){ /* It is possible that we are deleting freshly created entry */ if (ent->prevp){ /* It is possible that we are deleting freshly created entry */
@ -130,7 +130,7 @@ vfs_s_free_entry (vfs *me, vfs_s_entry *ent)
} }
void void
vfs_s_insert_entry (vfs *me, vfs_s_inode *dir, vfs_s_entry *ent) vfs_s_insert_entry (struct vfs_class *me, vfs_s_inode *dir, vfs_s_entry *ent)
{ {
vfs_s_entry **ep; vfs_s_entry **ep;
@ -145,7 +145,7 @@ vfs_s_insert_entry (vfs *me, vfs_s_inode *dir, vfs_s_entry *ent)
} }
struct stat * struct stat *
vfs_s_default_stat (vfs *me, mode_t mode) vfs_s_default_stat (struct vfs_class *me, mode_t mode)
{ {
static struct stat st; static struct stat st;
int myumask; int myumask;
@ -167,7 +167,7 @@ vfs_s_default_stat (vfs *me, mode_t mode)
} }
void void
vfs_s_add_dots (vfs *me, vfs_s_inode *dir, vfs_s_inode *parent) vfs_s_add_dots (struct vfs_class *me, vfs_s_inode *dir, vfs_s_inode *parent)
{ {
struct vfs_s_entry *dot, *dotdot; struct vfs_s_entry *dot, *dotdot;
@ -182,7 +182,7 @@ vfs_s_add_dots (vfs *me, vfs_s_inode *dir, vfs_s_inode *parent)
} }
struct vfs_s_entry * struct vfs_s_entry *
vfs_s_generate_entry (vfs *me, char *name, struct vfs_s_inode *parent, mode_t mode) vfs_s_generate_entry (struct vfs_class *me, char *name, struct vfs_s_inode *parent, mode_t mode)
{ {
struct vfs_s_inode *inode; struct vfs_s_inode *inode;
struct stat *st; struct stat *st;
@ -197,7 +197,7 @@ vfs_s_generate_entry (vfs *me, char *name, struct vfs_s_inode *parent, mode_t mo
/* We were asked to create entries automagically */ /* We were asked to create entries automagically */
static vfs_s_entry * static vfs_s_entry *
vfs_s_automake (vfs *me, vfs_s_inode *dir, char *path, int flags) vfs_s_automake (struct vfs_class *me, vfs_s_inode *dir, char *path, int flags)
{ {
struct vfs_s_entry *res; struct vfs_s_entry *res;
char *sep = strchr (path, PATH_SEP); char *sep = strchr (path, PATH_SEP);
@ -218,7 +218,7 @@ vfs_s_automake (vfs *me, vfs_s_inode *dir, char *path, int flags)
* == -1: do not follow links * == -1: do not follow links
*/ */
vfs_s_entry * vfs_s_entry *
vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags)
{ {
unsigned int pseg; unsigned int pseg;
vfs_s_entry *ent = NULL; vfs_s_entry *ent = NULL;
@ -259,7 +259,7 @@ vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, int follow, int f
} }
static void static void
split_dir_name (vfs *me, char *path, char **dir, char **name, char **save) split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char **save)
{ {
char *s; char *s;
s = strrchr (path, PATH_SEP); s = strrchr (path, PATH_SEP);
@ -276,7 +276,7 @@ split_dir_name (vfs *me, char *path, char **dir, char **name, char **save)
} }
vfs_s_entry * vfs_s_entry *
vfs_s_find_entry_linear (vfs *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags)
{ {
vfs_s_entry* ent = NULL; vfs_s_entry* ent = NULL;
@ -332,7 +332,7 @@ vfs_s_find_entry_linear (vfs *me, vfs_s_inode *root, char *path, int follow, int
} }
vfs_s_inode * vfs_s_inode *
vfs_s_find_inode (vfs *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_inode (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags)
{ {
vfs_s_entry *ent; vfs_s_entry *ent;
if ((MEDATA->find_entry == vfs_s_find_entry_tree) && (!*path)) if ((MEDATA->find_entry == vfs_s_find_entry_tree) && (!*path))
@ -344,7 +344,7 @@ vfs_s_find_inode (vfs *me, vfs_s_inode *root, char *path, int follow, int flags)
} }
static vfs_s_entry * static vfs_s_entry *
vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow) vfs_s_resolve_symlink (struct vfs_class *me, vfs_s_entry *entry, char *path, int follow)
{ {
char buf[MC_MAXPATHLEN], *linkname; char buf[MC_MAXPATHLEN], *linkname;
@ -402,7 +402,7 @@ vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
/* -------------------------------- superblock games -------------------------- */ /* -------------------------------- superblock games -------------------------- */
static vfs_s_super * static vfs_s_super *
vfs_s_new_super (vfs *me) vfs_s_new_super (struct vfs_class *me)
{ {
vfs_s_super *super; vfs_s_super *super;
@ -412,7 +412,7 @@ vfs_s_new_super (vfs *me)
} }
static void static void
vfs_s_insert_super (vfs *me, vfs_s_super *super) vfs_s_insert_super (struct vfs_class *me, vfs_s_super *super)
{ {
super->next = MEDATA->supers; super->next = MEDATA->supers;
super->prevp = &MEDATA->supers; super->prevp = &MEDATA->supers;
@ -423,7 +423,7 @@ vfs_s_insert_super (vfs *me, vfs_s_super *super)
} }
static void static void
vfs_s_free_super (vfs *me, vfs_s_super *super) vfs_s_free_super (struct vfs_class *me, vfs_s_super *super)
{ {
if (super->root){ if (super->root){
vfs_s_free_inode (me, super->root); vfs_s_free_inode (me, super->root);
@ -456,10 +456,10 @@ vfs_s_free_super (vfs *me, vfs_s_super *super)
/* ------------------------------------------------------------------------= */ /* ------------------------------------------------------------------------= */
static void static void
vfs_s_stamp_me (vfs *me, struct vfs_s_super *psup, char *fs_name) vfs_s_stamp_me (struct vfs_class *me, struct vfs_s_super *psup, char *fs_name)
{ {
struct vfs_stamping *parent; struct vfs_stamping *parent;
vfs *v; struct vfs_class *v;
v = vfs_get_class (fs_name); v = vfs_get_class (fs_name);
if (v->flags & VFSF_LOCAL){ if (v->flags & VFSF_LOCAL){
@ -474,7 +474,7 @@ vfs_s_stamp_me (vfs *me, struct vfs_s_super *psup, char *fs_name)
} }
char * char *
vfs_s_get_path_mangle (vfs *me, char *inname, struct vfs_s_super **archive, int flags) vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **archive, int flags)
{ {
char *local, *op, *archive_name; char *local, *op, *archive_name;
int result = -1; int result = -1;
@ -521,7 +521,7 @@ return_success:
} }
static char * static char *
vfs_s_get_path (vfs *me, const char *inname, struct vfs_s_super **archive, int flags) vfs_s_get_path (struct vfs_class *me, const char *inname, struct vfs_s_super **archive, int flags)
{ {
char *buf = g_strdup( inname ); char *buf = g_strdup( inname );
char *res = vfs_s_get_path_mangle (me, buf, archive, flags); char *res = vfs_s_get_path_mangle (me, buf, archive, flags);
@ -532,7 +532,7 @@ vfs_s_get_path (vfs *me, const char *inname, struct vfs_s_super **archive, int f
} }
void void
vfs_s_invalidate (vfs *me, vfs_s_super *super) vfs_s_invalidate (struct vfs_class *me, vfs_s_super *super)
{ {
if (!super->want_stale){ if (!super->want_stale){
vfs_s_free_inode (me, super->root); vfs_s_free_inode (me, super->root);
@ -541,7 +541,7 @@ vfs_s_invalidate (vfs *me, vfs_s_super *super)
} }
char * char *
vfs_s_fullpath (vfs *me, vfs_s_inode *ino) vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino)
{ {
/* For now, usable only on filesystems with _linear structure */ /* For now, usable only on filesystems with _linear structure */
if (MEDATA->find_entry != vfs_s_find_entry_linear) if (MEDATA->find_entry != vfs_s_find_entry_linear)
@ -560,7 +560,7 @@ vfs_s_fullpath (vfs *me, vfs_s_inode *ino)
/* ------------------------ readdir & friends ----------------------------- */ /* ------------------------ readdir & friends ----------------------------- */
static vfs_s_inode * static vfs_s_inode *
vfs_s_inode_from_path (vfs *me, char *name, int flags) vfs_s_inode_from_path (struct vfs_class *me, char *name, int flags)
{ {
struct vfs_s_super *super; struct vfs_s_super *super;
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
@ -582,7 +582,7 @@ struct dirhandle {
}; };
static void * static void *
vfs_s_opendir (vfs *me, char *dirname) vfs_s_opendir (struct vfs_class *me, char *dirname)
{ {
struct vfs_s_inode *dir; struct vfs_s_inode *dir;
struct dirhandle *info; struct dirhandle *info;
@ -666,7 +666,7 @@ vfs_s_closedir (void *data)
} }
static int static int
vfs_s_chdir (vfs *me, char *path) vfs_s_chdir (struct vfs_class *me, char *path)
{ {
void *data; void *data;
if (!(data = vfs_s_opendir (me, path))) if (!(data = vfs_s_opendir (me, path)))
@ -678,7 +678,7 @@ vfs_s_chdir (vfs *me, char *path)
/* --------------------------- stat and friends ---------------------------- */ /* --------------------------- stat and friends ---------------------------- */
static int static int
vfs_s_internal_stat (vfs *me, char *path, struct stat *buf, int flag) vfs_s_internal_stat (struct vfs_class *me, char *path, struct stat *buf, int flag)
{ {
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
@ -689,13 +689,13 @@ vfs_s_internal_stat (vfs *me, char *path, struct stat *buf, int flag)
} }
static int static int
vfs_s_stat (vfs *me, char *path, struct stat *buf) vfs_s_stat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return vfs_s_internal_stat (me, path, buf, FL_FOLLOW); return vfs_s_internal_stat (me, path, buf, FL_FOLLOW);
} }
static int static int
vfs_s_lstat (vfs *me, char *path, struct stat *buf) vfs_s_lstat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return vfs_s_internal_stat (me, path, buf, FL_NONE); return vfs_s_internal_stat (me, path, buf, FL_NONE);
} }
@ -708,7 +708,7 @@ vfs_s_fstat (void *fh, struct stat *buf)
} }
static int static int
vfs_s_readlink (vfs *me, char *path, char *buf, int size) vfs_s_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
@ -728,7 +728,7 @@ vfs_s_readlink (vfs *me, char *path, char *buf, int size)
} }
static void * static void *
vfs_s_open (vfs *me, char *file, int flags, int mode) vfs_s_open (struct vfs_class *me, char *file, int flags, int mode)
{ {
int was_changed = 0; int was_changed = 0;
struct vfs_s_fh *fh; struct vfs_s_fh *fh;
@ -809,7 +809,7 @@ static int
vfs_s_read (void *fh, char *buffer, int count) vfs_s_read (void *fh, char *buffer, int count)
{ {
int n; int n;
vfs *me = FH_SUPER->me; struct vfs_class *me = FH_SUPER->me;
if (FH->linear == LS_LINEAR_CLOSED) if (FH->linear == LS_LINEAR_CLOSED)
vfs_die ("linear_start() did not set linear_state!"); vfs_die ("linear_start() did not set linear_state!");
@ -831,7 +831,7 @@ static int
vfs_s_write (void *fh, char *buffer, int count) vfs_s_write (void *fh, char *buffer, int count)
{ {
int n; int n;
vfs *me = FH_SUPER->me; struct vfs_class *me = FH_SUPER->me;
if (FH->linear) if (FH->linear)
vfs_die ("no writing to linear files, please"); vfs_die ("no writing to linear files, please");
@ -878,12 +878,12 @@ static int
vfs_s_close (void *fh) vfs_s_close (void *fh)
{ {
int res = 0; int res = 0;
vfs *me = FH_SUPER->me; struct vfs_class *me = FH_SUPER->me;
FH_SUPER->fd_usage--; FH_SUPER->fd_usage--;
if (!FH_SUPER->fd_usage){ if (!FH_SUPER->fd_usage){
struct vfs_stamping *parent; struct vfs_stamping *parent;
vfs *v; struct vfs_class *v;
v = vfs_get_class (FH_SUPER->name); v = vfs_get_class (FH_SUPER->name);
if (v->flags & VFSF_LOCAL) { if (v->flags & VFSF_LOCAL) {
@ -919,7 +919,7 @@ vfs_s_close (void *fh)
} }
int int
vfs_s_retrieve_file (vfs *me, struct vfs_s_inode *ino) vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
{ {
/* If you want reget, you'll have to open file with O_LINEAR */ /* If you want reget, you'll have to open file with O_LINEAR */
off_t total = 0; off_t total = 0;
@ -984,7 +984,7 @@ vfs_s_retrieve_file (vfs *me, struct vfs_s_inode *ino)
/* ------------------------------- mc support ---------------------------- */ /* ------------------------------- mc support ---------------------------- */
static void static void
vfs_s_fill_names (vfs *me, void (*func)(char *)) vfs_s_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
struct vfs_s_super *a = MEDATA->supers; struct vfs_s_super *a = MEDATA->supers;
char *name; char *name;
@ -998,13 +998,13 @@ vfs_s_fill_names (vfs *me, void (*func)(char *))
} }
static int static int
vfs_s_ferrno (vfs *me) vfs_s_ferrno (struct vfs_class *me)
{ {
return me->verrno; return me->verrno;
} }
static char * static char *
vfs_s_getlocalcopy (vfs *me, char *path) vfs_s_getlocalcopy (struct vfs_class *me, char *path)
{ {
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
char buf[MC_MAXPATHLEN]; char buf[MC_MAXPATHLEN];
@ -1019,7 +1019,7 @@ vfs_s_getlocalcopy (vfs *me, char *path)
} }
static int static int
vfs_s_setctl (vfs *me, char *path, int ctlop, char *arg) vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
{ {
vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0); vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0);
if (!ino) if (!ino)
@ -1047,10 +1047,10 @@ vfs_s_setctl (vfs *me, char *path, int ctlop, char *arg)
/* ----------------------------- Stamping support -------------------------- */ /* ----------------------------- Stamping support -------------------------- */
static vfsid static vfsid
vfs_s_getid (vfs *me, const char *path, struct vfs_stamping **parent) vfs_s_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
{ {
vfs_s_super *archive; vfs_s_super *archive;
vfs *v; struct vfs_class *v;
char *p; char *p;
vfsid id; vfsid id;
struct vfs_stamping *par; struct vfs_stamping *par;
@ -1138,7 +1138,7 @@ vfs_s_select_on_two (int fd1, int fd2)
} }
int int
vfs_s_get_line (vfs *me, int sock, char *buf, int buf_len, char term) vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char term)
{ {
FILE *logfile = MEDATA->logfile; FILE *logfile = MEDATA->logfile;
int i, status; int i, status;
@ -1171,7 +1171,7 @@ vfs_s_get_line (vfs *me, int sock, char *buf, int buf_len, char term)
} }
int int
vfs_s_get_line_interruptible (vfs *me, char *buffer, int size, int fd) vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int fd)
{ {
int n; int n;
int i; int i;

View File

@ -79,7 +79,7 @@ struct pseudofile {
static struct entry * static struct entry *
find_entry (struct entry *dir, char *name, int make_dirs, int make_file); find_entry (struct entry *dir, char *name, int make_dirs, int make_file);
static int extfs_which (vfs *me, char *path); 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);
@ -91,7 +91,7 @@ static char *extfs_prefixes [MAXEXTFS];
static char extfs_need_archive [MAXEXTFS]; static char extfs_need_archive [MAXEXTFS];
static int extfs_no = 0; static int extfs_no = 0;
static void extfs_fill_names (vfs *me, void (*func)(char *)) static void extfs_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
struct archive *a = first_archive; struct archive *a = first_archive;
char *name; char *name;
@ -418,7 +418,7 @@ get_path_mangle (char *inname, struct archive **archive, int is_dir,
int result = -1; int result = -1;
struct archive *parc; struct archive *parc;
struct vfs_stamping *parent; struct vfs_stamping *parent;
vfs *v; struct vfs_class *v;
int fstype; int fstype;
archive_name = inname; archive_name = inname;
@ -426,7 +426,7 @@ get_path_mangle (char *inname, struct archive **archive, int is_dir,
/* /*
* FIXME: we really should pass self pointer. But as we know that * FIXME: we really should pass self pointer. But as we know that
* extfs_which does not touch vfs *me, it does not matter for now * extfs_which does not touch struct vfs_class *me, it does not matter for now
*/ */
fstype = extfs_which (NULL, op); fstype = extfs_which (NULL, op);
@ -641,7 +641,7 @@ extfs_run (char *file)
} }
static void * static void *
extfs_open (vfs *me, char *file, int flags, int mode) extfs_open (struct vfs_class *me, char *file, int flags, int mode)
{ {
struct pseudofile *extfs_info; struct pseudofile *extfs_info;
struct archive *archive; struct archive *archive;
@ -747,7 +747,7 @@ extfs_close (void *data)
file->archive->fd_usage--; file->archive->fd_usage--;
if (!file->archive->fd_usage) { if (!file->archive->fd_usage) {
struct vfs_stamping *parent; struct vfs_stamping *parent;
vfs *v; struct vfs_class *v;
if (!file->archive->name || !*file->archive->name if (!file->archive->name || !*file->archive->name
|| (v = || (v =
@ -863,12 +863,12 @@ static struct entry *find_entry (struct entry *dir, char *name, int make_dirs, i
} }
static int s_errno (vfs *me) static int s_errno (struct vfs_class *me)
{ {
return my_errno; return my_errno;
} }
static void * s_opendir (vfs *me, char *dirname) static void * s_opendir (struct vfs_class *me, char *dirname)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -980,12 +980,12 @@ static int s_internal_stat (char *path, struct stat *buf, int resolve)
return 0; return 0;
} }
static int s_stat (vfs *me, char *path, struct stat *buf) static int s_stat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return s_internal_stat (path, buf, 1); return s_internal_stat (path, buf, 1);
} }
static int s_lstat (vfs *me, char *path, struct stat *buf) static int s_lstat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return s_internal_stat (path, buf, 0); return s_internal_stat (path, buf, 0);
} }
@ -1001,7 +1001,7 @@ static int s_fstat (void *data, struct stat *buf)
} }
static int static int
s_readlink (vfs *me, char *path, char *buf, int size) s_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -1022,7 +1022,7 @@ s_readlink (vfs *me, char *path, char *buf, int size)
return i; return i;
} }
static int extfs_chmod (vfs *me, char *path, int mode) static int extfs_chmod (struct vfs_class *me, char *path, int mode)
{ {
return 0; return 0;
} }
@ -1035,7 +1035,7 @@ static int extfs_write (void *data, char *buf, int nbyte)
return write (file->local_handle, buf, nbyte); return write (file->local_handle, buf, nbyte);
} }
static int extfs_unlink (vfs *me, char *file) static int extfs_unlink (struct vfs_class *me, char *file)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -1059,7 +1059,7 @@ static int extfs_unlink (vfs *me, char *file)
return 0; return 0;
} }
static int extfs_mkdir (vfs *me, char *path, mode_t mode) static int extfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -1085,7 +1085,7 @@ static int extfs_mkdir (vfs *me, char *path, mode_t mode)
return 0; return 0;
} }
static int extfs_rmdir (vfs *me, char *path) static int extfs_rmdir (struct vfs_class *me, char *path)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -1109,7 +1109,7 @@ static int extfs_rmdir (vfs *me, char *path)
return 0; return 0;
} }
static int extfs_chdir (vfs *me, char *path) static int extfs_chdir (struct vfs_class *me, char *path)
{ {
struct archive *archive; struct archive *archive;
char *q; char *q;
@ -1136,10 +1136,10 @@ static int extfs_lseek (void *data, off_t offset, int whence)
return lseek (file->local_handle, offset, whence); return lseek (file->local_handle, offset, whence);
} }
static vfsid extfs_getid (vfs *me, const char *path, struct vfs_stamping **parent) static vfsid extfs_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
{ {
struct archive *archive; struct archive *archive;
vfs *v; struct vfs_class *v;
vfsid id; vfsid id;
struct vfs_stamping *par; struct vfs_stamping *par;
char *p; char *p;
@ -1251,7 +1251,7 @@ static void extfs_free (vfsid id)
free_archive (archive); free_archive (archive);
} }
static char *extfs_getlocalcopy (vfs *me, char *path) static char *extfs_getlocalcopy (struct vfs_class *me, char *path)
{ {
struct pseudofile *fp = struct pseudofile *fp =
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0); (struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
@ -1269,7 +1269,7 @@ static char *extfs_getlocalcopy (vfs *me, char *path)
return p; return p;
} }
static int extfs_ungetlocalcopy (vfs *me, char *path, char *local, int has_changed) static int extfs_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
{ {
struct pseudofile *fp = struct pseudofile *fp =
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0); (struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
@ -1289,7 +1289,7 @@ static int extfs_ungetlocalcopy (vfs *me, char *path, char *local, int has_chang
} }
static int extfs_init (vfs *me) static int extfs_init (struct vfs_class *me)
{ {
FILE *cfg; FILE *cfg;
char *mc_extfsini; char *mc_extfsini;
@ -1349,7 +1349,7 @@ static int extfs_init (vfs *me)
} }
/* Do NOT use me argument in this function */ /* Do NOT use me argument in this function */
static int extfs_which (vfs *me, char *path) static int extfs_which (struct vfs_class *me, char *path)
{ {
int i; int i;
@ -1359,7 +1359,7 @@ static int extfs_which (vfs *me, char *path)
return -1; return -1;
} }
static void extfs_done (vfs *me) static void extfs_done (struct vfs_class *me)
{ {
int i; int i;
@ -1368,7 +1368,7 @@ static void extfs_done (vfs *me)
extfs_no = 0; extfs_no = 0;
} }
static int extfs_setctl (vfs *me, char *path, int ctlop, char *arg) static int extfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
{ {
if (ctlop == MCCTL_EXTFS_RUN) { if (ctlop == MCCTL_EXTFS_RUN) {
extfs_run (path); extfs_run (path);
@ -1377,7 +1377,7 @@ static int extfs_setctl (vfs *me, char *path, int ctlop, char *arg)
return 0; return 0;
} }
vfs vfs_extfs_ops = { struct vfs_class vfs_extfs_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"extfs", "extfs",
0, /* flags */ 0, /* flags */

View File

@ -80,7 +80,7 @@ static char reply_str [80];
static struct vfs_class vfs_fish_ops; static struct vfs_class vfs_fish_ops;
static int static int
command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5))); __attribute__ ((format (printf, 4, 5)));
static int decode_reply (char *s, int was_garbage) static int decode_reply (char *s, int was_garbage)
@ -95,7 +95,7 @@ static int decode_reply (char *s, int was_garbage)
} }
/* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */ /* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */
static int get_reply (vfs *me, int sock, char *string_buf, int string_len) static int get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len)
{ {
char answer[1024]; char answer[1024];
int was_garbage = 0; int was_garbage = 0;
@ -119,7 +119,7 @@ static int get_reply (vfs *me, int sock, char *string_buf, int string_len)
#define SUP super->u.fish #define SUP super->u.fish
static int static int
command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *str; char *str;
@ -151,7 +151,7 @@ command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
} }
static void static void
free_archive (vfs *me, vfs_s_super *super) free_archive (struct vfs_class *me, vfs_s_super *super)
{ {
if ((SUP.sockw != -1) || (SUP.sockr != -1)){ if ((SUP.sockw != -1) || (SUP.sockr != -1)){
print_vfs_message (_("fish: Disconnecting from %s"), super->name?super->name:"???"); print_vfs_message (_("fish: Disconnecting from %s"), super->name?super->name:"???");
@ -197,14 +197,14 @@ pipeopen(vfs_s_super *super, char *path, char *argv[])
} }
/* The returned directory should always contain a trailing slash */ /* The returned directory should always contain a trailing slash */
static char *fish_getcwd(vfs *me, vfs_s_super *super) static char *fish_getcwd(struct vfs_class *me, vfs_s_super *super)
{ {
if (command(me, super, WANT_STRING, "#PWD\npwd; echo '### 200'\n") == COMPLETE) if (command(me, super, WANT_STRING, "#PWD\npwd; echo '### 200'\n") == COMPLETE)
return g_strconcat (reply_str, "/", NULL); return g_strconcat (reply_str, "/", NULL);
ERRNOR (EIO, NULL); ERRNOR (EIO, NULL);
} }
static int static int
open_archive_int (vfs *me, vfs_s_super *super) open_archive_int (struct vfs_class *me, vfs_s_super *super)
{ {
char *argv[100]; char *argv[100];
char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh"); char *xsh = (SUP.flags == FISH_FLAG_RSH ? "rsh" : "ssh");
@ -295,7 +295,7 @@ open_archive_int (vfs *me, vfs_s_super *super)
} }
static int static int
open_archive (vfs *me, vfs_s_super *super, char *archive_name, char *op) open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op)
{ {
char *host, *user, *password, *p; char *host, *user, *password, *p;
int flags; int flags;
@ -317,7 +317,7 @@ open_archive (vfs *me, vfs_s_super *super, char *archive_name, char *op)
} }
static int static int
archive_same(vfs *me, vfs_s_super *super, char *archive_name, char *op, void *cookie) archive_same(struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op, void *cookie)
{ {
char *host, *user; char *host, *user;
int flags; int flags;
@ -337,7 +337,7 @@ archive_same(vfs *me, vfs_s_super *super, char *archive_name, char *op, void *co
} }
static int static int
dir_uptodate(vfs *me, vfs_s_inode *ino) dir_uptodate(struct vfs_class *me, vfs_s_inode *ino)
{ {
struct timeval tim; struct timeval tim;
@ -352,7 +352,7 @@ dir_uptodate(vfs *me, vfs_s_inode *ino)
} }
static int static int
dir_load(vfs *me, vfs_s_inode *dir, char *remote_path) dir_load(struct vfs_class *me, vfs_s_inode *dir, char *remote_path)
{ {
vfs_s_super *super = dir->super; vfs_s_super *super = dir->super;
char buffer[8192]; char buffer[8192];
@ -475,7 +475,7 @@ error:
} }
static int static int
file_store(vfs *me, vfs_s_fh *fh, char *name, char *localname) file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname)
{ {
vfs_s_super *super = FH_SUPER; vfs_s_super *super = FH_SUPER;
int n, total; int n, total;
@ -562,7 +562,7 @@ error_return:
return -1; return -1;
} }
static int linear_start(vfs *me, vfs_s_fh *fh, int offset) static int linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
{ {
char *name; char *name;
char *quoted_name; char *quoted_name;
@ -596,7 +596,7 @@ static int linear_start(vfs *me, vfs_s_fh *fh, int offset)
} }
static void static void
linear_abort (vfs *me, vfs_s_fh *fh) linear_abort (struct vfs_class *me, vfs_s_fh *fh)
{ {
vfs_s_super *super = FH_SUPER; vfs_s_super *super = FH_SUPER;
char buffer[8192]; char buffer[8192];
@ -617,7 +617,7 @@ linear_abort (vfs *me, vfs_s_fh *fh)
} }
static int static int
linear_read (vfs *me, vfs_s_fh *fh, void *buf, int len) linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len)
{ {
vfs_s_super *super = FH_SUPER; vfs_s_super *super = FH_SUPER;
int n = 0; int n = 0;
@ -638,7 +638,7 @@ linear_read (vfs *me, vfs_s_fh *fh, void *buf, int len)
} }
static void static void
linear_close (vfs *me, vfs_s_fh *fh) linear_close (struct vfs_class *me, vfs_s_fh *fh)
{ {
if (fh->u.fish.total != fh->u.fish.got) if (fh->u.fish.total != fh->u.fish.got)
linear_abort(me, fh); linear_abort(me, fh);
@ -671,7 +671,7 @@ fish_ctl (void *fh, int ctlop, int arg)
} }
static int static int
send_fish_command(vfs *me, vfs_s_super *super, char *cmd, int flags) send_fish_command(struct vfs_class *me, vfs_s_super *super, char *cmd, int flags)
{ {
int r; int r;
@ -696,7 +696,7 @@ send_fish_command(vfs *me, vfs_s_super *super, char *cmd, int flags)
return send_fish_command(me, super, buf, flags); return send_fish_command(me, super, buf, flags);
static int static int
fish_chmod (vfs *me, char *path, int mode) fish_chmod (struct vfs_class *me, char *path, int mode)
{ {
PREFIX PREFIX
g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n" g_snprintf(buf, sizeof(buf), "#CHMOD %4.4o /%s\n"
@ -708,7 +708,7 @@ fish_chmod (vfs *me, char *path, int mode)
} }
#define FISH_OP(name, chk, string) \ #define FISH_OP(name, chk, string) \
static int fish_##name (vfs *me, char *path1, char *path2) \ static int fish_##name (struct vfs_class *me, char *path1, char *path2) \
{ \ { \
char buf[BUF_LARGE]; \ char buf[BUF_LARGE]; \
char *rpath1, *rpath2; \ char *rpath1, *rpath2; \
@ -733,7 +733,7 @@ FISH_OP(link, XTEST, "#LINK /%s /%s\n"
"ln /%s /%s 2>/dev/null\n" "ln /%s /%s 2>/dev/null\n"
"echo '### 000'" ) "echo '### 000'" )
static int fish_symlink (vfs *me, char *setto, char *path) static int fish_symlink (struct vfs_class *me, char *setto, char *path)
{ {
PREFIX PREFIX
setto = name_quote (setto, 0); setto = name_quote (setto, 0);
@ -747,7 +747,7 @@ static int fish_symlink (vfs *me, char *setto, char *path)
} }
static int static int
fish_chown (vfs *me, char *path, int owner, int group) fish_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
char *sowner, *sgroup; char *sowner, *sgroup;
struct passwd *pw; struct passwd *pw;
@ -780,7 +780,7 @@ fish_chown (vfs *me, char *path, int owner, int group)
POSTFIX(OPT_FLUSH) POSTFIX(OPT_FLUSH)
} }
static int fish_unlink (vfs *me, char *path) static int fish_unlink (struct vfs_class *me, char *path)
{ {
PREFIX PREFIX
g_snprintf(buf, sizeof(buf), g_snprintf(buf, sizeof(buf),
@ -791,7 +791,7 @@ static int fish_unlink (vfs *me, char *path)
POSTFIX(OPT_FLUSH); POSTFIX(OPT_FLUSH);
} }
static int fish_mkdir (vfs *me, char *path, mode_t mode) static int fish_mkdir (struct vfs_class *me, char *path, mode_t mode)
{ {
PREFIX PREFIX
g_snprintf(buf, sizeof(buf), g_snprintf(buf, sizeof(buf),
@ -802,7 +802,7 @@ static int fish_mkdir (vfs *me, char *path, mode_t mode)
POSTFIX(OPT_FLUSH); POSTFIX(OPT_FLUSH);
} }
static int fish_rmdir (vfs *me, char *path) static int fish_rmdir (struct vfs_class *me, char *path)
{ {
PREFIX PREFIX
g_snprintf(buf, sizeof(buf), g_snprintf(buf, sizeof(buf),
@ -813,7 +813,7 @@ static int fish_rmdir (vfs *me, char *path)
POSTFIX(OPT_FLUSH); POSTFIX(OPT_FLUSH);
} }
static int fish_fh_open (vfs *me, vfs_s_fh *fh, int flags, int mode) static int fish_fh_open (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode)
{ {
fh->u.fish.append = 0; fh->u.fish.append = 0;
/* File will be written only, so no need to retrieve it */ /* File will be written only, so no need to retrieve it */
@ -864,7 +864,7 @@ static struct vfs_s_data fish_data = {
}; };
static void static void
fish_fill_names (vfs *me, void (*func)(char *)) fish_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
struct vfs_s_super * super = fish_data.supers; struct vfs_s_super * super = fish_data.supers;
char *flags; char *flags;

View File

@ -156,16 +156,16 @@ static struct vfs_class vfs_ftpfs_ops;
c) strip trailing "/." c) strip trailing "/."
*/ */
static char *ftpfs_get_current_directory (vfs *me, vfs_s_super *super); static char *ftpfs_get_current_directory (struct vfs_class *me, vfs_s_super *super);
static int ftpfs_chdir_internal (vfs *me, vfs_s_super *super, char *remote_path); static int ftpfs_chdir_internal (struct vfs_class *me, vfs_s_super *super, char *remote_path);
static int command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) static int command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5))); __attribute__ ((format (printf, 4, 5)));
static int ftpfs_open_socket (vfs *me, vfs_s_super *super); static int ftpfs_open_socket (struct vfs_class *me, vfs_s_super *super);
static int login_server (vfs *me, vfs_s_super *super, const char *netrcpass); static int login_server (struct vfs_class *me, vfs_s_super *super, const char *netrcpass);
static int lookup_netrc (const char *host, char **login, char **pass); static int lookup_netrc (const char *host, char **login, char **pass);
static char * static char *
translate_path (vfs *me, vfs_s_super *super, const char *remote_path) translate_path (struct vfs_class *me, vfs_s_super *super, const char *remote_path)
{ {
if (!SUP.remote_is_amiga) if (!SUP.remote_is_amiga)
return g_strdup (remote_path); return g_strdup (remote_path);
@ -253,7 +253,7 @@ ftp_split_url(char *path, char **host, char **user, int *port, char **pass)
/* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */ /* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */
static int static int
get_reply (vfs *me, int sock, char *string_buf, int string_len) get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len)
{ {
char answer[BUF_1K]; char answer[BUF_1K];
int i; int i;
@ -297,7 +297,7 @@ get_reply (vfs *me, int sock, char *string_buf, int string_len)
} }
static int static int
reconnect (vfs *me, vfs_s_super *super) reconnect (struct vfs_class *me, vfs_s_super *super)
{ {
int sock = ftpfs_open_socket (me, super); int sock = ftpfs_open_socket (me, super);
if (sock != -1){ if (sock != -1){
@ -318,7 +318,7 @@ reconnect (vfs *me, vfs_s_super *super)
} }
static int static int
command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *cmdstr; char *cmdstr;
@ -378,7 +378,7 @@ command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
} }
static void static void
free_archive (vfs *me, vfs_s_super *super) free_archive (struct vfs_class *me, vfs_s_super *super)
{ {
if (SUP.sock != -1){ if (SUP.sock != -1){
print_vfs_message (_("ftpfs: Disconnecting from %s"), SUP.host); print_vfs_message (_("ftpfs: Disconnecting from %s"), SUP.host);
@ -401,7 +401,7 @@ free_archive (vfs *me, vfs_s_super *super)
#define TYPE_UNKNOWN -1 #define TYPE_UNKNOWN -1
static int static int
changetype (vfs *me, vfs_s_super *super, int binary) changetype (struct vfs_class *me, vfs_s_super *super, int binary)
{ {
if (binary != SUP.isbinary) { if (binary != SUP.isbinary) {
if (command (me, super, WAIT_REPLY, "TYPE %c", binary ? 'I' : 'A') != COMPLETE) if (command (me, super, WAIT_REPLY, "TYPE %c", binary ? 'I' : 'A') != COMPLETE)
@ -413,7 +413,7 @@ changetype (vfs *me, vfs_s_super *super, int binary)
/* This routine logs the user in */ /* This routine logs the user in */
static int static int
login_server (vfs *me, vfs_s_super *super, const char *netrcpass) login_server (struct vfs_class *me, vfs_s_super *super, const char *netrcpass)
{ {
char *pass; char *pass;
char *op; char *op;
@ -653,7 +653,7 @@ ftpfs_get_proxy_host_and_port (const char *proxy, char **host, int *port)
} }
static int static int
ftpfs_open_socket (vfs *me, vfs_s_super *super) ftpfs_open_socket (struct vfs_class *me, vfs_s_super *super)
{ {
struct sockaddr_in server_address; struct sockaddr_in server_address;
struct hostent *hp; struct hostent *hp;
@ -730,7 +730,7 @@ ftpfs_open_socket (vfs *me, vfs_s_super *super)
} }
static int static int
open_archive_int (vfs *me, vfs_s_super *super) open_archive_int (struct vfs_class *me, vfs_s_super *super)
{ {
int retry_seconds, count_down; int retry_seconds, count_down;
@ -780,7 +780,7 @@ open_archive_int (vfs *me, vfs_s_super *super)
} }
static int static int
open_archive (vfs *me, vfs_s_super *super, char *archive_name, char *op) open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op)
{ {
char *host, *user, *password; char *host, *user, *password;
int port; int port;
@ -807,7 +807,7 @@ open_archive (vfs *me, vfs_s_super *super, char *archive_name, char *op)
} }
static int static int
archive_same(vfs *me, vfs_s_super *super, char *archive_name, char *op, void *cookie) archive_same(struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op, void *cookie)
{ {
char *host, *user; char *host, *user;
int port; int port;
@ -831,7 +831,7 @@ ftpfs_flushdir (void)
} }
static int static int
dir_uptodate(vfs *me, vfs_s_inode *ino) dir_uptodate(struct vfs_class *me, vfs_s_inode *ino)
{ {
struct timeval tim; struct timeval tim;
@ -847,7 +847,7 @@ dir_uptodate(vfs *me, vfs_s_inode *ino)
/* The returned directory should always contain a trailing slash */ /* The returned directory should always contain a trailing slash */
static char * static char *
ftpfs_get_current_directory (vfs *me, vfs_s_super *super) ftpfs_get_current_directory (struct vfs_class *me, vfs_s_super *super)
{ {
char buf[BUF_8K], *bufp, *bufq; char buf[BUF_8K], *bufp, *bufq;
@ -887,7 +887,7 @@ ftpfs_get_current_directory (vfs *me, vfs_s_super *super)
/* Setup Passive ftp connection, we use it for source routed connections */ /* Setup Passive ftp connection, we use it for source routed connections */
static int static int
setup_passive (vfs *me, vfs_s_super *super, int my_socket, struct sockaddr_in *sa) setup_passive (struct vfs_class *me, vfs_s_super *super, int my_socket, struct sockaddr_in *sa)
{ {
int xa, xb, xc, xd, xe, xf; int xa, xb, xc, xd, xe, xf;
char n [6]; char n [6];
@ -921,7 +921,7 @@ setup_passive (vfs *me, vfs_s_super *super, int my_socket, struct sockaddr_in *s
} }
static int static int
initconn (vfs *me, vfs_s_super *super) initconn (struct vfs_class *me, vfs_s_super *super)
{ {
struct sockaddr_in data_addr; struct sockaddr_in data_addr;
int data; int data;
@ -972,7 +972,7 @@ again:
} }
static int static int
open_data_connection (vfs *me, vfs_s_super *super, const char *cmd, open_data_connection (struct vfs_class *me, vfs_s_super *super, const char *cmd,
const char *remote, int isbinary, int reget) const char *remote, int isbinary, int reget)
{ {
struct sockaddr_in from; struct sockaddr_in from;
@ -1015,7 +1015,7 @@ open_data_connection (vfs *me, vfs_s_super *super, const char *cmd,
#define ABORT_TIMEOUT 5 #define ABORT_TIMEOUT 5
static void static void
linear_abort (vfs *me, vfs_s_fh *fh) linear_abort (struct vfs_class *me, vfs_s_fh *fh)
{ {
vfs_s_super *super = FH_SUPER; vfs_s_super *super = FH_SUPER;
static unsigned char const ipbuf[3] = { IAC, IP, IAC }; static unsigned char const ipbuf[3] = { IAC, IP, IAC };
@ -1065,7 +1065,7 @@ linear_abort (vfs *me, vfs_s_fh *fh)
#if 0 #if 0
static void static void
resolve_symlink_without_ls_options(vfs *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink_without_ls_options(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir)
{ {
struct linklist *flist; struct linklist *flist;
struct direntry *fe, *fel; struct direntry *fe, *fel;
@ -1126,7 +1126,7 @@ resolve_symlink_without_ls_options(vfs *me, vfs_s_super *super, vfs_s_inode *dir
} }
static void static void
resolve_symlink_with_ls_options(vfs *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink_with_ls_options(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir)
{ {
char buffer[2048] = "", *filename; char buffer[2048] = "", *filename;
int sock; int sock;
@ -1205,7 +1205,7 @@ done:
} }
static void static void
resolve_symlink(vfs *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir)
{ {
print_vfs_message(_("Resolving symlink...")); print_vfs_message(_("Resolving symlink..."));
@ -1217,7 +1217,7 @@ resolve_symlink(vfs *me, vfs_s_super *super, vfs_s_inode *dir)
#endif #endif
static int static int
dir_load (vfs *me, vfs_s_inode *dir, char *remote_path) dir_load (struct vfs_class *me, vfs_s_inode *dir, char *remote_path)
{ {
vfs_s_entry *ent; vfs_s_entry *ent;
vfs_s_super *super = dir->super; vfs_s_super *super = dir->super;
@ -1373,7 +1373,7 @@ fallback:
} }
static int static int
file_store(vfs *me, vfs_s_fh *fh, char *name, char *localname) file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname)
{ {
int h, sock, n; int h, sock, n;
off_t total; off_t total;
@ -1451,7 +1451,7 @@ error_return:
} }
static int static int
linear_start(vfs *me, vfs_s_fh *fh, int offset) linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
{ {
char *name = vfs_s_fullpath (me, fh->ino); char *name = vfs_s_fullpath (me, fh->ino);
@ -1468,7 +1468,7 @@ linear_start(vfs *me, vfs_s_fh *fh, int offset)
} }
static int static int
linear_read (vfs *me, vfs_s_fh *fh, void *buf, int len) linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len)
{ {
int n; int n;
vfs_s_super *super = FH_SUPER; vfs_s_super *super = FH_SUPER;
@ -1494,7 +1494,7 @@ linear_read (vfs *me, vfs_s_fh *fh, void *buf, int len)
} }
static void static void
linear_close (vfs *me, vfs_s_fh *fh) linear_close (struct vfs_class *me, vfs_s_fh *fh)
{ {
if (FH_SOCK != -1) if (FH_SOCK != -1)
linear_abort(me, fh); linear_abort(me, fh);
@ -1524,7 +1524,7 @@ static int ftpfs_ctl (void *fh, int ctlop, int arg)
/* Warning: filename passed to this command is damaged */ /* Warning: filename passed to this command is damaged */
static int static int
send_ftp_command(vfs *me, char *filename, char *cmd, int flags) send_ftp_command(struct vfs_class *me, char *filename, char *cmd, int flags)
{ {
char *rpath, *p; char *rpath, *p;
vfs_s_super *super; vfs_s_super *super;
@ -1565,7 +1565,7 @@ ftpfs_init_passwd(void)
ftpfs_anonymous_passwd = g_strdup ("anonymous@"); ftpfs_anonymous_passwd = g_strdup ("anonymous@");
} }
static int ftpfs_chmod (vfs *me, char *path, int mode) static int ftpfs_chmod (struct vfs_class *me, char *path, int mode)
{ {
char buf[BUF_SMALL]; char buf[BUF_SMALL];
@ -1573,7 +1573,7 @@ static int ftpfs_chmod (vfs *me, char *path, int mode)
return send_ftp_command(me, path, buf, OPT_FLUSH); return send_ftp_command(me, path, buf, OPT_FLUSH);
} }
static int ftpfs_chown (vfs *me, char *path, int owner, int group) static int ftpfs_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
#if 0 #if 0
my_errno = EPERM; my_errno = EPERM;
@ -1585,14 +1585,14 @@ static int ftpfs_chown (vfs *me, char *path, int owner, int group)
#endif #endif
} }
static int ftpfs_unlink (vfs *me, char *path) static int ftpfs_unlink (struct vfs_class *me, char *path)
{ {
return send_ftp_command(me, path, "DELE /%s", OPT_FLUSH); return send_ftp_command(me, path, "DELE /%s", OPT_FLUSH);
} }
/* Return 1 if path is the same directory as the one we are in now */ /* Return 1 if path is the same directory as the one we are in now */
static int static int
is_same_dir (vfs *me, vfs_s_super *super, const char *path) is_same_dir (struct vfs_class *me, vfs_s_super *super, const char *path)
{ {
if (!SUP.cwdir) if (!SUP.cwdir)
return 0; return 0;
@ -1602,7 +1602,7 @@ is_same_dir (vfs *me, vfs_s_super *super, const char *path)
} }
static int static int
ftpfs_chdir_internal (vfs *me, vfs_s_super *super, char *remote_path) ftpfs_chdir_internal (struct vfs_class *me, vfs_s_super *super, char *remote_path)
{ {
int r; int r;
char *p; char *p;
@ -1624,23 +1624,23 @@ ftpfs_chdir_internal (vfs *me, vfs_s_super *super, char *remote_path)
return r; return r;
} }
static int ftpfs_rename (vfs *me, char *path1, char *path2) static int ftpfs_rename (struct vfs_class *me, char *path1, char *path2)
{ {
send_ftp_command(me, path1, "RNFR /%s", OPT_FLUSH); send_ftp_command(me, path1, "RNFR /%s", OPT_FLUSH);
return send_ftp_command(me, path2, "RNTO /%s", OPT_FLUSH); return send_ftp_command(me, path2, "RNTO /%s", OPT_FLUSH);
} }
static int ftpfs_mkdir (vfs *me, char *path, mode_t mode) static int ftpfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
{ {
return send_ftp_command(me, path, "MKD /%s", OPT_FLUSH); return send_ftp_command(me, path, "MKD /%s", OPT_FLUSH);
} }
static int ftpfs_rmdir (vfs *me, char *path) static int ftpfs_rmdir (struct vfs_class *me, char *path)
{ {
return send_ftp_command(me, path, "RMD /%s", OPT_FLUSH); return send_ftp_command(me, path, "RMD /%s", OPT_FLUSH);
} }
static int ftpfs_fh_open (vfs *me, vfs_s_fh *fh, int flags, int mode) static int ftpfs_fh_open (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode)
{ {
fh->u.ftp.append = 0; fh->u.ftp.append = 0;
/* File will be written only, so no need to retrieve it from ftp server */ /* File will be written only, so no need to retrieve it from ftp server */
@ -1697,7 +1697,7 @@ static int ftpfs_fh_open (vfs *me, vfs_s_fh *fh, int flags, int mode)
return 0; return 0;
} }
static int ftpfs_fh_close (vfs *me, vfs_s_fh *fh) static int ftpfs_fh_close (struct vfs_class *me, vfs_s_fh *fh)
{ {
if (fh->handle != -1 && !fh->ino->localname){ if (fh->handle != -1 && !fh->ino->localname){
close (fh->handle); close (fh->handle);
@ -1742,7 +1742,7 @@ static struct vfs_s_data ftp_data = {
}; };
static void static void
ftpfs_done (vfs *me) ftpfs_done (struct vfs_class *me)
{ {
struct no_proxy_entry *np; struct no_proxy_entry *np;
@ -1757,7 +1757,7 @@ ftpfs_done (vfs *me)
} }
static void static void
ftpfs_fill_names (vfs *me, void (*func)(char *)) ftpfs_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
struct vfs_s_super * super = ftp_data.supers; struct vfs_s_super * super = ftp_data.supers;
char *name; char *name;

View File

@ -17,7 +17,7 @@
* */ * */
static void * static void *
local_open (vfs *me, char *file, int flags, int mode) local_open (struct vfs_class *me, char *file, int flags, int mode)
{ {
int *local_info; int *local_info;
int fd; int fd;
@ -66,13 +66,13 @@ local_close (void *data)
} }
int int
local_errno (vfs *me) local_errno (struct vfs_class *me)
{ {
return errno; return errno;
} }
static void * static void *
local_opendir (vfs *me, char *dirname) local_opendir (struct vfs_class *me, char *dirname)
{ {
DIR **local_info; DIR **local_info;
DIR *dir; DIR *dir;
@ -128,13 +128,13 @@ local_closedir (void *data)
} }
static int static int
local_stat (vfs *me, char *path, struct stat *buf) local_stat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return stat (path, buf); return stat (path, buf);
} }
static int static int
local_lstat (vfs *me, char *path, struct stat *buf) local_lstat (struct vfs_class *me, char *path, struct stat *buf)
{ {
#ifndef HAVE_STATLSTAT #ifndef HAVE_STATLSTAT
return lstat (path,buf); return lstat (path,buf);
@ -150,37 +150,37 @@ local_fstat (void *data, struct stat *buf)
} }
static int static int
local_chmod (vfs *me, char *path, int mode) local_chmod (struct vfs_class *me, char *path, int mode)
{ {
return chmod (path, mode); return chmod (path, mode);
} }
static int static int
local_chown (vfs *me, char *path, int owner, int group) local_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
return chown (path, owner, group); return chown (path, owner, group);
} }
static int static int
local_utime (vfs *me, char *path, struct utimbuf *times) local_utime (struct vfs_class *me, char *path, struct utimbuf *times)
{ {
return utime (path, times); return utime (path, times);
} }
static int static int
local_readlink (vfs *me, char *path, char *buf, int size) local_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
return readlink (path, buf, size); return readlink (path, buf, size);
} }
static int static int
local_unlink (vfs *me, char *path) local_unlink (struct vfs_class *me, char *path)
{ {
return unlink (path); return unlink (path);
} }
static int static int
local_symlink (vfs *me, char *n1, char *n2) local_symlink (struct vfs_class *me, char *n1, char *n2)
{ {
return symlink (n1, n2); return symlink (n1, n2);
} }
@ -208,13 +208,13 @@ local_write (void *data, char *buf, int nbyte)
} }
static int static int
local_rename (vfs *me, char *a, char *b) local_rename (struct vfs_class *me, char *a, char *b)
{ {
return rename (a, b); return rename (a, b);
} }
static int static int
local_chdir (vfs *me, char *path) local_chdir (struct vfs_class *me, char *path)
{ {
return chdir (path); return chdir (path);
} }
@ -228,31 +228,31 @@ local_lseek (void *data, off_t offset, int whence)
} }
static int static int
local_mknod (vfs *me, char *path, int mode, int dev) local_mknod (struct vfs_class *me, char *path, int mode, int dev)
{ {
return mknod (path, mode, dev); return mknod (path, mode, dev);
} }
static int static int
local_link (vfs *me, char *p1, char *p2) local_link (struct vfs_class *me, char *p1, char *p2)
{ {
return link (p1, p2); return link (p1, p2);
} }
static int static int
local_mkdir (vfs *me, char *path, mode_t mode) local_mkdir (struct vfs_class *me, char *path, mode_t mode)
{ {
return mkdir (path, mode); return mkdir (path, mode);
} }
static int static int
local_rmdir (vfs *me, char *path) local_rmdir (struct vfs_class *me, char *path)
{ {
return rmdir (path); return rmdir (path);
} }
static vfsid static vfsid
local_getid (vfs *me, const char *path, struct vfs_stamping **parent) local_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
{ {
*parent = NULL; *parent = NULL;
return (vfsid) -1; /* We do not free local fs stuff at all */ return (vfsid) -1; /* We do not free local fs stuff at all */
@ -270,20 +270,20 @@ local_free (vfsid id)
} }
static char * static char *
local_getlocalcopy (vfs *me, char *path) local_getlocalcopy (struct vfs_class *me, char *path)
{ {
return g_strdup (path); return g_strdup (path);
} }
static int static int
local_ungetlocalcopy (vfs *me, char *path, char *local, int has_changed) local_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
{ {
return 0; return 0;
} }
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
caddr_t caddr_t
local_mmap (vfs *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset) local_mmap (struct vfs_class *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset)
{ {
int fd = * (int *)data; int fd = * (int *)data;
@ -291,19 +291,19 @@ local_mmap (vfs *me, caddr_t addr, size_t len, int prot, int flags, void *data,
} }
int int
local_munmap (vfs *me, caddr_t addr, size_t len, void *data) local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data)
{ {
return munmap (addr, len); return munmap (addr, len);
} }
#endif #endif
static int static int
local_which (vfs *me, char *path) local_which (struct vfs_class *me, char *path)
{ {
return 0; /* Every path which other systems do not like is expected to be ours */ return 0; /* Every path which other systems do not like is expected to be ours */
} }
vfs vfs_local_ops = { struct vfs_class vfs_local_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"localfs", "localfs",
VFSF_LOCAL, /* flags */ VFSF_LOCAL, /* flags */

View File

@ -4,11 +4,11 @@
extern int local_close (void *data); extern int local_close (void *data);
extern int local_read (void *data, char *buffer, int count); extern int local_read (void *data, char *buffer, int count);
extern int local_fstat (void *data, struct stat *buf); extern int local_fstat (void *data, struct stat *buf);
extern int local_errno (vfs *me); extern int local_errno (struct vfs_class *me);
extern int local_lseek (void *data, off_t offset, int whence); extern int local_lseek (void *data, off_t offset, int whence);
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
extern caddr_t local_mmap (vfs *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset); extern caddr_t local_mmap (struct vfs_class *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset);
extern int local_munmap (vfs *me, caddr_t addr, size_t len, void *data); extern int local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data);
#endif #endif
#endif #endif

View File

@ -91,7 +91,7 @@ mcfs_get_host_and_username (char *path, char **host, char **user,
} }
static void static void
mcfs_fill_names (vfs *me, void (*func) (char *)) mcfs_fill_names (struct vfs_class *me, void (*func) (char *))
{ {
int i; int i;
char *name; char *name;
@ -511,7 +511,7 @@ mcfs_gethome (mcfs_connection *mc)
/* The callbacks */ /* The callbacks */
static void * static void *
mcfs_open (vfs *me, char *file, int flags, int mode) mcfs_open (struct vfs_class *me, char *file, int flags, int mode)
{ {
char *remote_file; char *remote_file;
mcfs_connection *mc; mcfs_connection *mc;
@ -610,7 +610,7 @@ mcfs_close (void *data)
} }
static int static int
mcfs_errno (vfs *me) mcfs_errno (struct vfs_class *me)
{ {
return my_errno; return my_errno;
} }
@ -630,7 +630,7 @@ typedef struct {
} opendir_info; } opendir_info;
static void * static void *
mcfs_opendir (vfs *me, char *dirname) mcfs_opendir (struct vfs_class *me, char *dirname)
{ {
opendir_info *mcfs_info; opendir_info *mcfs_info;
mcfs_connection *mc; mcfs_connection *mc;
@ -876,13 +876,13 @@ mcfs_stat_cmd (int cmd, char *path, struct stat *buf)
} }
static int static int
mcfs_stat (vfs *me, char *path, struct stat *buf) mcfs_stat (struct vfs_class *me, char *path, struct stat *buf)
{ {
return mcfs_stat_cmd (MC_STAT, path, buf); return mcfs_stat_cmd (MC_STAT, path, buf);
} }
static int static int
mcfs_lstat (vfs *me, char *path, struct stat *buf) mcfs_lstat (struct vfs_class *me, char *path, struct stat *buf)
{ {
int path_len = strlen (path); int path_len = strlen (path);
int entry_len = strlen (mcfs_readdir_data.dent.d_name); int entry_len = strlen (mcfs_readdir_data.dent.d_name);
@ -920,19 +920,19 @@ mcfs_fstat (void *data, struct stat *buf)
} }
static int static int
mcfs_chmod (vfs *me, char *path, int mode) mcfs_chmod (struct vfs_class *me, char *path, int mode)
{ {
return mcfs_rpc_path_int (MC_CHMOD, path, mode); return mcfs_rpc_path_int (MC_CHMOD, path, mode);
} }
static int static int
mcfs_chown (vfs *me, char *path, int owner, int group) mcfs_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
return mcfs_rpc_path_int_int (MC_CHOWN, path, owner, group); return mcfs_rpc_path_int_int (MC_CHOWN, path, owner, group);
} }
static int static int
mcfs_utime (vfs *me, char *path, struct utimbuf *times) mcfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
{ {
mcfs_connection *mc; mcfs_connection *mc;
int status; int status;
@ -964,7 +964,7 @@ mcfs_utime (vfs *me, char *path, struct utimbuf *times)
} }
static int static int
mcfs_readlink (vfs *me, char *path, char *buf, int size) mcfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
char *remote_file, *stat_str; char *remote_file, *stat_str;
int status, error; int status, error;
@ -994,25 +994,25 @@ mcfs_readlink (vfs *me, char *path, char *buf, int size)
} }
static int static int
mcfs_unlink (vfs *me, char *path) mcfs_unlink (struct vfs_class *me, char *path)
{ {
return mcfs_rpc_path (MC_UNLINK, path); return mcfs_rpc_path (MC_UNLINK, path);
} }
static int static int
mcfs_symlink (vfs *me, char *n1, char *n2) mcfs_symlink (struct vfs_class *me, char *n1, char *n2)
{ {
return mcfs_rpc_two_paths (MC_SYMLINK, n1, n2); return mcfs_rpc_two_paths (MC_SYMLINK, n1, n2);
} }
static int static int
mcfs_rename (vfs *me, char *a, char *b) mcfs_rename (struct vfs_class *me, char *a, char *b)
{ {
return mcfs_rpc_two_paths (MC_RENAME, a, b); return mcfs_rpc_two_paths (MC_RENAME, a, b);
} }
static int static int
mcfs_chdir (vfs *me, char *path) mcfs_chdir (struct vfs_class *me, char *path)
{ {
char *remote_dir; char *remote_dir;
mcfs_connection *mc; mcfs_connection *mc;
@ -1049,25 +1049,25 @@ mcfs_lseek (void *data, off_t offset, int whence)
} }
static int static int
mcfs_mknod (vfs *me, char *path, int mode, int dev) mcfs_mknod (struct vfs_class *me, char *path, int mode, int dev)
{ {
return mcfs_rpc_path_int_int (MC_MKNOD, path, mode, dev); return mcfs_rpc_path_int_int (MC_MKNOD, path, mode, dev);
} }
static int static int
mcfs_mkdir (vfs *me, char *path, mode_t mode) mcfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
{ {
return mcfs_rpc_path_int (MC_MKDIR, path, mode); return mcfs_rpc_path_int (MC_MKDIR, path, mode);
} }
static int static int
mcfs_rmdir (vfs *me, char *path) mcfs_rmdir (struct vfs_class *me, char *path)
{ {
return mcfs_rpc_path (MC_RMDIR, path); return mcfs_rpc_path (MC_RMDIR, path);
} }
static int static int
mcfs_link (vfs *me, char *p1, char *p2) mcfs_link (struct vfs_class *me, char *p1, char *p2)
{ {
return mcfs_rpc_two_paths (MC_LINK, p1, p2); return mcfs_rpc_two_paths (MC_LINK, p1, p2);
} }
@ -1076,7 +1076,7 @@ mcfs_link (vfs *me, char *p1, char *p2)
* out of them * out of them
*/ */
static vfsid static vfsid
mcfs_getid (vfs *me, char *p, struct vfs_stamping **parent) mcfs_getid (struct vfs_class *me, const char *p, struct vfs_stamping **parent)
{ {
*parent = NULL; *parent = NULL;
@ -1141,7 +1141,7 @@ my_forget (char *path)
} }
static int static int
mcfs_setctl (vfs *me, char *path, int ctlop, char *arg) mcfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
{ {
switch (ctlop) { switch (ctlop) {
case MCCTL_FORGET_ABOUT: case MCCTL_FORGET_ABOUT:
@ -1151,7 +1151,7 @@ mcfs_setctl (vfs *me, char *path, int ctlop, char *arg)
return 0; return 0;
} }
vfs vfs_mcfs_ops = { struct vfs_class vfs_mcfs_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"mcfs", "mcfs",
0, /* flags */ 0, /* flags */

View File

@ -47,7 +47,7 @@ static int uptodate (char *name, char *cache)
return 1; return 1;
} }
static int vfmake (vfs *me, char *name, char *cache) static int vfmake (struct vfs_class *me, char *name, char *cache)
{ {
char *inpath, *op; char *inpath, *op;
int w; int w;
@ -104,7 +104,7 @@ static int vfmake (vfs *me, char *name, char *cache)
} }
static char * static char *
redirect (vfs *me, char *name) redirect (struct vfs_class *me, char *name)
{ {
struct cachedfile *cur = head; struct cachedfile *cur = head;
char *cache; char *cache;
@ -147,7 +147,7 @@ redirect (vfs *me, char *name)
} }
static void * static void *
sfs_open (vfs *me, char *path, int flags, int mode) sfs_open (struct vfs_class *me, char *path, int flags, int mode)
{ {
int *sfs_info; int *sfs_info;
int fd; int fd;
@ -163,13 +163,13 @@ sfs_open (vfs *me, char *path, int flags, int mode)
return sfs_info; return sfs_info;
} }
static int sfs_stat (vfs *me, char *path, struct stat *buf) static int sfs_stat (struct vfs_class *me, char *path, struct stat *buf)
{ {
path = redirect (me, path); path = redirect (me, path);
return stat (path, buf); return stat (path, buf);
} }
static int sfs_lstat (vfs *me, char *path, struct stat *buf) static int sfs_lstat (struct vfs_class *me, char *path, struct stat *buf)
{ {
path = redirect (me, path); path = redirect (me, path);
#ifndef HAVE_STATLSTAT #ifndef HAVE_STATLSTAT
@ -179,34 +179,34 @@ static int sfs_lstat (vfs *me, char *path, struct stat *buf)
#endif #endif
} }
static int sfs_chmod (vfs *me, char *path, int mode) static int sfs_chmod (struct vfs_class *me, char *path, int mode)
{ {
path = redirect (me, path); path = redirect (me, path);
return chmod (path, mode); return chmod (path, mode);
} }
static int sfs_chown (vfs *me, char *path, int owner, int group) static int sfs_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
path = redirect (me, path); path = redirect (me, path);
return chown (path, owner, group); return chown (path, owner, group);
} }
static int sfs_utime (vfs *me, char *path, struct utimbuf *times) static int sfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
{ {
path = redirect (me, path); path = redirect (me, path);
return utime (path, times); return utime (path, times);
} }
static int sfs_readlink (vfs *me, char *path, char *buf, int size) static int sfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
path = redirect (me, path); path = redirect (me, path);
return readlink (path, buf, size); return readlink (path, buf, size);
} }
static vfsid static vfsid
sfs_getid (vfs *me, const char *path, struct vfs_stamping **parent) sfs_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
{ /* FIXME: what should I do? */ { /* FIXME: what should I do? */
vfs *v; struct vfs_class *v;
vfsid id; vfsid id;
struct vfs_stamping *par; struct vfs_stamping *par;
struct cachedfile *cur = head; struct cachedfile *cur = head;
@ -266,7 +266,7 @@ static void sfs_free (vfsid id)
g_free (cur); g_free (cur);
} }
static void sfs_fill_names (vfs *me, void (*func)(char *)) static void sfs_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
struct cachedfile *cur = head; struct cachedfile *cur = head;
@ -283,19 +283,19 @@ static int sfs_nothingisopen (vfsid id)
return 1; return 1;
} }
static char *sfs_getlocalcopy (vfs *me, char *path) static char *sfs_getlocalcopy (struct vfs_class *me, char *path)
{ {
path = redirect (me, path); path = redirect (me, path);
return g_strdup (path); return g_strdup (path);
} }
static int sfs_ungetlocalcopy (vfs *me, char *path, char *local, int has_changed) static int sfs_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
{ {
g_free(local); g_free(local);
return 0; return 0;
} }
static int sfs_init (vfs *me) static int sfs_init (struct vfs_class *me)
{ {
char *mc_sfsini; char *mc_sfsini;
FILE *cfg; FILE *cfg;
@ -364,7 +364,7 @@ static int sfs_init (vfs *me)
} }
static void static void
sfs_done (vfs *me) sfs_done (struct vfs_class *me)
{ {
int i; int i;
@ -377,7 +377,7 @@ sfs_done (vfs *me)
} }
static int static int
sfs_which (vfs *me, char *path) sfs_which (struct vfs_class *me, char *path)
{ {
int i; int i;
@ -392,7 +392,7 @@ sfs_which (vfs *me, char *path)
return -1; return -1;
} }
vfs vfs_sfs_ops = { struct vfs_class vfs_sfs_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"sfs", "sfs",
0, /* flags */ 0, /* flags */

View File

@ -273,7 +273,7 @@ smbfs_set_debugf (const char *filename)
/********************** The callbacks ******************************/ /********************** The callbacks ******************************/
static int static int
smbfs_init (vfs * me) smbfs_init (struct vfs_class * me)
{ {
char *servicesf = CONFIGDIR PATH_SEP_STR "smb.conf"; char *servicesf = CONFIGDIR PATH_SEP_STR "smb.conf";
@ -322,7 +322,7 @@ smbfs_init (vfs * me)
} }
static void static void
smbfs_fill_names (vfs *me, void (*func)(char *)) smbfs_fill_names (struct vfs_class *me, void (*func)(char *))
{ {
int i; int i;
char *path; char *path;
@ -394,7 +394,7 @@ smbfs_close (void *data)
} }
static int static int
smbfs_errno (vfs *me) smbfs_errno (struct vfs_class *me)
{ {
DEBUG(3, ("smbfs_errno: %s\n", g_strerror(my_errno))); DEBUG(3, ("smbfs_errno: %s\n", g_strerror(my_errno)));
return my_errno; return my_errno;
@ -815,7 +815,7 @@ smbfs_closedir (void *info)
} }
static int static int
smbfs_chmod (vfs *me, char *path, int mode) smbfs_chmod (struct vfs_class *me, char *path, int mode)
{ {
DEBUG(3, ("smbfs_chmod(path:%s, mode:%d)\n", path, mode)); DEBUG(3, ("smbfs_chmod(path:%s, mode:%d)\n", path, mode));
/* my_errno = EOPNOTSUPP; /* my_errno = EOPNOTSUPP;
@ -824,7 +824,7 @@ smbfs_chmod (vfs *me, char *path, int mode)
} }
static int static int
smbfs_chown (vfs *me, char *path, int owner, int group) smbfs_chown (struct vfs_class *me, char *path, int owner, int group)
{ {
DEBUG(3, ("smbfs_chown(path:%s, owner:%d, group:%d)\n", path, owner, group)); DEBUG(3, ("smbfs_chown(path:%s, owner:%d, group:%d)\n", path, owner, group));
my_errno = EOPNOTSUPP; /* ready for your labotomy? */ my_errno = EOPNOTSUPP; /* ready for your labotomy? */
@ -832,7 +832,7 @@ smbfs_chown (vfs *me, char *path, int owner, int group)
} }
static int static int
smbfs_utime (vfs *me, char *path, struct utimbuf *times) smbfs_utime (struct vfs_class *me, char *path, struct utimbuf *times)
{ {
DEBUG(3, ("smbfs_utime(path:%s)\n", path)); DEBUG(3, ("smbfs_utime(path:%s)\n", path));
my_errno = EOPNOTSUPP; my_errno = EOPNOTSUPP;
@ -840,7 +840,7 @@ smbfs_utime (vfs *me, char *path, struct utimbuf *times)
} }
static int static int
smbfs_readlink (vfs *me, char *path, char *buf, int size) smbfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
{ {
DEBUG(3, ("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf, size)); DEBUG(3, ("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf, size));
my_errno = EOPNOTSUPP; my_errno = EOPNOTSUPP;
@ -848,7 +848,7 @@ smbfs_readlink (vfs *me, char *path, char *buf, int size)
} }
static int static int
smbfs_symlink (vfs *me, char *n1, char *n2) smbfs_symlink (struct vfs_class *me, char *n1, char *n2)
{ {
DEBUG(3, ("smbfs_symlink(n1:%s, n2:%s)\n", n1, n2)); DEBUG(3, ("smbfs_symlink(n1:%s, n2:%s)\n", n1, n2));
my_errno = EOPNOTSUPP; my_errno = EOPNOTSUPP;
@ -1178,7 +1178,7 @@ is_error (int result, int errno_num)
#endif #endif
static void * static void *
smbfs_opendir (vfs *me, char *dirname) smbfs_opendir (struct vfs_class *me, char *dirname)
{ {
opendir_info *smbfs_info; opendir_info *smbfs_info;
smbfs_connection *sc; smbfs_connection *sc;
@ -1427,7 +1427,7 @@ get_stat_info (smbfs_connection * sc, char *path, struct stat *buf)
} }
static int static int
smbfs_chdir (vfs *me, char *path) smbfs_chdir (struct vfs_class *me, char *path)
{ {
char *remote_dir; char *remote_dir;
smbfs_connection *sc; smbfs_connection *sc;
@ -1441,7 +1441,7 @@ smbfs_chdir (vfs *me, char *path)
} }
static int static int
loaddir(vfs *me, const char *path) loaddir(struct vfs_class *me, const char *path)
{ {
void *info; void *info;
char *mypath, *p; char *mypath, *p;
@ -1463,7 +1463,7 @@ loaddir(vfs *me, const char *path)
} }
static int static int
smbfs_stat (vfs * me, char *path, struct stat *buf) smbfs_stat (struct vfs_class * me, char *path, struct stat *buf)
{ {
smbfs_connection *sc; smbfs_connection *sc;
pstring server_url; pstring server_url;
@ -1599,7 +1599,7 @@ smbfs_lseek (void *data, off_t offset, int whence)
} }
static int static int
smbfs_mknod (vfs *me, char *path, int mode, int dev) smbfs_mknod (struct vfs_class *me, char *path, int mode, int dev)
{ {
DEBUG(3, ("smbfs_mknod(path:%s, mode:%d, dev:%d)\n", path, mode, dev)); DEBUG(3, ("smbfs_mknod(path:%s, mode:%d, dev:%d)\n", path, mode, dev));
my_errno = EOPNOTSUPP; my_errno = EOPNOTSUPP;
@ -1607,7 +1607,7 @@ smbfs_mknod (vfs *me, char *path, int mode, int dev)
} }
static int static int
smbfs_mkdir (vfs * me, char *path, mode_t mode) smbfs_mkdir (struct vfs_class * me, char *path, mode_t mode)
{ {
smbfs_connection *sc; smbfs_connection *sc;
char *remote_file; char *remote_file;
@ -1630,7 +1630,7 @@ smbfs_mkdir (vfs * me, char *path, mode_t mode)
} }
static int static int
smbfs_rmdir (vfs *me, char *path) smbfs_rmdir (struct vfs_class *me, char *path)
{ {
smbfs_connection *sc; smbfs_connection *sc;
char *remote_file; char *remote_file;
@ -1654,7 +1654,7 @@ smbfs_rmdir (vfs *me, char *path)
} }
static int static int
smbfs_link (vfs *me, char *p1, char *p2) smbfs_link (struct vfs_class *me, char *p1, char *p2)
{ {
DEBUG (3, ("smbfs_link(p1:%s, p2:%s)\n", p1, p2)); DEBUG (3, ("smbfs_link(p1:%s, p2:%s)\n", p1, p2));
my_errno = EOPNOTSUPP; my_errno = EOPNOTSUPP;
@ -1665,7 +1665,7 @@ smbfs_link (vfs *me, char *p1, char *p2)
* out of them * out of them
*/ */
static vfsid static vfsid
smbfs_getid (vfs *me, const char *p, struct vfs_stamping **parent) smbfs_getid (struct vfs_class *me, const char *p, struct vfs_stamping **parent)
{ {
*parent = NULL; *parent = NULL;
DEBUG (3, ("smbfs_getid(p:%s)\n", p)); DEBUG (3, ("smbfs_getid(p:%s)\n", p));
@ -1727,7 +1727,7 @@ my_forget (char *path)
} }
static int static int
smbfs_setctl (vfs *me, char *path, int ctlop, char *arg) smbfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
{ {
DEBUG(3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop)); DEBUG(3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop));
switch (ctlop) { switch (ctlop) {
@ -1782,7 +1782,7 @@ open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int mode)
} }
static void * static void *
smbfs_open (vfs *me, char *file, int flags, int mode) smbfs_open (struct vfs_class *me, char *file, int flags, int mode)
{ {
char *remote_file, *p; char *remote_file, *p;
void *ret; void *ret;
@ -1812,7 +1812,7 @@ smbfs_open (vfs *me, char *file, int flags, int mode)
} }
static int static int
smbfs_unlink (vfs *me, char *path) smbfs_unlink (struct vfs_class *me, char *path)
{ {
smbfs_connection *sc; smbfs_connection *sc;
char *remote_file, *p; char *remote_file, *p;
@ -1835,7 +1835,7 @@ smbfs_unlink (vfs *me, char *path)
} }
static int static int
smbfs_rename (vfs *me, char *a, char *b) smbfs_rename (struct vfs_class *me, char *a, char *b)
{ {
smbfs_connection *sc; smbfs_connection *sc;
char *ra, *rb; char *ra, *rb;
@ -1887,7 +1887,7 @@ smbfs_fstat (void *data, struct stat *buf)
return 0; return 0;
} }
vfs vfs_smbfs_ops = { struct vfs_class vfs_smbfs_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"smbfs", "smbfs",
VFSF_NOLINKS, /* flags */ VFSF_NOLINKS, /* flags */

View File

@ -61,7 +61,7 @@ static long from_oct (int digs, char *where)
static struct stat hstat; /* Stat struct corresponding */ static struct stat hstat; /* Stat struct corresponding */
static void tar_free_archive (vfs *me, vfs_s_super *archive) static void tar_free_archive (struct vfs_class *me, vfs_s_super *archive)
{ {
if (archive->u.tar.fd != -1) if (archive->u.tar.fd != -1)
mc_close(archive->u.tar.fd); mc_close(archive->u.tar.fd);
@ -71,7 +71,7 @@ static void tar_free_archive (vfs *me, vfs_s_super *archive)
static int current_tar_position = 0; static int current_tar_position = 0;
/* Returns fd of the open tar file */ /* Returns fd of the open tar file */
static int tar_open_archive (vfs *me, char *name, vfs_s_super *archive) static int tar_open_archive (struct vfs_class *me, char *name, vfs_s_super *archive)
{ {
int result, type; int result, type;
mode_t mode; mode_t mode;
@ -141,7 +141,7 @@ static void skip_n_records (vfs_s_super *archive, int tard, int n)
current_tar_position += n * RECORDSIZE; current_tar_position += n * RECORDSIZE;
} }
static void fill_stat_from_header (vfs *me, struct stat *st, union record *header) static void fill_stat_from_header (struct vfs_class *me, struct stat *st, union record *header)
{ {
st->st_mode = from_oct (8, header->header.mode); st->st_mode = from_oct (8, header->header.mode);
@ -198,7 +198,7 @@ typedef enum {
* *
*/ */
static ReadStatus static ReadStatus
read_header (vfs *me, vfs_s_super *archive, int tard) read_header (struct vfs_class *me, vfs_s_super *archive, int tard)
{ {
register int i; register int i;
register long sum, signed_sum, recsum; register long sum, signed_sum, recsum;
@ -376,7 +376,7 @@ read_header (vfs *me, vfs_s_super *archive, int tard)
* Main loop for reading an archive. * Main loop for reading an archive.
* Returns 0 on success, -1 on error. * Returns 0 on success, -1 on error.
*/ */
static int open_archive (vfs *me, vfs_s_super *archive, char *name, char *op) static int open_archive (struct vfs_class *me, vfs_s_super *archive, char *name, char *op)
{ {
ReadStatus status = STATUS_EOFMARK; /* Initial status at start of archive */ ReadStatus status = STATUS_EOFMARK; /* Initial status at start of archive */
ReadStatus prev_status; ReadStatus prev_status;
@ -435,7 +435,7 @@ static int open_archive (vfs *me, vfs_s_super *archive, char *name, char *op)
return 0; return 0;
} }
static void *tar_super_check(vfs *me, char *archive_name, char *op) static void *tar_super_check(struct vfs_class *me, char *archive_name, char *op)
{ {
static struct stat stat_buf; static struct stat stat_buf;
if (mc_stat (archive_name, &stat_buf)) if (mc_stat (archive_name, &stat_buf))
@ -444,7 +444,7 @@ static void *tar_super_check(vfs *me, char *archive_name, char *op)
} }
static int static int
tar_super_same (vfs *me, struct vfs_s_super *parc, char *archive_name, tar_super_same (struct vfs_class *me, struct vfs_s_super *parc, char *archive_name,
char *op, void *cookie) char *op, void *cookie)
{ {
struct stat *archive_stat = cookie; /* stat of main archive */ struct stat *archive_stat = cookie; /* stat of main archive */
@ -468,7 +468,7 @@ static int tar_read (void *fh, char *buffer, int count)
{ {
off_t begin = FH->ino->u.tar.data_offset; off_t begin = FH->ino->u.tar.data_offset;
int fd = FH_SUPER->u.tar.fd; int fd = FH_SUPER->u.tar.fd;
vfs *me = FH_SUPER->me; struct vfs_class *me = FH_SUPER->me;
if (mc_lseek (fd, begin + FH->pos, SEEK_SET) != if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
begin + FH->pos) ERRNOR (EIO, -1); begin + FH->pos) ERRNOR (EIO, -1);
@ -481,7 +481,7 @@ static int tar_read (void *fh, char *buffer, int count)
return count; return count;
} }
static int tar_ungetlocalcopy (vfs *me, char *path, char *local, int has_changed) static int tar_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
{ {
/* We do just nothing. (We are read only and do not need to free local, /* We do just nothing. (We are read only and do not need to free local,
since it will be freed when tar archive will be freed */ since it will be freed when tar archive will be freed */
@ -489,7 +489,7 @@ static int tar_ungetlocalcopy (vfs *me, char *path, char *local, int has_changed
ERRNOR (EROFS, -has_changed); ERRNOR (EROFS, -has_changed);
} }
static int tar_fh_open (vfs *me, vfs_s_fh *fh, int flags, int mode) static int tar_fh_open (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode)
{ {
if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1); if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1);
return 0; return 0;

View File

@ -269,7 +269,7 @@ void com_err (const char *str, long err_code, const char *s2, ...)
} }
static void * static void *
undelfs_opendir (vfs *me, char *dirname) undelfs_opendir (struct vfs_class *me, char *dirname)
{ {
char *file, *f; char *file, *f;
@ -370,7 +370,7 @@ typedef struct {
/* We do not support lseek */ /* We do not support lseek */
static void * static void *
undelfs_open (vfs *me, char *fname, int flags, int mode) undelfs_open (struct vfs_class *me, char *fname, int flags, int mode)
{ {
char *file, *f; char *file, *f;
ext2_ino_t inode, i; ext2_ino_t inode, i;
@ -544,7 +544,7 @@ do_stat (int inode_index, struct stat *buf)
} }
static int static int
undelfs_lstat(vfs *me, char *path, struct stat *buf) undelfs_lstat(struct vfs_class *me, char *path, struct stat *buf)
{ {
int inode_index; int inode_index;
char *file, *f; char *file, *f;
@ -582,7 +582,7 @@ undelfs_lstat(vfs *me, char *path, struct stat *buf)
} }
static int static int
undelfs_stat(vfs *me, char *path, struct stat *buf) undelfs_stat(struct vfs_class *me, char *path, struct stat *buf)
{ {
return undelfs_lstat (me, path, buf); return undelfs_lstat (me, path, buf);
} }
@ -597,7 +597,7 @@ undelfs_fstat (void *vfs_info, struct stat *buf)
} }
static int static int
undelfs_chdir(vfs *me, char *path) undelfs_chdir(struct vfs_class *me, char *path)
{ {
char *file, *f; char *file, *f;
int fd; int fd;
@ -629,7 +629,7 @@ undelfs_lseek(void *vfs_info, off_t offset, int whence)
} }
static vfsid static vfsid
undelfs_getid(vfs *me, const char *path, struct vfs_stamping **parent) undelfs_getid(struct vfs_class *me, const char *path, struct vfs_stamping **parent)
{ {
char *ext2_fname, *file; char *ext2_fname, *file;
@ -658,7 +658,7 @@ undelfs_free(vfsid id)
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
static int static int
undelfs_init(vfs *me) { undelfs_init(struct vfs_class *me) {
undelfserr = _(undelfserr); undelfserr = _(undelfserr);
return 1; return 1;
} }
@ -666,7 +666,7 @@ undelfs_init(vfs *me) {
#define undelfs_init NULL #define undelfs_init NULL
#endif #endif
vfs vfs_undelfs_ops = { struct vfs_class vfs_undelfs_ops = {
NULL, /* This is place of next pointer */ NULL, /* This is place of next pointer */
"undelfs", "undelfs",
0, /* flags */ 0, /* flags */

View File

@ -72,7 +72,7 @@ static int current_year;
static struct { static struct {
void *fs_info; void *fs_info;
vfs *operations; struct vfs_class *operations;
} vfs_file_table [MAX_VFS_FILES]; } vfs_file_table [MAX_VFS_FILES];
static int static int
@ -90,7 +90,7 @@ get_bucket (void)
return 0; return 0;
} }
static vfs *vfs_list; static struct vfs_class *vfs_list;
int int
vfs_register_class (struct vfs_class *vfs) vfs_register_class (struct vfs_class *vfs)
@ -174,12 +174,12 @@ path_magic (const char *path)
* What is left in path is p1. You still want to g_free(path), you DON'T * What is left in path is p1. You still want to g_free(path), you DON'T
* want to free neither *inpath nor *op * want to free neither *inpath nor *op
*/ */
vfs * struct vfs_class *
vfs_split (const char *path, char **inpath, char **op) vfs_split (const char *path, char **inpath, char **op)
{ {
char *semi; char *semi;
char *slash; char *slash;
vfs *ret; struct vfs_class *ret;
if (!path) if (!path)
vfs_die("Cannot split NULL"); vfs_die("Cannot split NULL");
@ -216,12 +216,12 @@ vfs_split (const char *path, char **inpath, char **op)
return ret; return ret;
} }
static vfs * static struct vfs_class *
_vfs_get_class (const char *path) _vfs_get_class (const char *path)
{ {
char *semi; char *semi;
char *slash; char *slash;
vfs *ret; struct vfs_class *ret;
g_return_val_if_fail(path, NULL); g_return_val_if_fail(path, NULL);
@ -245,10 +245,10 @@ _vfs_get_class (const char *path)
return ret; return ret;
} }
vfs * struct vfs_class *
vfs_get_class (const char *path) vfs_get_class (const char *path)
{ {
vfs *vfs; struct vfs_class *vfs;
vfs = _vfs_get_class(path); vfs = _vfs_get_class(path);
@ -272,7 +272,7 @@ vfs_timeouts ()
} }
static void static void
vfs_addstamp (vfs *v, vfsid id, struct vfs_stamping *parent) vfs_addstamp (struct vfs_class *v, vfsid id, struct vfs_stamping *parent)
{ {
if (!(v->flags & VFSF_LOCAL) && id != (vfsid)-1){ if (!(v->flags & VFSF_LOCAL) && id != (vfsid)-1){
struct vfs_stamping *stamp; struct vfs_stamping *stamp;
@ -315,7 +315,7 @@ vfs_addstamp (vfs *v, vfsid id, struct vfs_stamping *parent)
} }
void void
vfs_stamp (vfs *v, vfsid id) vfs_stamp (struct vfs_class *v, vfsid id)
{ {
struct vfs_stamping *stamp; struct vfs_stamping *stamp;
@ -343,7 +343,7 @@ vfs_rm_parents (struct vfs_stamping *stamp)
} }
void void
vfs_rmstamp (vfs *v, vfsid id, int removeparents) vfs_rmstamp (struct vfs_class *v, vfsid id, int removeparents)
{ {
struct vfs_stamping *stamp, *st1; struct vfs_stamping *stamp, *st1;
@ -366,7 +366,7 @@ vfs_rmstamp (vfs *v, vfsid id, int removeparents)
} }
static int static int
ferrno (vfs *vfs) ferrno (struct vfs_class *vfs)
{ {
return vfs->ferrno ? (*vfs->ferrno)(vfs) : E_UNKNOWN; return vfs->ferrno ? (*vfs->ferrno)(vfs) : E_UNKNOWN;
/* Hope that error message is obscure enough ;-) */ /* Hope that error message is obscure enough ;-) */
@ -381,7 +381,7 @@ mc_open (const char *filename, int flags, ...)
va_list ap; va_list ap;
char *file = vfs_canon (filename); char *file = vfs_canon (filename);
vfs *vfs = vfs_get_class (file); struct vfs_class *vfs = vfs_get_class (file);
/* Get the mode flag */ /* FIXME: should look if O_CREAT is present */ /* Get the mode flag */ /* FIXME: should look if O_CREAT is present */
va_start (ap, flags); va_start (ap, flags);
@ -413,7 +413,7 @@ mc_open (const char *filename, int flags, ...)
#define MC_OP(name, inarg, callarg, pre, post) \ #define MC_OP(name, inarg, callarg, pre, post) \
int mc_##name inarg \ int mc_##name inarg \
{ \ { \
vfs *vfs; \ struct vfs_class *vfs; \
int result; \ int result; \
\ \
pre \ pre \
@ -434,7 +434,7 @@ MC_HANDLEOP(read, (int handle, char *buffer, int count), (vfs_info (handle), buf
int int
mc_ctl (int handle, int ctlop, int arg) mc_ctl (int handle, int ctlop, int arg)
{ {
vfs *vfs = vfs_op (handle); struct vfs_class *vfs = vfs_op (handle);
return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0; return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0;
} }
@ -442,7 +442,7 @@ mc_ctl (int handle, int ctlop, int arg)
int int
mc_setctl (char *path, int ctlop, char *arg) mc_setctl (char *path, int ctlop, char *arg)
{ {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
if (!path) if (!path)
@ -458,7 +458,7 @@ mc_setctl (char *path, int ctlop, char *arg)
int int
mc_close (int handle) mc_close (int handle)
{ {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
if (handle == -1 || !vfs_info (handle)) if (handle == -1 || !vfs_info (handle))
@ -483,7 +483,7 @@ mc_opendir (char *dirname)
{ {
int handle, *handlep; int handle, *handlep;
void *info; void *info;
vfs *vfs; struct vfs_class *vfs;
dirname = vfs_canon (dirname); dirname = vfs_canon (dirname);
vfs = vfs_get_class (dirname); vfs = vfs_get_class (dirname);
@ -507,7 +507,7 @@ void
mc_seekdir (DIR *dirp, int offset) mc_seekdir (DIR *dirp, int offset)
{ {
int handle; int handle;
vfs *vfs; struct vfs_class *vfs;
if (!dirp){ if (!dirp){
errno = EFAULT; errno = EFAULT;
@ -525,7 +525,7 @@ mc_seekdir (DIR *dirp, int offset)
type mc_##name (DIR *dirp) \ type mc_##name (DIR *dirp) \
{ \ { \
int handle; \ int handle; \
vfs *vfs; \ struct vfs_class *vfs; \
type result; \ type result; \
\ \
if (!dirp){ \ if (!dirp){ \
@ -547,7 +547,7 @@ int
mc_closedir (DIR *dirp) mc_closedir (DIR *dirp)
{ {
int handle = *(int *) dirp; int handle = *(int *) dirp;
vfs *vfs = vfs_op (handle); struct vfs_class *vfs = vfs_op (handle);
int result; int result;
result = vfs->closedir ? (*vfs->closedir)(vfs_info (handle)) : -1; result = vfs->closedir ? (*vfs->closedir)(vfs_info (handle)) : -1;
@ -557,7 +557,7 @@ mc_closedir (DIR *dirp)
} }
int mc_stat (const char *filename, struct stat *buf) { int mc_stat (const char *filename, struct stat *buf) {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
char *path; char *path;
path = vfs_canon (filename); vfs = vfs_get_class (path); path = vfs_canon (filename); vfs = vfs_get_class (path);
@ -569,7 +569,7 @@ int mc_stat (const char *filename, struct stat *buf) {
} }
int mc_lstat (const char *filename, struct stat *buf) { int mc_lstat (const char *filename, struct stat *buf) {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
char *path; char *path;
path = vfs_canon (filename); vfs = vfs_get_class (path); path = vfs_canon (filename); vfs = vfs_get_class (path);
@ -581,7 +581,7 @@ int mc_lstat (const char *filename, struct stat *buf) {
} }
int mc_fstat (int handle, struct stat *buf) { int mc_fstat (int handle, struct stat *buf) {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
if (handle == -1) if (handle == -1)
@ -667,7 +667,7 @@ MC_NAMEOP (symlink, (char *name1, char *path), (vfs, name1, path))
#define MC_RENAMEOP(name) \ #define MC_RENAMEOP(name) \
int mc_##name (const char *fname1, const char *fname2) \ int mc_##name (const char *fname1, const char *fname2) \
{ \ { \
vfs *vfs; \ struct vfs_class *vfs; \
int result; \ int result; \
\ \
char *name2, *name1 = vfs_canon (fname1); \ char *name2, *name1 = vfs_canon (fname1); \
@ -695,7 +695,7 @@ MC_HANDLEOP (write, (int handle, char *buf, int nbyte), (vfs_info (handle), buf,
off_t mc_lseek (int fd, off_t offset, int whence) off_t mc_lseek (int fd, off_t offset, int whence)
{ {
vfs *vfs; struct vfs_class *vfs;
int result; int result;
if (fd == -1) if (fd == -1)
@ -743,7 +743,7 @@ vfs_canon (const char *path)
} }
static vfsid static vfsid
vfs_ncs_getid (vfs *nvfs, const char *dir, struct vfs_stamping **par) vfs_ncs_getid (struct vfs_class *nvfs, const char *dir, struct vfs_stamping **par)
{ {
vfsid nvfsid; vfsid nvfsid;
char *dir1; char *dir1;
@ -755,7 +755,7 @@ vfs_ncs_getid (vfs *nvfs, const char *dir, struct vfs_stamping **par)
} }
static int static int
is_parent (vfs * nvfs, vfsid nvfsid, struct vfs_stamping *parent) is_parent (struct vfs_class * nvfs, vfsid nvfsid, struct vfs_stamping *parent)
{ {
struct vfs_stamping *stamp; struct vfs_stamping *stamp;
@ -767,9 +767,9 @@ is_parent (vfs * nvfs, vfsid nvfsid, struct vfs_stamping *parent)
} }
static void static void
_vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid, struct vfs_stamping *parent) _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid, struct vfs_stamping *parent)
{ {
vfs *nvfs, *n2vfs, *n3vfs; struct vfs_class *nvfs, *n2vfs, *n3vfs;
vfsid nvfsid, n2vfsid, n3vfsid; vfsid nvfsid, n2vfsid, n3vfsid;
struct vfs_stamping *par, *stamp; struct vfs_stamping *par, *stamp;
int f; int f;
@ -807,8 +807,8 @@ _vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
if ((n2vfs == oldvfs && n2vfsid == oldvfsid) || f) if ((n2vfs == oldvfs && n2vfsid == oldvfsid) || f)
return; return;
} else { } else {
n2vfs = (vfs *) -1; n2vfs = (struct vfs_class *) -1;
n2vfsid = (vfs *) -1; n2vfsid = (struct vfs_class *) -1;
} }
if (get_other_type () == view_listing){ if (get_other_type () == view_listing){
@ -819,8 +819,8 @@ _vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f) if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f)
return; return;
} else { } else {
n3vfs = (vfs *)-1; n3vfs = (struct vfs_class *)-1;
n3vfsid = (vfs *)-1; n3vfsid = (struct vfs_class *)-1;
} }
if ((*oldvfs->nothingisopen) (oldvfsid)){ if ((*oldvfs->nothingisopen) (oldvfsid)){
@ -847,7 +847,7 @@ _vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid, struct vfs_stamping *pa
} }
void void
vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid, vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
struct vfs_stamping *parent) struct vfs_stamping *parent)
{ {
_vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent); _vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
@ -857,7 +857,7 @@ vfs_add_noncurrent_stamps (vfs *oldvfs, vfsid oldvfsid,
static void static void
vfs_stamp_path (char *path) vfs_stamp_path (char *path)
{ {
vfs *vfs; struct vfs_class *vfs;
vfsid id; vfsid id;
struct vfs_stamping *par, *stamp; struct vfs_stamping *par, *stamp;
@ -894,7 +894,7 @@ int
mc_chdir (char *path) mc_chdir (char *path)
{ {
char *new_dir, *new_dir_copy; char *new_dir, *new_dir_copy;
vfs *old_vfs, *new_vfs; struct vfs_class *old_vfs, *new_vfs;
vfsid old_vfsid; vfsid old_vfsid;
struct vfs_stamping *parent; struct vfs_stamping *parent;
int result; int result;
@ -962,7 +962,7 @@ vfs_file_is_smb (const char *filename)
{ {
#ifdef WITH_SMBFS #ifdef WITH_SMBFS
#ifdef USE_NETCODE #ifdef USE_NETCODE
vfs *vfs; struct vfs_class *vfs;
char *fname = vfs_canon (filename); char *fname = vfs_canon (filename);
vfs = vfs_get_class (fname); vfs = vfs_get_class (fname);
g_free (fname); g_free (fname);
@ -980,14 +980,14 @@ MC_NAMEOP (mknod, (char *path, int mode, int dev), (vfs, path, mode, dev))
static struct mc_mmapping { static struct mc_mmapping {
caddr_t addr; caddr_t addr;
void *vfs_info; void *vfs_info;
vfs *vfs; struct vfs_class *vfs;
struct mc_mmapping *next; struct mc_mmapping *next;
} *mc_mmaparray = NULL; } *mc_mmaparray = NULL;
caddr_t caddr_t
mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
{ {
vfs *vfs; struct vfs_class *vfs;
caddr_t result; caddr_t result;
struct mc_mmapping *mcm; struct mc_mmapping *mcm;
@ -1032,7 +1032,7 @@ mc_munmap (caddr_t addr, size_t len)
#endif #endif
char * char *
mc_def_getlocalcopy (vfs *vfs, char *filename) mc_def_getlocalcopy (struct vfs_class *vfs, char *filename)
{ {
char *tmp, *suffix, *basename; char *tmp, *suffix, *basename;
int fdin, fdout, i; int fdin, fdout, i;
@ -1092,7 +1092,7 @@ mc_getlocalcopy (const char *pathname)
{ {
char *result; char *result;
char *path = vfs_canon (pathname); char *path = vfs_canon (pathname);
vfs *vfs = vfs_get_class (path); struct vfs_class *vfs = vfs_get_class (path);
result = vfs->getlocalcopy ? (*vfs->getlocalcopy)(vfs, path) : result = vfs->getlocalcopy ? (*vfs->getlocalcopy)(vfs, path) :
mc_def_getlocalcopy (vfs, path); mc_def_getlocalcopy (vfs, path);
@ -1103,7 +1103,7 @@ mc_getlocalcopy (const char *pathname)
} }
int int
mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed) mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local, int has_changed)
{ /* Dijkstra probably hates me... But he should teach me how to do this nicely. */ { /* Dijkstra probably hates me... But he should teach me how to do this nicely. */
int fdin = -1, fdout = -1, i; int fdin = -1, fdout = -1, i;
if (has_changed){ if (has_changed){
@ -1150,7 +1150,7 @@ mc_ungetlocalcopy (const char *pathname, char *local, int has_changed)
{ {
int return_value = 0; int return_value = 0;
char *path = vfs_canon (pathname); char *path = vfs_canon (pathname);
vfs *vfs = vfs_get_class (path); struct vfs_class *vfs = vfs_get_class (path);
return_value = vfs->ungetlocalcopy ? return_value = vfs->ungetlocalcopy ?
(*vfs->ungetlocalcopy)(vfs, path, local, has_changed) : (*vfs->ungetlocalcopy)(vfs, path, local, has_changed) :
@ -1250,7 +1250,7 @@ void
vfs_shut (void) vfs_shut (void)
{ {
struct vfs_stamping *stamp, *st; struct vfs_stamping *stamp, *st;
vfs *vfs; struct vfs_class *vfs;
for (stamp = stamps, stamps = 0; stamp != NULL;){ for (stamp = stamps, stamps = 0; stamp != NULL;){
(*stamp->v->free)(stamp->id); (*stamp->v->free)(stamp->id);
@ -1277,7 +1277,7 @@ vfs_shut (void)
void void
vfs_fill_names (void (*func)(char *)) vfs_fill_names (void (*func)(char *))
{ {
vfs *vfs; struct vfs_class *vfs;
for (vfs=vfs_list; vfs; vfs=vfs->next) for (vfs=vfs_list; vfs; vfs=vfs->next)
if (vfs->fill_names) if (vfs->fill_names)

100
vfs/vfs.h
View File

@ -6,9 +6,15 @@
#endif #endif
/* Our virtual file system layer */
typedef void *vfsid; typedef void *vfsid;
struct vfs_stamping;
struct vfs_stamping {
struct vfs_class *v;
vfsid id;
struct vfs_stamping *parent; /* At the moment applies to tarfs only */
struct vfs_stamping *next;
struct timeval time;
};
/* /*
* Notice: Andrej Borsenkow <borsenkow.msk@sni.de> reports system * Notice: Andrej Borsenkow <borsenkow.msk@sni.de> reports system
@ -20,70 +26,68 @@ struct vfs_stamping;
#define VFSF_LOCAL 1 /* Class is local (not virtual) filesystem */ #define VFSF_LOCAL 1 /* Class is local (not virtual) filesystem */
#define VFSF_NOLINKS 2 /* Hard links not supported */ #define VFSF_NOLINKS 2 /* Hard links not supported */
typedef struct vfs_class vfs;
struct vfs_class { struct vfs_class {
vfs *next; struct vfs_class *next;
char *name; /* "FIles over SHell" */ char *name; /* "FIles over SHell" */
int flags; int flags;
char *prefix; /* "fish:" */ char *prefix; /* "fish:" */
void *data; /* this is for filesystem's own use */ void *data; /* this is for filesystem's own use */
int verrno; /* can't use errno because glibc2 might define errno as function */ int verrno; /* can't use errno because glibc2 might define errno as function */
int (*init) (vfs *me); int (*init) (struct vfs_class *me);
void (*done) (vfs *me); void (*done) (struct vfs_class *me);
void (*fill_names) (vfs *me, void (*)(char *)); void (*fill_names) (struct vfs_class *me, void (*)(char *));
int (*which) (vfs *me, char *path); int (*which) (struct vfs_class *me, char *path);
void *(*open) (vfs *me, char *fname, int flags, int mode); void *(*open) (struct vfs_class *me, char *fname, int flags, int mode);
int (*close) (void *vfs_info); int (*close) (void *vfs_info);
int (*read) (void *vfs_info, char *buffer, int count); int (*read) (void *vfs_info, char *buffer, int count);
int (*write) (void *vfs_info, char *buf, int count); int (*write) (void *vfs_info, char *buf, int count);
void *(*opendir) (vfs *me, char *dirname); void *(*opendir) (struct vfs_class *me, char *dirname);
void *(*readdir) (void *vfs_info); void *(*readdir) (void *vfs_info);
int (*closedir) (void *vfs_info); int (*closedir) (void *vfs_info);
int (*telldir) (void *vfs_info); int (*telldir) (void *vfs_info);
void (*seekdir) (void *vfs_info, int offset); void (*seekdir) (void *vfs_info, int offset);
int (*stat) (vfs *me, char *path, struct stat * buf); int (*stat) (struct vfs_class *me, char *path, struct stat * buf);
int (*lstat) (vfs *me, char *path, struct stat * buf); int (*lstat) (struct vfs_class *me, char *path, struct stat * buf);
int (*fstat) (void *vfs_info, struct stat * buf); int (*fstat) (void *vfs_info, struct stat * buf);
int (*chmod) (vfs *me, char *path, int mode); int (*chmod) (struct vfs_class *me, char *path, int mode);
int (*chown) (vfs *me, char *path, int owner, int group); int (*chown) (struct vfs_class *me, char *path, int owner, int group);
int (*utime) (vfs *me, char *path, struct utimbuf * times); int (*utime) (struct vfs_class *me, char *path, struct utimbuf * times);
int (*readlink) (vfs *me, char *path, char *buf, int size); int (*readlink) (struct vfs_class *me, char *path, char *buf, int size);
int (*symlink) (vfs *me, char *n1, char *n2); int (*symlink) (struct vfs_class *me, char *n1, char *n2);
int (*link) (vfs *me, char *p1, char *p2); int (*link) (struct vfs_class *me, char *p1, char *p2);
int (*unlink) (vfs *me, char *path); int (*unlink) (struct vfs_class *me, char *path);
int (*rename) (vfs *me, char *p1, char *p2); int (*rename) (struct vfs_class *me, char *p1, char *p2);
int (*chdir) (vfs *me, char *path); int (*chdir) (struct vfs_class *me, char *path);
int (*ferrno) (vfs *me); int (*ferrno) (struct vfs_class *me);
int (*lseek) (void *vfs_info, off_t offset, int whence); int (*lseek) (void *vfs_info, off_t offset, int whence);
int (*mknod) (vfs *me, char *path, int mode, int dev); int (*mknod) (struct vfs_class *me, char *path, int mode, int dev);
vfsid (*getid) (vfs *me, const char *path, vfsid (*getid) (struct vfs_class *me, const char *path,
struct vfs_stamping ** parent); struct vfs_stamping ** parent);
int (*nothingisopen) (vfsid id); int (*nothingisopen) (vfsid id);
void (*free) (vfsid id); void (*free) (vfsid id);
char *(*getlocalcopy) (vfs *me, char *filename); char *(*getlocalcopy) (struct vfs_class *me, char *filename);
int (*ungetlocalcopy) (vfs *me, char *filename, char *local, int (*ungetlocalcopy) (struct vfs_class *me, char *filename, char *local,
int has_changed); int has_changed);
int (*mkdir) (vfs *me, char *path, mode_t mode); int (*mkdir) (struct vfs_class *me, char *path, mode_t mode);
int (*rmdir) (vfs *me, char *path); int (*rmdir) (struct vfs_class *me, char *path);
int (*ctl) (void *vfs_info, int ctlop, int arg); int (*ctl) (void *vfs_info, int ctlop, int arg);
int (*setctl) (vfs *me, char *path, int ctlop, char *arg); int (*setctl) (struct vfs_class *me, char *path, int ctlop, char *arg);
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
caddr_t (*mmap) (vfs *me, caddr_t addr, size_t len, int prot, caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len, int prot,
int flags, void *vfs_info, off_t offset); int flags, void *vfs_info, off_t offset);
int (*munmap) (vfs *me, caddr_t addr, size_t len, void *vfs_info); int (*munmap) (struct vfs_class *me, caddr_t addr, size_t len, void *vfs_info);
#endif #endif
}; };
@ -105,26 +109,18 @@ void init_fish (void);
void init_ftpfs (void); void init_ftpfs (void);
void init_tarfs (void); void init_tarfs (void);
extern vfs vfs_local_ops; extern struct vfs_class vfs_local_ops;
extern vfs vfs_smbfs_ops; extern struct vfs_class vfs_smbfs_ops;
extern vfs vfs_mcfs_ops; extern struct vfs_class vfs_mcfs_ops;
extern vfs vfs_extfs_ops; extern struct vfs_class vfs_extfs_ops;
extern vfs vfs_sfs_ops; extern struct vfs_class vfs_sfs_ops;
extern vfs vfs_undelfs_ops; extern struct vfs_class 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;
};
void vfs_init (void); void vfs_init (void);
void vfs_shut (void); void vfs_shut (void);
struct vfs_class *vfs_get_class (const char *path); struct vfs_class *vfs_get_class (const char *path);
vfs *vfs_split (const char *path, char **inpath, char **op); struct vfs_class *vfs_split (const char *path, char **inpath, char **op);
char *vfs_path (const char *path); char *vfs_path (const char *path);
char *vfs_strip_suffix_from_filename (const char *filename); char *vfs_strip_suffix_from_filename (const char *filename);
char *vfs_canon (const char *path); char *vfs_canon (const char *path);
@ -141,9 +137,9 @@ vfs_file_is_local (const char *filename)
extern int vfs_timeout; extern int vfs_timeout;
void vfs_stamp (vfs *, vfsid); void vfs_stamp (struct vfs_class *, vfsid);
void vfs_rmstamp (vfs *, vfsid, int); void vfs_rmstamp (struct vfs_class *, vfsid, int);
void vfs_add_noncurrent_stamps (vfs *, vfsid, struct vfs_stamping *); void vfs_add_noncurrent_stamps (struct vfs_class *, vfsid, struct vfs_stamping *);
void vfs_add_current_stamps (void); void vfs_add_current_stamps (void);
void vfs_timeout_handler (void); void vfs_timeout_handler (void);
void vfs_expire (int); void vfs_expire (int);
@ -194,8 +190,8 @@ int mc_mkdir (char *path, mode_t mode);
char *mc_getlocalcopy (const char *pathname); char *mc_getlocalcopy (const char *pathname);
int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed); int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed);
char *mc_def_getlocalcopy (vfs *vfs, char *filename); char *mc_def_getlocalcopy (struct vfs_class *vfs, char *filename);
int mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local,
int has_changed); int has_changed);
int mc_ctl (int fd, int ctlop, int arg); int mc_ctl (int fd, int ctlop, int arg);
int mc_setctl (char *path, int ctlop, char *arg); int mc_setctl (char *path, int ctlop, char *arg);

View File

@ -72,7 +72,7 @@ typedef struct vfs_s_inode {
typedef struct vfs_s_super { typedef struct vfs_s_super {
struct vfs_s_super **prevp, *next; struct vfs_s_super **prevp, *next;
vfs *me; struct vfs_class *me;
vfs_s_inode *root; vfs_s_inode *root;
char *name; /* My name, whatever it means */ char *name; /* My name, whatever it means */
int fd_usage; /* Number of open files */ int fd_usage; /* Number of open files */
@ -150,63 +150,63 @@ struct vfs_s_data {
dev_t rdev; dev_t rdev;
FILE *logfile; FILE *logfile;
int (*init_inode) (vfs *me, vfs_s_inode *ino); /* optional */ int (*init_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */
void (*free_inode) (vfs *me, vfs_s_inode *ino); /* optional */ void (*free_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */
int (*init_entry) (vfs *me, vfs_s_entry *entry); /* optional */ int (*init_entry) (struct vfs_class *me, vfs_s_entry *entry); /* optional */
void* (*archive_check) (vfs *me, char *name, char *op); /* optional */ void* (*archive_check) (struct vfs_class *me, char *name, char *op); /* optional */
int (*archive_same) (vfs *me, vfs_s_super *psup, char *archive_name, char *op, void *cookie); int (*archive_same) (struct vfs_class *me, vfs_s_super *psup, char *archive_name, char *op, void *cookie);
int (*open_archive) (vfs *me, vfs_s_super *psup, char *archive_name, char *op); int (*open_archive) (struct vfs_class *me, vfs_s_super *psup, char *archive_name, char *op);
void (*free_archive) (vfs *me, vfs_s_super *psup); void (*free_archive) (struct vfs_class *me, vfs_s_super *psup);
int (*fh_open) (vfs *me, vfs_s_fh *fh, int flags, int mode); int (*fh_open) (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode);
int (*fh_close) (vfs *me, vfs_s_fh *fh); int (*fh_close) (struct vfs_class *me, vfs_s_fh *fh);
vfs_s_entry* (*find_entry) (vfs *me, vfs_s_inode *root, char *path, int follow, int flags); vfs_s_entry* (*find_entry) (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags);
int (*dir_load) (vfs *me, vfs_s_inode *ino, char *path); int (*dir_load) (struct vfs_class *me, vfs_s_inode *ino, char *path);
int (*dir_uptodate) (vfs *me, vfs_s_inode *ino); int (*dir_uptodate) (struct vfs_class *me, vfs_s_inode *ino);
int (*file_store) (vfs *me, vfs_s_fh *fh, char *path, char *localname); int (*file_store) (struct vfs_class *me, vfs_s_fh *fh, char *path, char *localname);
int (*linear_start) (vfs *me, vfs_s_fh *fh, int from); int (*linear_start) (struct vfs_class *me, vfs_s_fh *fh, int from);
int (*linear_read) (vfs *me, vfs_s_fh *fh, void *buf, int len); int (*linear_read) (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len);
void (*linear_close) (vfs *me, vfs_s_fh *fh); void (*linear_close) (struct vfs_class *me, vfs_s_fh *fh);
}; };
/* entries and inodes */ /* entries and inodes */
vfs_s_inode *vfs_s_new_inode (vfs *me, vfs_s_super *super, vfs_s_inode *vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super,
struct stat *initstat); struct stat *initstat);
vfs_s_entry *vfs_s_new_entry (vfs *me, char *name, vfs_s_inode *inode); vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode);
void vfs_s_free_entry (vfs *me, vfs_s_entry *ent); void vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent);
void vfs_s_insert_entry (vfs *me, vfs_s_inode *dir, void vfs_s_insert_entry (struct vfs_class *me, vfs_s_inode *dir,
vfs_s_entry *ent); vfs_s_entry *ent);
struct stat *vfs_s_default_stat (vfs *me, mode_t mode); struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
void vfs_s_add_dots (vfs *me, vfs_s_inode *dir, void vfs_s_add_dots (struct vfs_class *me, vfs_s_inode *dir,
vfs_s_inode *parent); vfs_s_inode *parent);
vfs_s_entry *vfs_s_generate_entry (vfs *me, char *name, vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, char *name,
struct vfs_s_inode *parent, mode_t mode); struct vfs_s_inode *parent, mode_t mode);
vfs_s_entry *vfs_s_find_entry_tree (vfs *me, vfs_s_inode *root, char *path, vfs_s_entry *vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path,
int follow, int flags); int follow, int flags);
vfs_s_entry *vfs_s_find_entry_linear (vfs *me, vfs_s_inode *root, char *path, vfs_s_entry *vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path,
int follow, int flags); int follow, int flags);
vfs_s_inode *vfs_s_find_inode (vfs *me, vfs_s_inode *root, char *path, vfs_s_inode *vfs_s_find_inode (struct vfs_class *me, vfs_s_inode *root, char *path,
int follow, int flags); int follow, int flags);
vfs_s_inode *vfs_s_find_root (vfs *me, vfs_s_entry *entry); vfs_s_inode *vfs_s_find_root (struct vfs_class *me, vfs_s_entry *entry);
/* outside interface */ /* outside interface */
void vfs_s_init_class (struct vfs_class *vclass); 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 (struct vfs_class *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 (struct vfs_class *me, vfs_s_super *super);
char *vfs_s_fullpath (vfs *me, vfs_s_inode *ino); char *vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino);
/* network filesystems support */ /* network filesystems support */
int vfs_s_select_on_two (int fd1, int fd2); int vfs_s_select_on_two (int fd1, int fd2);
int vfs_s_get_line (vfs *me, int sock, char *buf, int buf_len, char term); int vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char term);
int vfs_s_get_line_interruptible (vfs *me, char *buffer, int size, int fd); int vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int fd);
/* misc */ /* misc */
int vfs_s_retrieve_file (vfs *me, struct vfs_s_inode *ino); 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 ERRNOR(a, b) do { me->verrno = a; return b; } while (0)