mirror of https://github.com/MidnightCommander/mc
* 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:
parent
ce356e2ce0
commit
6cf97f4069
|
@ -1,5 +1,8 @@
|
|||
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
|
||||
changes to use struct vfs_class instead.
|
||||
|
||||
|
|
42
vfs/cpio.c
42
vfs/cpio.c
|
@ -84,16 +84,16 @@ struct defer_inode {
|
|||
struct defer_inode *next;
|
||||
unsigned long inumber;
|
||||
unsigned short device;
|
||||
vfs_s_inode *inode;
|
||||
struct vfs_s_inode *inode;
|
||||
};
|
||||
|
||||
static int cpio_position;
|
||||
|
||||
static int cpio_find_head(struct vfs_class *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(struct vfs_class *me, vfs_s_super *super);
|
||||
static int cpio_read_crc_head(struct vfs_class *me, 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_find_head(struct vfs_class *me, struct 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, struct 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, struct vfs_s_super *super, struct stat *stat, char *name);
|
||||
static int cpio_read(void *fh, char *buffer, int count);
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
static int cpio_skip_padding(vfs_s_super *super)
|
||||
static int cpio_skip_padding(struct vfs_s_super *super)
|
||||
{
|
||||
switch(super->u.cpio.type) {
|
||||
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)
|
||||
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;
|
||||
mode_t mode;
|
||||
vfs_s_inode *root;
|
||||
struct vfs_s_inode *root;
|
||||
|
||||
if((fd = mc_open(name, O_RDONLY)) == -1) {
|
||||
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;
|
||||
}
|
||||
|
||||
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)) {
|
||||
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 RETURN(x) return(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];
|
||||
int ptr = 0;
|
||||
|
@ -246,7 +246,7 @@ static int cpio_find_head(struct vfs_class *me, vfs_s_super *super)
|
|||
#undef SEEKBACK
|
||||
|
||||
#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;
|
||||
int len;
|
||||
|
@ -291,7 +291,7 @@ static int cpio_read_bin_head(struct vfs_class *me, vfs_s_super *super)
|
|||
#undef HEAD_LENGTH
|
||||
|
||||
#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 stat stat;
|
||||
|
@ -340,7 +340,7 @@ static int cpio_read_oldc_head(struct vfs_class *me, vfs_s_super *super)
|
|||
#undef HEAD_LENGTH
|
||||
|
||||
#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 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);
|
||||
}
|
||||
|
||||
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;
|
||||
vfs_s_inode *root = super->root;
|
||||
vfs_s_entry *entry = NULL;
|
||||
struct vfs_s_inode *inode = NULL;
|
||||
struct vfs_s_inode *root = super->root;
|
||||
struct vfs_s_entry *entry = NULL;
|
||||
char *tn;
|
||||
|
||||
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!!!! */
|
||||
|
||||
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;
|
||||
|
||||
|
@ -588,7 +588,7 @@ static int cpio_ungetlocalcopy(struct vfs_class *me, char *path, char *local, in
|
|||
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);
|
||||
return 0;
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
|
||||
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);
|
||||
|
||||
vfs_s_inode *
|
||||
vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct stat *initstat)
|
||||
struct vfs_s_inode *
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
|
@ -61,10 +61,10 @@ vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super, struct stat *initstat
|
|||
return ino;
|
||||
}
|
||||
|
||||
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, struct vfs_s_inode *inode)
|
||||
{
|
||||
vfs_s_entry *entry;
|
||||
struct vfs_s_entry *entry;
|
||||
|
||||
entry = g_new0 (struct vfs_s_entry, 1);
|
||||
total_entries++;
|
||||
|
@ -80,7 +80,7 @@ vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode)
|
|||
}
|
||||
|
||||
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)
|
||||
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
|
||||
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;
|
||||
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
|
||||
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))
|
||||
;
|
||||
|
@ -167,7 +167,7 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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 */
|
||||
static vfs_s_entry *
|
||||
vfs_s_automake (struct vfs_class *me, vfs_s_inode *dir, char *path, int flags)
|
||||
static struct vfs_s_entry *
|
||||
vfs_s_automake (struct vfs_class *me, struct vfs_s_inode *dir, char *path, int flags)
|
||||
{
|
||||
struct vfs_s_entry *res;
|
||||
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,
|
||||
* == -1: do not follow links
|
||||
*/
|
||||
vfs_s_entry *
|
||||
vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path, int follow, int flags)
|
||||
struct vfs_s_entry *
|
||||
vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root, char *path, int follow, int flags)
|
||||
{
|
||||
unsigned int pseg;
|
||||
vfs_s_entry *ent = NULL;
|
||||
struct vfs_s_entry *ent = NULL;
|
||||
char p[MC_MAXPATHLEN] = "";
|
||||
|
||||
while (root){
|
||||
|
@ -275,10 +275,10 @@ split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char
|
|||
}
|
||||
}
|
||||
|
||||
vfs_s_entry *
|
||||
vfs_s_find_entry_linear (struct vfs_class *me, 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)
|
||||
{
|
||||
vfs_s_entry* ent = NULL;
|
||||
struct vfs_s_entry* ent = NULL;
|
||||
|
||||
if (root->super->root != root)
|
||||
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)){
|
||||
char *dirname, *name, *save;
|
||||
vfs_s_inode *ino;
|
||||
struct vfs_s_inode *ino;
|
||||
split_dir_name (me, path, &dirname, &name, &save);
|
||||
ino = vfs_s_find_inode (me, root, dirname, follow, flags | FL_DIR);
|
||||
if (save)
|
||||
|
@ -308,7 +308,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path, in
|
|||
}
|
||||
|
||||
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));
|
||||
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;
|
||||
}
|
||||
|
||||
vfs_s_inode *
|
||||
vfs_s_find_inode (struct vfs_class *me, 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)
|
||||
{
|
||||
vfs_s_entry *ent;
|
||||
struct vfs_s_entry *ent;
|
||||
if ((MEDATA->find_entry == vfs_s_find_entry_tree) && (!*path))
|
||||
return root;
|
||||
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;
|
||||
}
|
||||
|
||||
static vfs_s_entry *
|
||||
vfs_s_resolve_symlink (struct vfs_class *me, vfs_s_entry *entry, char *path, int follow)
|
||||
static struct vfs_s_entry *
|
||||
vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, char *path, int follow)
|
||||
{
|
||||
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 */
|
||||
/* -------------------------------- superblock games -------------------------- */
|
||||
|
||||
static vfs_s_super *
|
||||
static struct vfs_s_super *
|
||||
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->me = me;
|
||||
|
@ -412,7 +412,7 @@ vfs_s_new_super (struct vfs_class *me)
|
|||
}
|
||||
|
||||
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->prevp = &MEDATA->supers;
|
||||
|
@ -423,7 +423,7 @@ vfs_s_insert_super (struct vfs_class *me, vfs_s_super *super)
|
|||
}
|
||||
|
||||
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){
|
||||
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
|
||||
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){
|
||||
vfs_s_free_inode (me, super->root);
|
||||
|
@ -541,7 +541,7 @@ vfs_s_invalidate (struct vfs_class *me, vfs_s_super *super)
|
|||
}
|
||||
|
||||
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 */
|
||||
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 */
|
||||
/* ------------------------ readdir & friends ----------------------------- */
|
||||
|
||||
static vfs_s_inode *
|
||||
static struct vfs_s_inode *
|
||||
vfs_s_inode_from_path (struct vfs_class *me, char *name, int flags)
|
||||
{
|
||||
struct vfs_s_super *super;
|
||||
|
@ -577,8 +577,8 @@ vfs_s_inode_from_path (struct vfs_class *me, char *name, int flags)
|
|||
}
|
||||
|
||||
struct dirhandle {
|
||||
vfs_s_entry *cur;
|
||||
vfs_s_inode *dir;
|
||||
struct vfs_s_entry *cur;
|
||||
struct vfs_s_inode *dir;
|
||||
};
|
||||
|
||||
static void *
|
||||
|
@ -732,7 +732,7 @@ vfs_s_open (struct vfs_class *me, char *file, int flags, int mode)
|
|||
{
|
||||
int was_changed = 0;
|
||||
struct vfs_s_fh *fh;
|
||||
vfs_s_super *super;
|
||||
struct vfs_s_super *super;
|
||||
char *q;
|
||||
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);
|
||||
if (!ino){
|
||||
char *dirname, *name, *save;
|
||||
vfs_s_entry *ent;
|
||||
vfs_s_inode *dir;
|
||||
struct vfs_s_entry *ent;
|
||||
struct vfs_s_inode *dir;
|
||||
int tmp_handle;
|
||||
|
||||
/* If the filesystem is read-only, disable file creation */
|
||||
|
@ -1021,7 +1021,7 @@ vfs_s_getlocalcopy (struct vfs_class *me, char *path)
|
|||
static int
|
||||
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)
|
||||
return 0;
|
||||
switch (ctlop){
|
||||
|
@ -1049,7 +1049,7 @@ vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
|
|||
static vfsid
|
||||
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;
|
||||
char *p;
|
||||
vfsid id;
|
||||
|
@ -1081,7 +1081,7 @@ vfs_s_nothingisopen (vfsid id)
|
|||
static void
|
||||
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
|
||||
|
|
50
vfs/fish.c
50
vfs/fish.c
|
@ -80,7 +80,7 @@ static char reply_str [80];
|
|||
static struct vfs_class vfs_fish_ops;
|
||||
|
||||
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)));
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
char *str;
|
||||
|
@ -151,7 +151,7 @@ command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *f
|
|||
}
|
||||
|
||||
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)){
|
||||
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
|
||||
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 res;
|
||||
|
@ -197,14 +197,14 @@ pipeopen(vfs_s_super *super, char *path, char *argv[])
|
|||
}
|
||||
|
||||
/* 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)
|
||||
return g_strconcat (reply_str, "/", NULL);
|
||||
ERRNOR (EIO, NULL);
|
||||
}
|
||||
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 *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
|
||||
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;
|
||||
int flags;
|
||||
|
@ -317,7 +317,7 @@ open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char
|
|||
}
|
||||
|
||||
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;
|
||||
int flags;
|
||||
|
@ -337,7 +337,7 @@ archive_same(struct vfs_class *me, vfs_s_super *super, char *archive_name, char
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -352,11 +352,11 @@ dir_uptodate(struct vfs_class *me, vfs_s_inode *ino)
|
|||
}
|
||||
|
||||
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];
|
||||
vfs_s_entry *ent = NULL;
|
||||
struct vfs_s_entry *ent = NULL;
|
||||
FILE *logfile;
|
||||
char *quoted_path;
|
||||
|
||||
|
@ -475,9 +475,9 @@ error:
|
|||
}
|
||||
|
||||
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;
|
||||
char buffer[8192];
|
||||
struct stat s;
|
||||
|
@ -562,7 +562,7 @@ error_return:
|
|||
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 *quoted_name;
|
||||
|
@ -596,9 +596,9 @@ static int linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
|
|||
}
|
||||
|
||||
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];
|
||||
int n;
|
||||
|
||||
|
@ -617,9 +617,9 @@ linear_abort (struct vfs_class *me, vfs_s_fh *fh)
|
|||
}
|
||||
|
||||
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;
|
||||
len = MIN( fh->u.fish.total - fh->u.fish.got, len );
|
||||
disable_interrupt_key();
|
||||
|
@ -638,7 +638,7 @@ linear_read (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len)
|
|||
}
|
||||
|
||||
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)
|
||||
linear_abort(me, fh);
|
||||
|
@ -671,7 +671,7 @@ fish_ctl (void *fh, int ctlop, int arg)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -686,7 +686,7 @@ send_fish_command(struct vfs_class *me, vfs_s_super *super, char *cmd, int flags
|
|||
#define PREFIX \
|
||||
char buf[BUF_LARGE]; \
|
||||
char *rpath; \
|
||||
vfs_s_super *super; \
|
||||
struct vfs_s_super *super; \
|
||||
if (!(rpath = vfs_s_get_path_mangle(me, path, &super, 0))) \
|
||||
return -1; \
|
||||
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 *rpath1, *rpath2; \
|
||||
vfs_s_super *super1, *super2; \
|
||||
struct vfs_s_super *super1, *super2; \
|
||||
if (!(rpath1 = vfs_s_get_path_mangle(me, path1, &super1, 0))) \
|
||||
return -1; \
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
/* File will be written only, so no need to retrieve it */
|
||||
|
@ -866,7 +866,7 @@ static struct vfs_s_data fish_data = {
|
|||
static void
|
||||
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 *name;
|
||||
|
||||
|
|
80
vfs/ftpfs.c
80
vfs/ftpfs.c
|
@ -156,16 +156,16 @@ static struct vfs_class vfs_ftpfs_ops;
|
|||
c) strip trailing "/."
|
||||
*/
|
||||
|
||||
static char *ftpfs_get_current_directory (struct vfs_class *me, vfs_s_super *super);
|
||||
static int ftpfs_chdir_internal (struct vfs_class *me, 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 char *ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super);
|
||||
static int ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *remote_path);
|
||||
static int command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 4, 5)));
|
||||
static int ftpfs_open_socket (struct vfs_class *me, vfs_s_super *super);
|
||||
static int login_server (struct vfs_class *me, vfs_s_super *super, const char *netrcpass);
|
||||
static int ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super);
|
||||
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 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)
|
||||
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
|
||||
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);
|
||||
if (sock != -1){
|
||||
|
@ -318,7 +318,7 @@ reconnect (struct vfs_class *me, vfs_s_super *super)
|
|||
}
|
||||
|
||||
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;
|
||||
char *cmdstr;
|
||||
|
@ -378,7 +378,7 @@ command (struct vfs_class *me, vfs_s_super *super, int wait_reply, const char *f
|
|||
}
|
||||
|
||||
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){
|
||||
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
|
||||
|
||||
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 (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 */
|
||||
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 *op;
|
||||
|
@ -653,7 +653,7 @@ ftpfs_get_proxy_host_and_port (const char *proxy, char **host, int *port)
|
|||
}
|
||||
|
||||
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 hostent *hp;
|
||||
|
@ -730,7 +730,7 @@ ftpfs_open_socket (struct vfs_class *me, vfs_s_super *super)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -780,7 +780,7 @@ open_archive_int (struct vfs_class *me, vfs_s_super *super)
|
|||
}
|
||||
|
||||
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;
|
||||
int port;
|
||||
|
@ -807,7 +807,7 @@ open_archive (struct vfs_class *me, vfs_s_super *super, char *archive_name, char
|
|||
}
|
||||
|
||||
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;
|
||||
int port;
|
||||
|
@ -831,7 +831,7 @@ ftpfs_flushdir (void)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -847,7 +847,7 @@ dir_uptodate(struct vfs_class *me, vfs_s_inode *ino)
|
|||
|
||||
/* The returned directory should always contain a trailing slash */
|
||||
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;
|
||||
|
||||
|
@ -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 */
|
||||
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;
|
||||
char n [6];
|
||||
|
@ -921,7 +921,7 @@ setup_passive (struct vfs_class *me, vfs_s_super *super, int my_socket, struct s
|
|||
}
|
||||
|
||||
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;
|
||||
int data;
|
||||
|
@ -972,7 +972,7 @@ again:
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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
|
||||
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 };
|
||||
fd_set mask;
|
||||
char buf[1024];
|
||||
|
@ -1065,7 +1065,7 @@ linear_abort (struct vfs_class *me, vfs_s_fh *fh)
|
|||
|
||||
#if 0
|
||||
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 direntry *fe, *fel;
|
||||
|
@ -1126,7 +1126,7 @@ resolve_symlink_without_ls_options(struct vfs_class *me, vfs_s_super *super, vfs
|
|||
}
|
||||
|
||||
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;
|
||||
int sock;
|
||||
|
@ -1205,7 +1205,7 @@ done:
|
|||
}
|
||||
|
||||
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..."));
|
||||
|
||||
|
@ -1217,10 +1217,10 @@ resolve_symlink(struct vfs_class *me, vfs_s_super *super, vfs_s_inode *dir)
|
|||
#endif
|
||||
|
||||
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;
|
||||
vfs_s_super *super = dir->super;
|
||||
struct vfs_s_entry *ent;
|
||||
struct vfs_s_super *super = dir->super;
|
||||
int sock, num_entries = 0;
|
||||
#ifdef FIXME_LATER
|
||||
int has_symlinks = 0;
|
||||
|
@ -1279,7 +1279,7 @@ again:
|
|||
* code below may jump directly into error handling code (without executing
|
||||
* 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 )
|
||||
parent = dir;
|
||||
|
@ -1373,7 +1373,7 @@ fallback:
|
|||
}
|
||||
|
||||
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;
|
||||
off_t total;
|
||||
|
@ -1384,7 +1384,7 @@ file_store(struct vfs_class *me, vfs_s_fh *fh, char *name, char *localname)
|
|||
#endif
|
||||
char buffer[8192];
|
||||
struct stat s;
|
||||
vfs_s_super *super = FH_SUPER;
|
||||
struct vfs_s_super *super = FH_SUPER;
|
||||
|
||||
h = open(localname, O_RDONLY);
|
||||
if (h == -1)
|
||||
|
@ -1451,7 +1451,7 @@ error_return:
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -1468,10 +1468,10 @@ linear_start(struct vfs_class *me, vfs_s_fh *fh, int offset)
|
|||
}
|
||||
|
||||
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;
|
||||
vfs_s_super *super = FH_SUPER;
|
||||
struct vfs_s_super *super = FH_SUPER;
|
||||
|
||||
while ((n = read (FH_SOCK, buf, len))<0) {
|
||||
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
|
||||
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)
|
||||
linear_abort(me, fh);
|
||||
|
@ -1527,7 +1527,7 @@ static int
|
|||
send_ftp_command(struct vfs_class *me, char *filename, char *cmd, int flags)
|
||||
{
|
||||
char *rpath, *p;
|
||||
vfs_s_super *super;
|
||||
struct vfs_s_super *super;
|
||||
int r;
|
||||
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 */
|
||||
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)
|
||||
return 0;
|
||||
|
@ -1602,7 +1602,7 @@ is_same_dir (struct vfs_class *me, vfs_s_super *super, const char *path)
|
|||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
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){
|
||||
close (fh->handle);
|
||||
|
|
14
vfs/tar.c
14
vfs/tar.c
|
@ -61,7 +61,7 @@ static long from_oct (int digs, char *where)
|
|||
|
||||
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)
|
||||
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;
|
||||
|
||||
/* 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;
|
||||
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 *
|
||||
get_next_record (vfs_s_super *archive, int tard)
|
||||
get_next_record (struct vfs_s_super *archive, int tard)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
@ -135,7 +135,7 @@ get_next_record (vfs_s_super *archive, int tard)
|
|||
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);
|
||||
current_tar_position += n * RECORDSIZE;
|
||||
|
@ -198,7 +198,7 @@ typedef enum {
|
|||
*
|
||||
*/
|
||||
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 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.
|
||||
* 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 prev_status;
|
||||
|
@ -489,7 +489,7 @@ static int tar_ungetlocalcopy (struct vfs_class *me, char *path, char *local, in
|
|||
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);
|
||||
return 0;
|
||||
|
|
151
vfs/xdirentry.h
151
vfs/xdirentry.h
|
@ -32,16 +32,16 @@
|
|||
#define FL_FOLLOW 1
|
||||
#define FL_DIR 4
|
||||
|
||||
typedef struct vfs_s_entry {
|
||||
struct vfs_s_entry {
|
||||
struct vfs_s_entry **prevp, *next;
|
||||
struct vfs_s_inode *dir; /* Directory we are in - needed for invalidating directory when file in it changes */
|
||||
char *name; /* Name of this entry */
|
||||
struct vfs_s_inode *ino; /* ... and its inode */
|
||||
/* int magic; */
|
||||
#define ENTRY_MAGIC 0x014512563
|
||||
} vfs_s_entry;
|
||||
};
|
||||
|
||||
typedef struct vfs_s_inode {
|
||||
struct vfs_s_inode {
|
||||
struct vfs_s_entry *subdir;
|
||||
struct vfs_s_super *super;
|
||||
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 */
|
||||
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 {
|
||||
struct {
|
||||
|
@ -68,16 +68,16 @@ typedef struct vfs_s_inode {
|
|||
} u;
|
||||
/* int magic; */
|
||||
#define INODE_MAGIC 0x93451656
|
||||
} vfs_s_inode;
|
||||
};
|
||||
|
||||
typedef struct vfs_s_super {
|
||||
struct vfs_s_super {
|
||||
struct vfs_s_super **prevp, *next;
|
||||
struct vfs_class *me;
|
||||
vfs_s_inode *root;
|
||||
char *name; /* My name, whatever it means */
|
||||
int fd_usage; /* Number of open files */
|
||||
int ino_usage; /* Usage count of this superblock */
|
||||
int want_stale; /* If set, we do not flush cache properly */
|
||||
struct vfs_s_inode *root;
|
||||
char *name; /* My name, whatever it means */
|
||||
int fd_usage; /* Number of open files */
|
||||
int ino_usage; /* Usage count of this superblock */
|
||||
int want_stale; /* If set, we do not flush cache properly */
|
||||
|
||||
union {
|
||||
struct {
|
||||
|
@ -102,13 +102,13 @@ typedef struct vfs_s_super {
|
|||
int failed_on_login; /* used to pass the failure reason to upper levels */
|
||||
int use_source_route;
|
||||
int use_passive_connection;
|
||||
int remote_is_amiga; /* No leading slash allowed for AmiTCP (Amiga) */
|
||||
int remote_is_amiga; /* No leading slash allowed for AmiTCP (Amiga) */
|
||||
int isbinary;
|
||||
int cwd_defered; /* current_directory was changed but CWD command hasn't
|
||||
been sent yet */
|
||||
int strict; /* ftp server doesn't understand
|
||||
"LIST -la <path>"; use "CWD <path>"/
|
||||
"LIST" instead */
|
||||
int cwd_defered; /* current_directory was changed but CWD command hasn't
|
||||
been sent yet */
|
||||
int strict; /* ftp server doesn't understand
|
||||
"LIST -la <path>"; use "CWD <path>"/
|
||||
"LIST" instead */
|
||||
int control_connection_buzy;
|
||||
#define RFC_AUTODETECT 0
|
||||
#define RFC_DARING 1
|
||||
|
@ -117,21 +117,21 @@ typedef struct vfs_s_super {
|
|||
struct {
|
||||
int fd;
|
||||
struct stat stat;
|
||||
int type; /* Type of the archive */
|
||||
/*int pos; In case reentrancy will be needed */
|
||||
struct defer_inode *defered; /* List of inodes for which another entries may appear */
|
||||
int type; /* Type of the archive */
|
||||
/*int pos; In case reentrancy will be needed */
|
||||
struct defer_inode *defered; /* List of inodes for which another entries may appear */
|
||||
} cpio;
|
||||
} u;
|
||||
/* int magic; */
|
||||
#define SUPER_MAGIC 0x915ac312
|
||||
} vfs_s_super;
|
||||
};
|
||||
|
||||
typedef struct vfs_s_fh {
|
||||
struct vfs_s_fh {
|
||||
struct vfs_s_inode *ino;
|
||||
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 changed; /* Did this file change? */
|
||||
int linear; /* Is that file open with O_LINEAR? */
|
||||
int handle; /* This is for module's use, but if != -1, will be mc_close()d */
|
||||
int changed; /* Did this file change? */
|
||||
int linear; /* Is that file open with O_LINEAR? */
|
||||
union {
|
||||
struct {
|
||||
int got, total, append;
|
||||
|
@ -142,7 +142,7 @@ typedef struct vfs_s_fh {
|
|||
} u;
|
||||
/* int magic; */
|
||||
#define FH_MAGIC 0x91324682
|
||||
} vfs_s_fh;
|
||||
};
|
||||
|
||||
struct vfs_s_data {
|
||||
struct vfs_s_super *supers;
|
||||
|
@ -150,60 +150,81 @@ struct vfs_s_data {
|
|||
dev_t rdev;
|
||||
FILE *logfile;
|
||||
|
||||
int (*init_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */
|
||||
void (*free_inode) (struct vfs_class *me, vfs_s_inode *ino); /* optional */
|
||||
int (*init_entry) (struct vfs_class *me, vfs_s_entry *entry); /* optional */
|
||||
int (*init_inode) (struct vfs_class *me, struct 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, struct vfs_s_entry *entry); /* 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 (*open_archive) (struct vfs_class *me, vfs_s_super *psup, char *archive_name, char *op);
|
||||
void (*free_archive) (struct vfs_class *me, vfs_s_super *psup);
|
||||
void *(*archive_check) (struct vfs_class *me, char *name, char *op); /* optional */
|
||||
int (*archive_same) (struct vfs_class *me, struct vfs_s_super *psup,
|
||||
char *archive_name, char *op, void *cookie);
|
||||
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_close) (struct vfs_class *me, vfs_s_fh *fh);
|
||||
int (*fh_open) (struct vfs_class *me, struct vfs_s_fh *fh, int flags,
|
||||
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);
|
||||
int (*dir_load) (struct vfs_class *me, vfs_s_inode *ino, char *path);
|
||||
int (*dir_uptodate) (struct vfs_class *me, vfs_s_inode *ino);
|
||||
int (*file_store) (struct vfs_class *me, vfs_s_fh *fh, char *path, char *localname);
|
||||
struct vfs_s_entry *(*find_entry) (struct vfs_class *me,
|
||||
struct vfs_s_inode *root,
|
||||
char *path, int follow, int flags);
|
||||
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_read) (struct vfs_class *me, vfs_s_fh *fh, void *buf, int len);
|
||||
void (*linear_close) (struct vfs_class *me, vfs_s_fh *fh);
|
||||
int (*linear_start) (struct vfs_class *me, struct vfs_s_fh *fh,
|
||||
int from);
|
||||
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 */
|
||||
vfs_s_inode *vfs_s_new_inode (struct vfs_class *me, vfs_s_super *super,
|
||||
struct stat *initstat);
|
||||
vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name, vfs_s_inode *inode);
|
||||
void vfs_s_free_entry (struct vfs_class *me, vfs_s_entry *ent);
|
||||
void vfs_s_insert_entry (struct vfs_class *me, vfs_s_inode *dir,
|
||||
vfs_s_entry *ent);
|
||||
struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
|
||||
struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me,
|
||||
struct vfs_s_super *super,
|
||||
struct stat *initstat);
|
||||
struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name,
|
||||
struct vfs_s_inode *inode);
|
||||
void vfs_s_free_entry (struct vfs_class *me, struct 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);
|
||||
|
||||
void vfs_s_add_dots (struct vfs_class *me, vfs_s_inode *dir,
|
||||
vfs_s_inode *parent);
|
||||
vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, char *name,
|
||||
struct vfs_s_inode *parent, mode_t mode);
|
||||
vfs_s_entry *vfs_s_find_entry_tree (struct vfs_class *me, vfs_s_inode *root, char *path,
|
||||
void vfs_s_add_dots (struct vfs_class *me, struct vfs_s_inode *dir,
|
||||
struct vfs_s_inode *parent);
|
||||
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_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);
|
||||
vfs_s_entry *vfs_s_find_entry_linear (struct vfs_class *me, vfs_s_inode *root, char *path,
|
||||
int follow, int flags);
|
||||
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);
|
||||
struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
|
||||
struct vfs_s_entry *entry);
|
||||
|
||||
/* outside interface */
|
||||
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,
|
||||
int flags);
|
||||
void vfs_s_invalidate (struct vfs_class *me, vfs_s_super *super);
|
||||
char *vfs_s_fullpath (struct vfs_class *me, vfs_s_inode *ino);
|
||||
char *vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
struct vfs_s_super **archive, int flags);
|
||||
void vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super);
|
||||
char *vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino);
|
||||
|
||||
/* network filesystems support */
|
||||
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_interruptible (struct vfs_class *me, char *buffer, int size, int fd);
|
||||
int vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len,
|
||||
char term);
|
||||
int vfs_s_get_line_interruptible (struct vfs_class *me, char *buffer,
|
||||
int size, int fd);
|
||||
|
||||
/* misc */
|
||||
int vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino);
|
||||
|
|
Loading…
Reference in New Issue