From c91e3d5edb8af5bafcc03332a360dcb087cba640 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 10 Sep 2018 12:35:17 +0300 Subject: [PATCH] Revert "VFS: make VFS-specific file handler class the derived one from vfs_file_handler_t." This reverts commit 2d58e4d624b0fbb8714a109da276b7d6f7380886. --- lib/vfs/direntry.c | 79 ++++++++++++----------------------- lib/vfs/xdirentry.h | 6 +-- src/vfs/cpio/cpio.c | 3 +- src/vfs/fish/fish.c | 38 +++++++++-------- src/vfs/ftpfs/ftpfs.c | 34 +++++++-------- src/vfs/sftpfs/file.c | 50 ++++++++++------------ src/vfs/sftpfs/internal.h | 2 - src/vfs/sftpfs/vfs_class.c | 1 + src/vfs/sftpfs/vfs_subclass.c | 1 - 9 files changed, 91 insertions(+), 123 deletions(-) diff --git a/lib/vfs/direntry.c b/lib/vfs/direntry.c index 607642e87..16ae482f4 100644 --- a/lib/vfs/direntry.c +++ b/lib/vfs/direntry.c @@ -363,30 +363,6 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super) g_free (super); } -/* --------------------------------------------------------------------------------------------- */ - -static vfs_file_handler_t * -vfs_s_new_fh (struct vfs_s_inode *ino, gboolean changed) -{ - vfs_file_handler_t *fh; - - fh = g_new0 (vfs_file_handler_t, 1); - vfs_s_init_fh (fh, ino, changed); - - return fh; -} - -/* --------------------------------------------------------------------------------------------- */ - -static void -vfs_s_free_fh (struct vfs_s_subclass *s, vfs_file_handler_t * fh) -{ - if (s->fh_free != NULL) - s->fh_free (fh); - - g_free (fh); -} - /* --------------------------------------------------------------------------------------------- */ /* Support of archives */ /* ------------------------ readdir & friends ----------------------------- */ @@ -687,8 +663,9 @@ vfs_s_close (void *fh) close (FH->handle); vfs_s_free_inode (me, FH->ino); - vfs_s_free_fh (MEDATA, fh); - + if (MEDATA->fh_free_data != NULL) + MEDATA->fh_free_data (fh); + g_free (fh); return res; } @@ -1251,17 +1228,6 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino) return g_strconcat (ino->ent->dir->ent->name, PATH_SEP_STR, ino->ent->name, (char *) NULL); } -/* --------------------------------------------------------------------------------------------- */ - -void -vfs_s_init_fh (vfs_file_handler_t * fh, struct vfs_s_inode *ino, gboolean changed) -{ - fh->ino = ino; - fh->handle = -1; - fh->changed = changed; - fh->linear = LS_NOT_LINEAR; -} - /* --------------------------------------------------------------------------------------------- */ /* --------------------------- stat and friends ---------------------------- */ @@ -1341,7 +1307,13 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode) return NULL; } - fh = s->fh_new != NULL ? s->fh_new (ino, was_changed) : vfs_s_new_fh (ino, was_changed); + fh = g_new (vfs_file_handler_t, 1); + fh->pos = 0; + fh->ino = ino; + fh->handle = -1; + fh->changed = was_changed; + fh->linear = LS_NOT_LINEAR; + fh->data = NULL; if (IS_LINEAR (flags)) { @@ -1355,7 +1327,9 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode) { if (s->fh_open != NULL && s->fh_open (path_element->class, fh, flags, mode) != 0) { - vfs_s_free_fh (s, fh); + if (s->fh_free_data != NULL) + s->fh_free_data (fh); + g_free (fh); return NULL; } } @@ -1365,7 +1339,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode) fh->handle = open (fh->ino->localname, NO_LINEAR (flags), mode); if (fh->handle == -1) { - vfs_s_free_fh (s, fh); + g_free (fh); path_element->class->verrno = errno; return NULL; } @@ -1414,13 +1388,17 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino) int handle; ssize_t n; off_t stat_size = ino->st.st_size; - vfs_file_handler_t *fh = NULL; + vfs_file_handler_t fh; vfs_path_t *tmp_vpath; - struct vfs_s_subclass *s = MEDATA; - if ((s->flags & VFS_S_USETMP) == 0) + if ((MEDATA->flags & VFS_S_USETMP) == 0) return (-1); + memset (&fh, 0, sizeof (fh)); + + fh.ino = ino; + fh.handle = -1; + handle = vfs_mkstemps (&tmp_vpath, me->name, ino->ent->name); ino->localname = g_strdup (vfs_path_as_str (tmp_vpath)); vfs_path_free (tmp_vpath); @@ -1430,16 +1408,14 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino) goto error_4; } - fh = s->fh_new != NULL ? s->fh_new (ino, FALSE) : vfs_s_new_fh (ino, FALSE); - - if (s->linear_start (me, fh, 0) == 0) + if (MEDATA->linear_start (me, &fh, 0) == 0) goto error_3; /* Clear the interrupt status */ tty_got_interrupt (); tty_enable_interrupt_key (); - while ((n = s->linear_read (me, fh, buffer, sizeof (buffer))) != 0) + while ((n = MEDATA->linear_read (me, &fh, buffer, sizeof (buffer))) != 0) { int t; @@ -1460,23 +1436,22 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino) goto error_1; } } - s->linear_close (me, fh); + MEDATA->linear_close (me, &fh); close (handle); tty_disable_interrupt_key (); - vfs_s_free_fh (s, fh); + g_free (fh.data); return 0; error_1: - s->linear_close (me, fh); + MEDATA->linear_close (me, &fh); error_3: tty_disable_interrupt_key (); close (handle); unlink (ino->localname); error_4: MC_PTR_FREE (ino->localname); - if (fh != NULL) - vfs_s_free_fh (s, fh); + g_free (fh.data); return (-1); } diff --git a/lib/vfs/xdirentry.h b/lib/vfs/xdirentry.h index b0cb7b0d4..65f1faa5d 100644 --- a/lib/vfs/xdirentry.h +++ b/lib/vfs/xdirentry.h @@ -111,6 +111,7 @@ typedef struct int handle; /* This is for module's use, but if != -1, will be mc_close()d */ gboolean changed; /* Did this file change? */ vfs_linear_state_t linear; /* Is that file open with O_LINEAR? */ + void *data; /* This is for filesystem-specific use */ } vfs_file_handler_t; /* @@ -141,10 +142,9 @@ struct vfs_s_subclass const vfs_path_t * vpath, const vfs_path_element_t * vpath_element); void (*free_archive) (struct vfs_class * me, struct vfs_s_super * psup); - vfs_file_handler_t *(*fh_new) (struct vfs_s_inode * ino, gboolean changed); int (*fh_open) (struct vfs_class * me, vfs_file_handler_t * fh, int flags, mode_t mode); int (*fh_close) (struct vfs_class * me, vfs_file_handler_t * fh); - void (*fh_free) (vfs_file_handler_t * fh); + void (*fh_free_data) (vfs_file_handler_t * fh); struct vfs_s_entry *(*find_entry) (struct vfs_class * me, struct vfs_s_inode * root, @@ -189,8 +189,6 @@ struct vfs_s_super *vfs_get_super_by_vpath (const vfs_path_t * vpath); 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); -void vfs_s_init_fh (vfs_file_handler_t * fh, struct vfs_s_inode *ino, gboolean changed); - /* 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); diff --git a/src/vfs/cpio/cpio.c b/src/vfs/cpio/cpio.c index 46f4bb32d..21fb5d1da 100644 --- a/src/vfs/cpio/cpio.c +++ b/src/vfs/cpio/cpio.c @@ -871,9 +871,10 @@ cpio_read (void *fh, char *buffer, size_t count) static int cpio_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t mode) { - (void) fh; (void) mode; + fh->data = NULL; + if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1); return 0; diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c index f075235f6..ae87c9110 100644 --- a/src/vfs/fish/fish.c +++ b/src/vfs/fish/fish.c @@ -118,7 +118,6 @@ int fish_directory_timeout = 900; #define FISH_HAVE_TAIL 64 #define SUP ((fish_super_data_t *) super) -#define FISH_FH ((fish_fh_data_t *) fh) /*** file scope type declarations ****************************************************************/ @@ -149,8 +148,6 @@ typedef struct typedef struct { - vfs_file_handler_t base; /* base class */ - off_t got; off_t total; gboolean append; @@ -960,7 +957,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) static int fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char *localname) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; struct vfs_s_super *super = FH_SUPER; int code; off_t total = 0; @@ -1069,11 +1066,16 @@ fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char static int fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish; struct vfs_s_super *super = FH_SUPER; char *name; char *quoted_name; + if (fh->data == NULL) + fh->data = g_new0 (fish_fh_data_t, 1); + + fish = (fish_fh_data_t *) fh->data; + name = vfs_s_fullpath (me, fh->ino); if (name == NULL) return 0; @@ -1114,7 +1116,7 @@ fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset) static void fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; struct vfs_s_super *super = FH_SUPER; char buffer[BUF_8K]; ssize_t n; @@ -1145,7 +1147,7 @@ fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh) static ssize_t fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size_t len) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; struct vfs_s_super *super = FH_SUPER; ssize_t n = 0; @@ -1173,7 +1175,7 @@ fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size static void fish_linear_close (struct vfs_class *me, vfs_file_handler_t * fh) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish = (fish_fh_data_t *) fh->data; if (fish->total != fish->got) fish_linear_abort (me, fh); @@ -1624,15 +1626,11 @@ fish_rmdir (const vfs_path_t * vpath) /* --------------------------------------------------------------------------------------------- */ -static vfs_file_handler_t * -fish_fh_new (struct vfs_s_inode *ino, gboolean changed) +static void +fish_fh_free_data (vfs_file_handler_t * fh) { - fish_fh_data_t *fh; - - fh = g_new0 (fish_fh_data_t, 1); - vfs_s_init_fh ((vfs_file_handler_t *) fh, ino, changed); - - return FH; + if (fh != NULL) + MC_PTR_FREE (fh->data); } /* --------------------------------------------------------------------------------------------- */ @@ -1640,10 +1638,13 @@ fish_fh_new (struct vfs_s_inode *ino, gboolean changed) static int fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t mode) { - fish_fh_data_t *fish = FISH_FH; + fish_fh_data_t *fish; (void) mode; + fh->data = g_new0 (fish_fh_data_t, 1); + fish = (fish_fh_data_t *) fh->data; + /* File will be written only, so no need to retrieve it */ if (((flags & O_WRONLY) == O_WRONLY) && ((flags & (O_RDONLY | O_RDWR)) == 0)) { @@ -1675,6 +1676,7 @@ fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m return 0; fail: + fish_fh_free_data (fh); return -1; } @@ -1746,8 +1748,8 @@ init_fish (void) fish_subclass.new_archive = fish_new_archive; fish_subclass.open_archive = fish_open_archive; fish_subclass.free_archive = fish_free_archive; - fish_subclass.fh_new = fish_fh_new; fish_subclass.fh_open = fish_fh_open; + fish_subclass.fh_free_data = fish_fh_free_data; fish_subclass.dir_load = fish_dir_load; fish_subclass.file_store = fish_file_store; fish_subclass.linear_start = fish_linear_start; diff --git a/src/vfs/ftpfs/ftpfs.c b/src/vfs/ftpfs/ftpfs.c index a135e14b5..a1cb20cee 100644 --- a/src/vfs/ftpfs/ftpfs.c +++ b/src/vfs/ftpfs/ftpfs.c @@ -154,8 +154,7 @@ gboolean ftpfs_ignore_chattr_errors = TRUE; #endif #define SUP ((ftp_super_data_t *) super) -#define FTP_FH ((ftp_fh_data_t *) fh) -#define FH_SOCK FTP_FH->sock +#define FH_SOCK ((ftp_fh_data_t *) fh)->sock #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff @@ -225,8 +224,6 @@ typedef struct typedef struct { - vfs_file_handler_t base; /* base class */ - int sock; int append; } ftp_fh_data_t; @@ -1853,7 +1850,7 @@ ftpfs_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, cha struct stat s; char *w_buf; struct vfs_s_super *super = FH_SUPER; - ftp_fh_data_t *ftp = FTP_FH; + ftp_fh_data_t *ftp = (ftp_fh_data_t *) fh->data; h = open (localname, O_RDONLY); if (h == -1) @@ -1937,6 +1934,9 @@ ftpfs_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset) { char *name; + if (fh->data == NULL) + fh->data = g_new0 (ftp_fh_data_t, 1); + name = vfs_s_fullpath (me, fh->ino); if (name == NULL) return 0; @@ -1945,7 +1945,7 @@ ftpfs_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset) if (FH_SOCK == -1) ERRNOR (EACCES, 0); fh->linear = LS_LINEAR_OPEN; - FTP_FH->append = 0; + ((ftp_fh_data_t *) fh->data)->append = 0; return 1; } @@ -2006,7 +2006,7 @@ ftpfs_ctl (void *fh, int ctlop, void *arg) if (FH->linear == LS_LINEAR_CLOSED || FH->linear == LS_LINEAR_PREOPEN) return 0; - v = vfs_s_select_on_two (FH_SOCK, 0); + v = vfs_s_select_on_two (((ftp_fh_data_t *) (FH->data))->sock, 0); return (((v < 0) && (errno == EINTR)) || v == 0) ? 1 : 0; } default: @@ -2197,16 +2197,11 @@ ftpfs_rmdir (const vfs_path_t * vpath) /* --------------------------------------------------------------------------------------------- */ -static vfs_file_handler_t * -ftpfs_fh_new (struct vfs_s_inode *ino, gboolean changed) +static void +ftpfs_fh_free_data (vfs_file_handler_t * fh) { - ftp_fh_data_t *fh; - - fh = g_new0 (ftp_fh_data_t, 1); - vfs_s_init_fh ((vfs_file_handler_t *) fh, ino, changed); - fh->sock = -1; - - return FH; + if (fh != NULL) + MC_PTR_FREE (fh->data); } /* --------------------------------------------------------------------------------------------- */ @@ -2214,10 +2209,12 @@ ftpfs_fh_new (struct vfs_s_inode *ino, gboolean changed) static int ftpfs_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t mode) { - ftp_fh_data_t *ftp = FTP_FH; + ftp_fh_data_t *ftp; (void) mode; + fh->data = g_new0 (ftp_fh_data_t, 1); + ftp = (ftp_fh_data_t *) fh->data; /* File will be written only, so no need to retrieve it from ftp server */ if (((flags & O_WRONLY) == O_WRONLY) && ((flags & (O_RDONLY | O_RDWR)) == 0)) { @@ -2283,6 +2280,7 @@ ftpfs_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t return 0; fail: + ftpfs_fh_free_data (fh); return -1; } @@ -2659,9 +2657,9 @@ init_ftpfs (void) ftpfs_subclass.new_archive = ftpfs_new_archive; ftpfs_subclass.open_archive = ftpfs_open_archive; ftpfs_subclass.free_archive = ftpfs_free_archive; - ftpfs_subclass.fh_new = ftpfs_fh_new; ftpfs_subclass.fh_open = ftpfs_fh_open; ftpfs_subclass.fh_close = ftpfs_fh_close; + ftpfs_subclass.fh_free_data = ftpfs_fh_free_data; ftpfs_subclass.dir_load = ftpfs_dir_load; ftpfs_subclass.file_store = ftpfs_file_store; ftpfs_subclass.linear_start = ftpfs_linear_start; diff --git a/src/vfs/sftpfs/file.c b/src/vfs/sftpfs/file.c index db200588e..6001f3b37 100644 --- a/src/vfs/sftpfs/file.c +++ b/src/vfs/sftpfs/file.c @@ -39,14 +39,10 @@ /*** file scope macro definitions ****************************************************************/ -#define SFTP_FH ((sftpfs_file_handler_data_t *) file_handler) - /*** file scope type declarations ****************************************************************/ typedef struct { - vfs_file_handler_t base; /* base class */ - LIBSSH2_SFTP_HANDLE *handle; int flags; mode_t mode; @@ -66,12 +62,13 @@ typedef struct static void sftpfs_reopen (vfs_file_handler_t * file_handler, GError ** mcerror) { - sftpfs_file_handler_data_t *file_handler_data = SFTP_FH; + sftpfs_file_handler_data_t *file_handler_data; int flags; mode_t mode; g_return_if_fail (mcerror == NULL || *mcerror == NULL); + file_handler_data = (sftpfs_file_handler_data_t *) file_handler->data; flags = file_handler_data->flags; mode = file_handler_data->mode; @@ -98,19 +95,6 @@ sftpfs_file__handle_error (sftpfs_super_data_t * super_data, int sftp_res, GErro /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ -/* --------------------------------------------------------------------------------------------- */ - -vfs_file_handler_t * -sftpfs_fh_new (struct vfs_s_inode * ino, gboolean changed) -{ - sftpfs_file_handler_data_t *fh; - - fh = g_new0 (sftpfs_file_handler_data_t, 1); - vfs_s_init_fh ((vfs_file_handler_t *) fh, ino, changed); - - return FH; -} - /* --------------------------------------------------------------------------------------------- */ /** * Open new SFTP file. @@ -128,7 +112,7 @@ sftpfs_open_file (vfs_file_handler_t * file_handler, int flags, mode_t mode, GEr unsigned long sftp_open_flags = 0; int sftp_open_mode = 0; gboolean do_append = FALSE; - sftpfs_file_handler_data_t *file_handler_data = SFTP_FH; + sftpfs_file_handler_data_t *file_handler_data; sftpfs_super_data_t *super_data; char *name; @@ -140,6 +124,7 @@ sftpfs_open_file (vfs_file_handler_t * file_handler, int flags, mode_t mode, GEr return FALSE; super_data = (sftpfs_super_data_t *) file_handler->ino->super; + file_handler_data = g_new0 (sftpfs_file_handler_data_t, 1); if ((flags & O_CREAT) != 0 || (flags & O_WRONLY) != 0) { @@ -186,6 +171,7 @@ sftpfs_open_file (vfs_file_handler_t * file_handler, int flags, mode_t mode, GEr file_handler_data->flags = flags; file_handler_data->mode = mode; + file_handler->data = file_handler_data; if (do_append) { @@ -226,7 +212,7 @@ sftpfs_fstat (void *data, struct stat *buf, GError ** mcerror) int res; LIBSSH2_SFTP_ATTRIBUTES attrs; vfs_file_handler_t *fh = (vfs_file_handler_t *) data; - sftpfs_file_handler_data_t *sftpfs_fh = (sftpfs_file_handler_data_t *) data; + sftpfs_file_handler_data_t *sftpfs_fh = fh->data; struct vfs_s_super *super = fh->ino->super; sftpfs_super_data_t *super_data = SUP; @@ -270,18 +256,19 @@ ssize_t sftpfs_read_file (vfs_file_handler_t * file_handler, char *buffer, size_t count, GError ** mcerror) { ssize_t rc; - sftpfs_file_handler_data_t *file_handler_data = SFTP_FH; + sftpfs_file_handler_data_t *file_handler_data; sftpfs_super_data_t *super_data; mc_return_val_if_error (mcerror, -1); - if (file_handler == NULL) + if (file_handler == NULL || file_handler->data == NULL) { mc_propagate_error (mcerror, 0, "%s", _("sftp: No file handler data present for reading file")); return -1; } + file_handler_data = file_handler->data; super_data = (sftpfs_super_data_t *) file_handler->ino->super; do @@ -321,11 +308,12 @@ sftpfs_write_file (vfs_file_handler_t * file_handler, const char *buffer, size_t GError ** mcerror) { ssize_t rc; - sftpfs_file_handler_data_t *file_handler_data = SFTP_FH; + sftpfs_file_handler_data_t *file_handler_data; sftpfs_super_data_t *super_data; mc_return_val_if_error (mcerror, -1); + file_handler_data = (sftpfs_file_handler_data_t *) file_handler->data; super_data = (sftpfs_super_data_t *) file_handler->ino->super; file_handler->pos = (off_t) libssh2_sftp_tell64 (file_handler_data->handle); @@ -361,13 +349,19 @@ sftpfs_write_file (vfs_file_handler_t * file_handler, const char *buffer, size_t int sftpfs_close_file (vfs_file_handler_t * file_handler, GError ** mcerror) { - int ret; + sftpfs_file_handler_data_t *file_handler_data; + int ret = -1; mc_return_val_if_error (mcerror, -1); - ret = libssh2_sftp_close (SFTP_FH->handle); + file_handler_data = (sftpfs_file_handler_data_t *) file_handler->data; + if (file_handler_data != NULL) + { + ret = libssh2_sftp_close (file_handler_data->handle); + g_free (file_handler_data); + } - return ret == 0 ? 0 : -1; + return ret; } /* --------------------------------------------------------------------------------------------- */ @@ -386,7 +380,7 @@ sftpfs_close_file (vfs_file_handler_t * file_handler, GError ** mcerror) off_t sftpfs_lseek (vfs_file_handler_t * file_handler, off_t offset, int whence, GError ** mcerror) { - sftpfs_file_handler_data_t *file_handler_data = SFTP_FH; + sftpfs_file_handler_data_t *file_handler_data; mc_return_val_if_error (mcerror, 0); @@ -419,6 +413,8 @@ sftpfs_lseek (vfs_file_handler_t * file_handler, off_t offset, int whence, GErro break; } + file_handler_data = (sftpfs_file_handler_data_t *) file_handler->data; + libssh2_sftp_seek64 (file_handler_data->handle, file_handler->pos); file_handler->pos = (off_t) libssh2_sftp_tell64 (file_handler_data->handle); diff --git a/src/vfs/sftpfs/internal.h b/src/vfs/sftpfs/internal.h index ae4386b9e..4846f5666 100644 --- a/src/vfs/sftpfs/internal.h +++ b/src/vfs/sftpfs/internal.h @@ -89,8 +89,6 @@ int sftpfs_open_connection (struct vfs_s_super *super, GError ** mcerror); void sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message, GError ** mcerror); -vfs_file_handler_t *sftpfs_fh_new (struct vfs_s_inode *ino, gboolean changed); - void *sftpfs_opendir (const vfs_path_t * vpath, GError ** mcerror); void *sftpfs_readdir (void *data, GError ** mcerror); int sftpfs_closedir (void *data, GError ** mcerror); diff --git a/src/vfs/sftpfs/vfs_class.c b/src/vfs/sftpfs/vfs_class.c index 59e85d037..6a1a56547 100644 --- a/src/vfs/sftpfs/vfs_class.c +++ b/src/vfs/sftpfs/vfs_class.c @@ -149,6 +149,7 @@ sftpfs_cb_open (const vfs_path_t * vpath, int flags, mode_t mode) file_handler->handle = -1; file_handler->changed = is_changed; file_handler->linear = LS_NOT_LINEAR; + file_handler->data = NULL; if (!sftpfs_open_file (file_handler, flags, mode, &mcerror)) { diff --git a/src/vfs/sftpfs/vfs_subclass.c b/src/vfs/sftpfs/vfs_subclass.c index b8116a9ef..3abddbcbe 100644 --- a/src/vfs/sftpfs/vfs_subclass.c +++ b/src/vfs/sftpfs/vfs_subclass.c @@ -197,7 +197,6 @@ sftpfs_init_subclass (void) sftpfs_subclass.new_archive = sftpfs_cb_init_connection; sftpfs_subclass.open_archive = sftpfs_cb_open_connection; sftpfs_subclass.free_archive = sftpfs_cb_close_connection; - sftpfs_subclass.fh_new = sftpfs_fh_new; sftpfs_subclass.dir_load = sftpfs_cb_dir_load; }