* xdirentry.h: Remove all typedefs, there is no need to hide the

fact that structures are structures.  Fix all dependencies.
This commit is contained in:
Pavel Roskin 2003-10-12 01:00:44 +00:00
parent ce356e2ce0
commit 6cf97f4069
7 changed files with 225 additions and 201 deletions

View File

@ -1,5 +1,8 @@
2003-10-11 Pavel Roskin <proski@gnu.org> 2003-10-11 Pavel Roskin <proski@gnu.org>
* xdirentry.h: Remove all typedefs, there is no need to hide the
fact that structures are structures. Fix all dependencies.
* vfs.h: Remove typedef vfs, it's too ambiguous. Massive * vfs.h: Remove typedef vfs, it's too ambiguous. Massive
changes to use struct vfs_class instead. changes to use struct vfs_class instead.

View File

@ -84,16 +84,16 @@ struct defer_inode {
struct defer_inode *next; struct defer_inode *next;
unsigned long inumber; unsigned long inumber;
unsigned short device; unsigned short device;
vfs_s_inode *inode; struct vfs_s_inode *inode;
}; };
static int cpio_position; static int cpio_position;
static int cpio_find_head(struct vfs_class *me, vfs_s_super *super); static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
static int cpio_read_bin_head(struct vfs_class *me, vfs_s_super *super); static int cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
static int cpio_read_oldc_head(struct vfs_class *me, vfs_s_super *super); static int cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super);
static int cpio_read_crc_head(struct vfs_class *me, vfs_s_super *super); static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super);
static int cpio_create_entry(struct vfs_class *me, vfs_s_super *super, struct stat *stat, char *name); static int cpio_create_entry(struct vfs_class *me, struct 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
@ -110,7 +110,7 @@ static struct defer_inode * defer_find(struct defer_inode *l, struct defer_inode
defer_find(l->next, i); defer_find(l->next, i);
} }
static int cpio_skip_padding(vfs_s_super *super) static int cpio_skip_padding(struct vfs_s_super *super)
{ {
switch(super->u.cpio.type) { switch(super->u.cpio.type) {
case CPIO_BIN: case CPIO_BIN:
@ -127,17 +127,17 @@ static int cpio_skip_padding(vfs_s_super *super)
} }
} }
static void cpio_free_archive(struct vfs_class *me, vfs_s_super *super) static void cpio_free_archive(struct vfs_class *me, struct 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(struct vfs_class *me, vfs_s_super *super, char *name) static int cpio_open_cpio_file(struct vfs_class *me, struct vfs_s_super *super, char *name)
{ {
int fd, type; int fd, type;
mode_t mode; mode_t mode;
vfs_s_inode *root; struct vfs_s_inode *root;
if((fd = mc_open(name, O_RDONLY)) == -1) { if((fd = mc_open(name, O_RDONLY)) == -1) {
message_2s(1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name); message_2s(1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
@ -182,7 +182,7 @@ static int cpio_open_cpio_file(struct vfs_class *me, vfs_s_super *super, char *n
return fd; return fd;
} }
static int cpio_read_head(struct vfs_class *me, vfs_s_super *super) static int cpio_read_head(struct vfs_class *me, struct 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(struct vfs_class *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(struct vfs_class *me, vfs_s_super *super) static int cpio_find_head(struct vfs_class *me, struct 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(struct vfs_class *me, vfs_s_super *super)
#undef SEEKBACK #undef SEEKBACK
#define HEAD_LENGTH (26) #define HEAD_LENGTH (26)
static int cpio_read_bin_head(struct vfs_class *me, vfs_s_super *super) static int cpio_read_bin_head(struct vfs_class *me, struct 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(struct vfs_class *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(struct vfs_class *me, vfs_s_super *super) static int cpio_read_oldc_head(struct vfs_class *me, struct 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(struct vfs_class *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(struct vfs_class *me, vfs_s_super *super) static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
{ {
struct new_cpio_header hd; struct new_cpio_header hd;
struct stat stat; struct stat stat;
@ -393,11 +393,11 @@ static int cpio_read_crc_head(struct vfs_class *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(struct vfs_class *me, vfs_s_super *super, struct stat *stat, char *name) static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, struct stat *stat, char *name)
{ {
vfs_s_inode *inode = NULL; struct vfs_s_inode *inode = NULL;
vfs_s_inode *root = super->root; struct vfs_s_inode *root = super->root;
vfs_s_entry *entry = NULL; struct vfs_s_entry *entry = NULL;
char *tn; char *tn;
switch (stat->st_mode & S_IFMT) { /* For case of HP/UX archives */ switch (stat->st_mode & S_IFMT) { /* For case of HP/UX archives */
@ -509,7 +509,7 @@ static int cpio_create_entry(struct vfs_class *me, vfs_s_super *super, struct st
/* 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(struct vfs_class *me, vfs_s_super *super, char *name, char *op) static int cpio_open_archive(struct vfs_class *me, struct vfs_s_super *super, char *name, char *op)
{ {
int status = STATUS_START; int status = STATUS_START;
@ -588,7 +588,7 @@ static int cpio_ungetlocalcopy(struct vfs_class *me, char *path, char *local, in
return 0; return 0;
} }
static int cpio_fh_open(struct vfs_class *me, vfs_s_fh *fh, int flags, int mode) static int cpio_fh_open(struct vfs_class *me, struct 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,15 +34,15 @@
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 (struct vfs_class * me, vfs_s_entry * entry, static struct vfs_s_entry *vfs_s_resolve_symlink (struct vfs_class * me, struct vfs_s_entry * entry,
char *path, int follow); char *path, int follow);
vfs_s_inode * struct vfs_s_inode *
vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct stat *initstat) vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *initstat)
{ {
vfs_s_inode *ino; struct vfs_s_inode *ino;
ino = g_new0 (vfs_s_inode, 1); ino = g_new0 (struct vfs_s_inode, 1);
if (!ino) if (!ino)
return NULL; return NULL;
@ -61,10 +61,10 @@ vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct stat *initstat
return ino; return ino;
} }
vfs_s_entry * struct vfs_s_entry *
vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode) vfs_s_new_entry (struct vfs_class *me, char *name, struct vfs_s_inode *inode)
{ {
vfs_s_entry *entry; struct vfs_s_entry *entry;
entry = g_new0 (struct vfs_s_entry, 1); entry = g_new0 (struct vfs_s_entry, 1);
total_entries++; total_entries++;
@ -80,7 +80,7 @@ vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode)
} }
static void static void
vfs_s_free_inode (struct vfs_class *me, vfs_s_inode *ino) vfs_s_free_inode (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_inode *ino)
} }
void void
vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent) vfs_s_free_entry (struct vfs_class *me, struct 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,9 +130,9 @@ vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent)
} }
void void
vfs_s_insert_entry (struct vfs_class *me, vfs_s_inode *dir, vfs_s_entry *ent) vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir, struct vfs_s_entry *ent)
{ {
vfs_s_entry **ep; struct vfs_s_entry **ep;
for (ep = &dir->subdir; *ep != NULL; ep = &((*ep)->next)) for (ep = &dir->subdir; *ep != NULL; ep = &((*ep)->next))
; ;
@ -167,7 +167,7 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
} }
void void
vfs_s_add_dots (struct vfs_class *me, vfs_s_inode *dir, vfs_s_inode *parent) vfs_s_add_dots (struct vfs_class *me, struct vfs_s_inode *dir, struct vfs_s_inode *parent)
{ {
struct vfs_s_entry *dot, *dotdot; struct vfs_s_entry *dot, *dotdot;
@ -196,8 +196,8 @@ vfs_s_generate_entry (struct vfs_class *me, char *name, struct vfs_s_inode *pare
} }
/* We were asked to create entries automagically */ /* We were asked to create entries automagically */
static vfs_s_entry * static struct vfs_s_entry *
vfs_s_automake (struct vfs_class *me, vfs_s_inode *dir, char *path, int flags) vfs_s_automake (struct vfs_class *me, struct 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);
@ -217,11 +217,11 @@ vfs_s_automake (struct vfs_class *me, vfs_s_inode *dir, char *path, int flags)
* Follow > 0: follow links, serves as loop protect, * Follow > 0: follow links, serves as loop protect,
* == -1: do not follow links * == -1: do not follow links
*/ */
vfs_s_entry * struct vfs_s_entry *
vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root, char *path, int follow, int flags)
{ {
unsigned int pseg; unsigned int pseg;
vfs_s_entry *ent = NULL; struct vfs_s_entry *ent = NULL;
char p[MC_MAXPATHLEN] = ""; char p[MC_MAXPATHLEN] = "";
while (root){ while (root){
@ -275,10 +275,10 @@ split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char
} }
} }
vfs_s_entry * struct vfs_s_entry *
vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root, char *path, int follow, int flags)
{ {
vfs_s_entry* ent = NULL; struct vfs_s_entry* ent = NULL;
if (root->super->root != root) if (root->super->root != root)
vfs_die ("We have to use _real_ root. Always. Sorry." ); vfs_die ("We have to use _real_ root. Always. Sorry." );
@ -287,7 +287,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, in
if (!(flags & FL_DIR)){ if (!(flags & FL_DIR)){
char *dirname, *name, *save; char *dirname, *name, *save;
vfs_s_inode *ino; struct vfs_s_inode *ino;
split_dir_name (me, path, &dirname, &name, &save); split_dir_name (me, path, &dirname, &name, &save);
ino = vfs_s_find_inode (me, root, dirname, follow, flags | FL_DIR); ino = vfs_s_find_inode (me, root, dirname, follow, flags | FL_DIR);
if (save) if (save)
@ -308,7 +308,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, in
} }
if (!ent){ if (!ent){
vfs_s_inode *ino; struct vfs_s_inode *ino;
ino = vfs_s_new_inode (me, root->super, vfs_s_default_stat (me, S_IFDIR | 0755)); ino = vfs_s_new_inode (me, root->super, vfs_s_default_stat (me, S_IFDIR | 0755));
ent = vfs_s_new_entry (me, path, ino); ent = vfs_s_new_entry (me, path, ino);
@ -331,10 +331,10 @@ vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, in
return ent; return ent;
} }
vfs_s_inode * struct vfs_s_inode *
vfs_s_find_inode (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags) vfs_s_find_inode (struct vfs_class *me, struct vfs_s_inode *root, char *path, int follow, int flags)
{ {
vfs_s_entry *ent; struct vfs_s_entry *ent;
if ((MEDATA->find_entry == vfs_s_find_entry_tree) && (!*path)) if ((MEDATA->find_entry == vfs_s_find_entry_tree) && (!*path))
return root; return root;
ent = (MEDATA->find_entry)(me, root, path, follow, flags); ent = (MEDATA->find_entry)(me, root, path, follow, flags);
@ -343,8 +343,8 @@ vfs_s_find_inode (struct vfs_class *me, vfs_s_inode *root, char *path, int follo
return ent->ino; return ent->ino;
} }
static vfs_s_entry * static struct vfs_s_entry *
vfs_s_resolve_symlink (struct vfs_class *me, vfs_s_entry *entry, char *path, int follow) vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, char *path, int follow)
{ {
char buf[MC_MAXPATHLEN], *linkname; char buf[MC_MAXPATHLEN], *linkname;
@ -401,10 +401,10 @@ vfs_s_resolve_symlink (struct vfs_class *me, vfs_s_entry *entry, char *path, int
/* Ook, these were functions around directory entries / inodes */ /* Ook, these were functions around directory entries / inodes */
/* -------------------------------- superblock games -------------------------- */ /* -------------------------------- superblock games -------------------------- */
static vfs_s_super * static struct vfs_s_super *
vfs_s_new_super (struct vfs_class *me) vfs_s_new_super (struct vfs_class *me)
{ {
vfs_s_super *super; struct vfs_s_super *super;
super = g_new0 (struct vfs_s_super, 1); super = g_new0 (struct vfs_s_super, 1);
super->me = me; super->me = me;
@ -412,7 +412,7 @@ vfs_s_new_super (struct vfs_class *me)
} }
static void static void
vfs_s_insert_super (struct vfs_class *me, vfs_s_super *super) vfs_s_insert_super (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
} }
static void static void
vfs_s_free_super (struct vfs_class *me, vfs_s_super *super) vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
{ {
if (super->root){ if (super->root){
vfs_s_free_inode (me, super->root); vfs_s_free_inode (me, super->root);
@ -532,7 +532,7 @@ vfs_s_get_path (struct vfs_class *me, const char *inname, struct vfs_s_super **a
} }
void void
vfs_s_invalidate (struct vfs_class *me, vfs_s_super *super) vfs_s_invalidate (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
} }
char * char *
vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino) vfs_s_fullpath (struct vfs_class *me, struct 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)
@ -559,7 +559,7 @@ vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino)
/* Support of archives */ /* Support of archives */
/* ------------------------ readdir & friends ----------------------------- */ /* ------------------------ readdir & friends ----------------------------- */
static vfs_s_inode * static struct vfs_s_inode *
vfs_s_inode_from_path (struct vfs_class *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;
@ -577,8 +577,8 @@ vfs_s_inode_from_path (struct vfs_class *me, char *name, int flags)
} }
struct dirhandle { struct dirhandle {
vfs_s_entry *cur; struct vfs_s_entry *cur;
vfs_s_inode *dir; struct vfs_s_inode *dir;
}; };
static void * static void *
@ -732,7 +732,7 @@ 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;
vfs_s_super *super; struct vfs_s_super *super;
char *q; char *q;
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
@ -743,8 +743,8 @@ vfs_s_open (struct vfs_class *me, char *file, int flags, int mode)
ERRNOR (EEXIST, NULL); ERRNOR (EEXIST, NULL);
if (!ino){ if (!ino){
char *dirname, *name, *save; char *dirname, *name, *save;
vfs_s_entry *ent; struct vfs_s_entry *ent;
vfs_s_inode *dir; struct vfs_s_inode *dir;
int tmp_handle; int tmp_handle;
/* If the filesystem is read-only, disable file creation */ /* If the filesystem is read-only, disable file creation */
@ -1021,7 +1021,7 @@ vfs_s_getlocalcopy (struct vfs_class *me, char *path)
static int static int
vfs_s_setctl (struct vfs_class *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); struct vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0);
if (!ino) if (!ino)
return 0; return 0;
switch (ctlop){ switch (ctlop){
@ -1049,7 +1049,7 @@ vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
static vfsid static vfsid
vfs_s_getid (struct vfs_class *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; struct vfs_s_super *archive;
struct vfs_class *v; struct vfs_class *v;
char *p; char *p;
vfsid id; vfsid id;
@ -1081,7 +1081,7 @@ vfs_s_nothingisopen (vfsid id)
static void static void
vfs_s_free (vfsid id) vfs_s_free (vfsid id)
{ {
vfs_s_free_super (((vfs_s_super *)id)->me, (vfs_s_super *)id); vfs_s_free_super (((struct vfs_s_super *)id)->me, (struct vfs_s_super *)id);
} }
void void

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 (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, struct 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)
@ -119,7 +119,7 @@ static int get_reply (struct vfs_class *me, int sock, char *string_buf, int stri
#define SUP super->u.fish #define SUP super->u.fish
static int static int
command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *f
} }
static void static void
free_archive (struct vfs_class *me, vfs_s_super *super) free_archive (struct vfs_class *me, struct 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:"???");
@ -167,7 +167,7 @@ free_archive (struct vfs_class *me, vfs_s_super *super)
} }
static void static void
pipeopen(vfs_s_super *super, char *path, char *argv[]) pipeopen(struct vfs_s_super *super, char *path, char *argv[])
{ {
int fileset1[2], fileset2[2]; int fileset1[2], fileset2[2];
int res; int res;
@ -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(struct vfs_class *me, vfs_s_super *super) static char *fish_getcwd(struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super) open_archive_int (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
} }
static int static int
open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op) open_archive (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, char *archive_name, char
} }
static int static int
archive_same(struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op, void *cookie) archive_same(struct vfs_class *me, struct 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(struct vfs_class *me, vfs_s_super *super, char *archive_name, char
} }
static int static int
dir_uptodate(struct vfs_class *me, vfs_s_inode *ino) dir_uptodate(struct vfs_class *me, struct vfs_s_inode *ino)
{ {
struct timeval tim; struct timeval tim;
@ -352,11 +352,11 @@ dir_uptodate(struct vfs_class *me, vfs_s_inode *ino)
} }
static int static int
dir_load(struct vfs_class *me, vfs_s_inode *dir, char *remote_path) dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
{ {
vfs_s_super *super = dir->super; struct vfs_s_super *super = dir->super;
char buffer[8192]; char buffer[8192];
vfs_s_entry *ent = NULL; struct vfs_s_entry *ent = NULL;
FILE *logfile; FILE *logfile;
char *quoted_path; char *quoted_path;
@ -475,9 +475,9 @@ error:
} }
static int static int
file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname) file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *localname)
{ {
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
int n, total; int n, total;
char buffer[8192]; char buffer[8192];
struct stat s; struct stat s;
@ -562,7 +562,7 @@ error_return:
return -1; return -1;
} }
static int linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset) static int linear_start(struct vfs_class *me, struct vfs_s_fh *fh, int offset)
{ {
char *name; char *name;
char *quoted_name; char *quoted_name;
@ -596,9 +596,9 @@ static int linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
} }
static void static void
linear_abort (struct vfs_class *me, vfs_s_fh *fh) linear_abort (struct vfs_class *me, struct vfs_s_fh *fh)
{ {
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
char buffer[8192]; char buffer[8192];
int n; int n;
@ -617,9 +617,9 @@ linear_abort (struct vfs_class *me, vfs_s_fh *fh)
} }
static int static int
linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len) linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len)
{ {
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
int n = 0; int n = 0;
len = MIN( fh->u.fish.total - fh->u.fish.got, len ); len = MIN( fh->u.fish.total - fh->u.fish.got, len );
disable_interrupt_key(); disable_interrupt_key();
@ -638,7 +638,7 @@ linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len)
} }
static void static void
linear_close (struct vfs_class *me, vfs_s_fh *fh) linear_close (struct vfs_class *me, struct 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(struct vfs_class *me, vfs_s_super *super, char *cmd, int flags) send_fish_command(struct vfs_class *me, struct vfs_s_super *super, char *cmd, int flags)
{ {
int r; int r;
@ -686,7 +686,7 @@ send_fish_command(struct vfs_class *me, vfs_s_super *super, char *cmd, int flags
#define PREFIX \ #define PREFIX \
char buf[BUF_LARGE]; \ char buf[BUF_LARGE]; \
char *rpath; \ char *rpath; \
vfs_s_super *super; \ struct vfs_s_super *super; \
if (!(rpath = vfs_s_get_path_mangle(me, path, &super, 0))) \ if (!(rpath = vfs_s_get_path_mangle(me, path, &super, 0))) \
return -1; \ return -1; \
rpath = name_quote (rpath, 0); rpath = name_quote (rpath, 0);
@ -712,7 +712,7 @@ 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; \
vfs_s_super *super1, *super2; \ struct vfs_s_super *super1, *super2; \
if (!(rpath1 = vfs_s_get_path_mangle(me, path1, &super1, 0))) \ if (!(rpath1 = vfs_s_get_path_mangle(me, path1, &super1, 0))) \
return -1; \ return -1; \
if (!(rpath2 = vfs_s_get_path_mangle(me, path2, &super2, 0))) \ if (!(rpath2 = vfs_s_get_path_mangle(me, path2, &super2, 0))) \
@ -813,7 +813,7 @@ static int fish_rmdir (struct vfs_class *me, char *path)
POSTFIX(OPT_FLUSH); POSTFIX(OPT_FLUSH);
} }
static int fish_fh_open (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode) static int fish_fh_open (struct vfs_class *me, struct 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 */

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 (struct vfs_class *me, vfs_s_super *super); static char *ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super);
static int ftpfs_chdir_internal (struct vfs_class *me, vfs_s_super *super, char *remote_path); static int ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *remote_path);
static int command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) static int command (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super); static int ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super);
static int login_server (struct vfs_class *me, vfs_s_super *super, const char *netrcpass); static int login_server (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, const char *remote_path) translate_path (struct vfs_class *me, struct 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);
@ -297,7 +297,7 @@ get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len)
} }
static int static int
reconnect (struct vfs_class *me, vfs_s_super *super) reconnect (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
} }
static int static int
command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *fmt, ...) command (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *f
} }
static void static void
free_archive (struct vfs_class *me, vfs_s_super *super) free_archive (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
#define TYPE_UNKNOWN -1 #define TYPE_UNKNOWN -1
static int static int
changetype (struct vfs_class *me, vfs_s_super *super, int binary) changetype (struct vfs_class *me, struct 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 (struct vfs_class *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 (struct vfs_class *me, vfs_s_super *super, const char *netrcpass) login_server (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super) ftpfs_open_socket (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super)
} }
static int static int
open_archive_int (struct vfs_class *me, vfs_s_super *super) open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
{ {
int retry_seconds, count_down; int retry_seconds, count_down;
@ -780,7 +780,7 @@ open_archive_int (struct vfs_class *me, vfs_s_super *super)
} }
static int static int
open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op) open_archive (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, char *archive_name, char
} }
static int static int
archive_same(struct vfs_class *me, vfs_s_super *super, char *archive_name, char *op, void *cookie) archive_same(struct vfs_class *me, struct 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(struct vfs_class *me, vfs_s_inode *ino) dir_uptodate(struct vfs_class *me, struct vfs_s_inode *ino)
{ {
struct timeval tim; struct timeval tim;
@ -847,7 +847,7 @@ dir_uptodate(struct vfs_class *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 (struct vfs_class *me, vfs_s_super *super) ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super)
{ {
char buf[BUF_8K], *bufp, *bufq; char buf[BUF_8K], *bufp, *bufq;
@ -887,7 +887,7 @@ ftpfs_get_current_directory (struct vfs_class *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 (struct vfs_class *me, vfs_s_super *super, int my_socket, struct sockaddr_in *sa) setup_passive (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, int my_socket, struct s
} }
static int static int
initconn (struct vfs_class *me, vfs_s_super *super) initconn (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_super *super, const char *cmd, open_data_connection (struct vfs_class *me, struct 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,9 +1015,9 @@ open_data_connection (struct vfs_class *me, vfs_s_super *super, const char *cmd,
#define ABORT_TIMEOUT 5 #define ABORT_TIMEOUT 5
static void static void
linear_abort (struct vfs_class *me, vfs_s_fh *fh) linear_abort (struct vfs_class *me, struct vfs_s_fh *fh)
{ {
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
static unsigned char const ipbuf[3] = { IAC, IP, IAC }; static unsigned char const ipbuf[3] = { IAC, IP, IAC };
fd_set mask; fd_set mask;
char buf[1024]; char buf[1024];
@ -1065,7 +1065,7 @@ linear_abort (struct vfs_class *me, vfs_s_fh *fh)
#if 0 #if 0
static void static void
resolve_symlink_without_ls_options(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink_without_ls_options(struct vfs_class *me, struct vfs_s_super *super, struct 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(struct vfs_class *me, vfs_s_super *super, vfs
} }
static void static void
resolve_symlink_with_ls_options(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink_with_ls_options(struct vfs_class *me, struct vfs_s_super *super, struct 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(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir) resolve_symlink(struct vfs_class *me, struct vfs_s_super *super, struct vfs_s_inode *dir)
{ {
print_vfs_message(_("Resolving symlink...")); print_vfs_message(_("Resolving symlink..."));
@ -1217,10 +1217,10 @@ resolve_symlink(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir)
#endif #endif
static int static int
dir_load (struct vfs_class *me, vfs_s_inode *dir, char *remote_path) dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
{ {
vfs_s_entry *ent; struct vfs_s_entry *ent;
vfs_s_super *super = dir->super; struct vfs_s_super *super = dir->super;
int sock, num_entries = 0; int sock, num_entries = 0;
#ifdef FIXME_LATER #ifdef FIXME_LATER
int has_symlinks = 0; int has_symlinks = 0;
@ -1279,7 +1279,7 @@ again:
* code below may jump directly into error handling code (without executing * code below may jump directly into error handling code (without executing
* remaining code). And C doesn't have try {...} finally {}; :-) * remaining code). And C doesn't have try {...} finally {}; :-)
*/ */
vfs_s_inode *parent = dir->ent->dir; struct vfs_s_inode *parent = dir->ent->dir;
if( parent==NULL ) if( parent==NULL )
parent = dir; parent = dir;
@ -1373,7 +1373,7 @@ fallback:
} }
static int static int
file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname) file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *localname)
{ {
int h, sock, n; int h, sock, n;
off_t total; off_t total;
@ -1384,7 +1384,7 @@ file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname)
#endif #endif
char buffer[8192]; char buffer[8192];
struct stat s; struct stat s;
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
h = open(localname, O_RDONLY); h = open(localname, O_RDONLY);
if (h == -1) if (h == -1)
@ -1451,7 +1451,7 @@ error_return:
} }
static int static int
linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset) linear_start(struct vfs_class *me, struct vfs_s_fh *fh, int offset)
{ {
char *name = vfs_s_fullpath (me, fh->ino); char *name = vfs_s_fullpath (me, fh->ino);
@ -1468,10 +1468,10 @@ linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
} }
static int static int
linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len) linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len)
{ {
int n; int n;
vfs_s_super *super = FH_SUPER; struct vfs_s_super *super = FH_SUPER;
while ((n = read (FH_SOCK, buf, len))<0) { while ((n = read (FH_SOCK, buf, len))<0) {
if ((errno == EINTR) && !got_interrupt()) if ((errno == EINTR) && !got_interrupt())
@ -1494,7 +1494,7 @@ linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len)
} }
static void static void
linear_close (struct vfs_class *me, vfs_s_fh *fh) linear_close (struct vfs_class *me, struct vfs_s_fh *fh)
{ {
if (FH_SOCK != -1) if (FH_SOCK != -1)
linear_abort(me, fh); linear_abort(me, fh);
@ -1527,7 +1527,7 @@ static int
send_ftp_command(struct vfs_class *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; struct vfs_s_super *super;
int r; int r;
int flush_directory_cache = (flags & OPT_FLUSH); int flush_directory_cache = (flags & OPT_FLUSH);
@ -1592,7 +1592,7 @@ static int ftpfs_unlink (struct vfs_class *me, char *path)
/* 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 (struct vfs_class *me, vfs_s_super *super, const char *path) is_same_dir (struct vfs_class *me, struct vfs_s_super *super, const char *path)
{ {
if (!SUP.cwdir) if (!SUP.cwdir)
return 0; return 0;
@ -1602,7 +1602,7 @@ is_same_dir (struct vfs_class *me, vfs_s_super *super, const char *path)
} }
static int static int
ftpfs_chdir_internal (struct vfs_class *me, vfs_s_super *super, char *remote_path) ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *remote_path)
{ {
int r; int r;
char *p; char *p;
@ -1640,7 +1640,7 @@ 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 (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode) static int ftpfs_fh_open (struct vfs_class *me, struct 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 (struct vfs_class *me, vfs_s_fh *fh, int flags, int mod
return 0; return 0;
} }
static int ftpfs_fh_close (struct vfs_class *me, vfs_s_fh *fh) static int ftpfs_fh_close (struct vfs_class *me, struct vfs_s_fh *fh)
{ {
if (fh->handle != -1 && !fh->ino->localname){ if (fh->handle != -1 && !fh->ino->localname){
close (fh->handle); close (fh->handle);

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 (struct vfs_class *me, vfs_s_super *archive) static void tar_free_archive (struct vfs_class *me, struct 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 (struct vfs_class *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 (struct vfs_class *me, char *name, vfs_s_super *archive) static int tar_open_archive (struct vfs_class *me, char *name, struct vfs_s_super *archive)
{ {
int result, type; int result, type;
mode_t mode; mode_t mode;
@ -124,7 +124,7 @@ static int tar_open_archive (struct vfs_class *me, char *name, vfs_s_super *arch
static union record rec_buf; static union record rec_buf;
static union record * static union record *
get_next_record (vfs_s_super *archive, int tard) get_next_record (struct vfs_s_super *archive, int tard)
{ {
int n; int n;
@ -135,7 +135,7 @@ get_next_record (vfs_s_super *archive, int tard)
return &rec_buf; return &rec_buf;
} }
static void skip_n_records (vfs_s_super *archive, int tard, int n) static void skip_n_records (struct vfs_s_super *archive, int tard, int n)
{ {
mc_lseek (tard, n * RECORDSIZE, SEEK_CUR); mc_lseek (tard, n * RECORDSIZE, SEEK_CUR);
current_tar_position += n * RECORDSIZE; current_tar_position += n * RECORDSIZE;
@ -198,7 +198,7 @@ typedef enum {
* *
*/ */
static ReadStatus static ReadStatus
read_header (struct vfs_class *me, vfs_s_super *archive, int tard) read_header (struct vfs_class *me, struct 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 (struct vfs_class *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 (struct vfs_class *me, vfs_s_super *archive, char *name, char *op) static int open_archive (struct vfs_class *me, struct 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;
@ -489,7 +489,7 @@ static int tar_ungetlocalcopy (struct vfs_class *me, char *path, char *local, in
ERRNOR (EROFS, -has_changed); ERRNOR (EROFS, -has_changed);
} }
static int tar_fh_open (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode) static int tar_fh_open (struct vfs_class *me, struct 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

@ -32,16 +32,16 @@
#define FL_FOLLOW 1 #define FL_FOLLOW 1
#define FL_DIR 4 #define FL_DIR 4
typedef struct vfs_s_entry { struct vfs_s_entry {
struct vfs_s_entry **prevp, *next; struct vfs_s_entry **prevp, *next;
struct vfs_s_inode *dir; /* Directory we are in - needed for invalidating directory when file in it changes */ struct vfs_s_inode *dir; /* Directory we are in - needed for invalidating directory when file in it changes */
char *name; /* Name of this entry */ char *name; /* Name of this entry */
struct vfs_s_inode *ino; /* ... and its inode */ struct vfs_s_inode *ino; /* ... and its inode */
/* int magic; */ /* int magic; */
#define ENTRY_MAGIC 0x014512563 #define ENTRY_MAGIC 0x014512563
} vfs_s_entry; };
typedef struct vfs_s_inode { struct vfs_s_inode {
struct vfs_s_entry *subdir; struct vfs_s_entry *subdir;
struct vfs_s_super *super; struct vfs_s_super *super;
struct stat st; /* Parameters of this inode */ struct stat st; /* Parameters of this inode */
@ -49,7 +49,7 @@ typedef struct vfs_s_inode {
char *localname; /* Filename of local file, if we have one */ char *localname; /* Filename of local file, if we have one */
int flags; int flags;
vfs_s_entry *ent; /* ftp needs this backpointer; don't use if you can avoid it */ struct vfs_s_entry *ent; /* ftp needs this backpointer; don't use if you can avoid it */
union { union {
struct { struct {
@ -68,12 +68,12 @@ typedef struct vfs_s_inode {
} u; } u;
/* int magic; */ /* int magic; */
#define INODE_MAGIC 0x93451656 #define INODE_MAGIC 0x93451656
} vfs_s_inode; };
typedef struct vfs_s_super { struct vfs_s_super {
struct vfs_s_super **prevp, *next; struct vfs_s_super **prevp, *next;
struct vfs_class *me; struct vfs_class *me;
vfs_s_inode *root; struct 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 */
int ino_usage; /* Usage count of this superblock */ int ino_usage; /* Usage count of this superblock */
@ -124,9 +124,9 @@ typedef struct vfs_s_super {
} u; } u;
/* int magic; */ /* int magic; */
#define SUPER_MAGIC 0x915ac312 #define SUPER_MAGIC 0x915ac312
} vfs_s_super; };
typedef struct vfs_s_fh { struct vfs_s_fh {
struct vfs_s_inode *ino; struct vfs_s_inode *ino;
long pos; /* This is for module's use */ long pos; /* This is for module's use */
int handle; /* This is for module's use, but if != -1, will be mc_close()d */ int handle; /* This is for module's use, but if != -1, will be mc_close()d */
@ -142,7 +142,7 @@ typedef struct vfs_s_fh {
} u; } u;
/* int magic; */ /* int magic; */
#define FH_MAGIC 0x91324682 #define FH_MAGIC 0x91324682
} vfs_s_fh; };
struct vfs_s_data { struct vfs_s_data {
struct vfs_s_super *supers; struct vfs_s_super *supers;
@ -150,60 +150,81 @@ struct vfs_s_data {
dev_t rdev; dev_t rdev;
FILE *logfile; FILE *logfile;
int (*init_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */ int (*init_inode) (struct vfs_class *me, struct vfs_s_inode *ino); /* optional */
void (*free_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */ void (*free_inode) (struct vfs_class *me, struct vfs_s_inode *ino); /* optional */
int (*init_entry) (struct vfs_class *me, vfs_s_entry *entry); /* optional */ int (*init_entry) (struct vfs_class *me, struct vfs_s_entry *entry); /* optional */
void *(*archive_check) (struct vfs_class *me, char *name, char *op); /* optional */ void *(*archive_check) (struct vfs_class *me, char *name, char *op); /* optional */
int (*archive_same) (struct vfs_class *me, vfs_s_super *psup, char *archive_name, char *op, void *cookie); int (*archive_same) (struct vfs_class *me, struct vfs_s_super *psup,
int (*open_archive) (struct vfs_class *me, vfs_s_super *psup, char *archive_name, char *op); char *archive_name, char *op, void *cookie);
void (*free_archive) (struct vfs_class *me, vfs_s_super *psup); int (*open_archive) (struct vfs_class *me, struct vfs_s_super *psup,
char *archive_name, char *op);
void (*free_archive) (struct vfs_class *me,
struct vfs_s_super *psup);
int (*fh_open) (struct vfs_class *me, vfs_s_fh *fh, int flags, int mode); int (*fh_open) (struct vfs_class *me, struct vfs_s_fh *fh, int flags,
int (*fh_close) (struct vfs_class *me, vfs_s_fh *fh); int mode);
int (*fh_close) (struct vfs_class *me, struct vfs_s_fh *fh);
vfs_s_entry* (*find_entry) (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags); struct vfs_s_entry *(*find_entry) (struct vfs_class *me,
int (*dir_load) (struct vfs_class *me, vfs_s_inode *ino, char *path); struct vfs_s_inode *root,
int (*dir_uptodate) (struct vfs_class *me, vfs_s_inode *ino); char *path, int follow, int flags);
int (*file_store) (struct vfs_class *me, vfs_s_fh *fh, char *path, char *localname); int (*dir_load) (struct vfs_class *me, struct vfs_s_inode *ino,
char *path);
int (*dir_uptodate) (struct vfs_class *me, struct vfs_s_inode *ino);
int (*file_store) (struct vfs_class *me, struct vfs_s_fh *fh,
char *path, char *localname);
int (*linear_start) (struct vfs_class *me, vfs_s_fh *fh, int from); int (*linear_start) (struct vfs_class *me, struct vfs_s_fh *fh,
int (*linear_read) (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len); int from);
void (*linear_close) (struct vfs_class *me, vfs_s_fh *fh); int (*linear_read) (struct vfs_class *me, struct vfs_s_fh *fh,
void *buf, int len);
void (*linear_close) (struct vfs_class *me, struct vfs_s_fh *fh);
}; };
/* entries and inodes */ /* entries and inodes */
vfs_s_inode *vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me,
struct vfs_s_super *super,
struct stat *initstat); struct stat *initstat);
vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode); struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name,
void vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent); struct vfs_s_inode *inode);
void vfs_s_insert_entry (struct vfs_class *me, vfs_s_inode *dir, void vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent);
vfs_s_entry *ent); void vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir,
struct vfs_s_entry *ent);
struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode); struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
void vfs_s_add_dots (struct vfs_class *me, vfs_s_inode *dir, void vfs_s_add_dots (struct vfs_class *me, struct vfs_s_inode *dir,
vfs_s_inode *parent); struct vfs_s_inode *parent);
vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, char *name, struct 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,
vfs_s_entry *vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path, mode_t mode);
struct vfs_s_entry *vfs_s_find_entry_tree (struct vfs_class *me,
struct vfs_s_inode *root,
char *path, int follow,
int flags);
struct vfs_s_entry *vfs_s_find_entry_linear (struct vfs_class *me,
struct vfs_s_inode *root,
char *path, int follow,
int flags);
struct vfs_s_inode *vfs_s_find_inode (struct vfs_class *me,
struct vfs_s_inode *root, char *path,
int follow, int flags); int follow, int flags);
vfs_s_entry *vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
int follow, int flags); struct vfs_s_entry *entry);
vfs_s_inode *vfs_s_find_inode (struct vfs_class *me, vfs_s_inode *root, char *path,
int follow, int flags);
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 (struct vfs_class *me, char *inname, vfs_s_super **archive, char *vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
int flags); struct vfs_s_super **archive, int flags);
void vfs_s_invalidate (struct vfs_class *me, vfs_s_super *super); void vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super);
char *vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino); char *vfs_s_fullpath (struct vfs_class *me, struct 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 (struct vfs_class *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,
int vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer, int size, int fd); char term);
int vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer,
int size, int fd);
/* misc */ /* misc */
int vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino); int vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino);