mirror of https://github.com/MidnightCommander/mc
Use vfs_path_get_last_path_vfs() where it is resonable.
This commit is contained in:
parent
e20d9acecb
commit
978ce6d0dd
|
@ -396,22 +396,22 @@ vfs_s_inode_from_path (const vfs_path_t * vpath, int flags)
|
|||
struct vfs_s_super *super;
|
||||
struct vfs_s_inode *ino;
|
||||
const char *q;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
q = vfs_s_get_path (vpath, &super, 0);
|
||||
if (q == NULL)
|
||||
return NULL;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ino =
|
||||
vfs_s_find_inode (path_element->class, super, q,
|
||||
vfs_s_find_inode (me, super, q,
|
||||
(flags & FL_FOLLOW) != 0 ? LINK_FOLLOW : LINK_NO_FOLLOW,
|
||||
flags & ~FL_FOLLOW);
|
||||
if (ino == NULL && *q == '\0')
|
||||
/* We are asking about / directory of ftp server: assume it exists */
|
||||
ino =
|
||||
vfs_s_find_inode (path_element->class, super, q,
|
||||
vfs_s_find_inode (me, super, q,
|
||||
(flags & FL_FOLLOW) != 0 ? LINK_FOLLOW : LINK_NO_FOLLOW,
|
||||
FL_DIR | (flags & ~FL_FOLLOW));
|
||||
return ino;
|
||||
|
@ -424,17 +424,17 @@ vfs_s_opendir (const vfs_path_t * vpath)
|
|||
{
|
||||
struct vfs_s_inode *dir;
|
||||
struct dirhandle *info;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
dir = vfs_s_inode_from_path (vpath, FL_DIR | FL_FOLLOW);
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
if (!S_ISDIR (dir->st.st_mode))
|
||||
{
|
||||
path_element->class->verrno = ENOTDIR;
|
||||
me->verrno = ENOTDIR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ vfs_s_opendir (const vfs_path_t * vpath)
|
|||
#if 0
|
||||
if (dir->subdir == NULL) /* This can actually happen if we allow empty directories */
|
||||
{
|
||||
path_element->class->verrno = EAGAIN;
|
||||
me->verrno = EAGAIN;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -525,23 +525,23 @@ vfs_s_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
|||
{
|
||||
struct vfs_s_inode *ino;
|
||||
size_t len;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
ino = vfs_s_inode_from_path (vpath, 0);
|
||||
if (ino == NULL)
|
||||
return (-1);
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
if (!S_ISLNK (ino->st.st_mode))
|
||||
{
|
||||
path_element->class->verrno = EINVAL;
|
||||
me->verrno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (ino->linkname == NULL)
|
||||
{
|
||||
path_element->class->verrno = EFAULT;
|
||||
me->verrno = EFAULT;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ vfs_s_getlocalcopy (const vfs_path_t * vpath)
|
|||
{
|
||||
const struct vfs_class *me;
|
||||
|
||||
me = vfs_path_get_by_index (vpath, -1)->class;
|
||||
me = vfs_path_get_last_path_vfs (vpath);
|
||||
if ((me->flags & VFSF_USETMP) != 0 && fh->ino != NULL)
|
||||
local = vfs_path_from_str_flags (fh->ino->localname, VPF_NO_CANON);
|
||||
|
||||
|
@ -795,9 +795,9 @@ vfs_s_ungetlocalcopy (const vfs_path_t * vpath, const vfs_path_t * local, gboole
|
|||
static int
|
||||
vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
switch (ctlop)
|
||||
{
|
||||
|
@ -813,15 +813,15 @@ vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
|||
else
|
||||
{
|
||||
ino->super->want_stale = FALSE;
|
||||
vfs_s_invalidate (path_element->class, ino->super);
|
||||
vfs_s_invalidate (me, ino->super);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case VFS_SETCTL_LOGFILE:
|
||||
path_element->class->logfile = fopen ((char *) arg, "w");
|
||||
me->logfile = fopen ((char *) arg, "w");
|
||||
return 1;
|
||||
case VFS_SETCTL_FLUSH:
|
||||
path_element->class->flush = TRUE;
|
||||
me->flush = TRUE;
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -1300,23 +1300,23 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
struct vfs_s_super *super;
|
||||
const char *q;
|
||||
struct vfs_s_inode *ino;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
struct vfs_s_subclass *s;
|
||||
|
||||
q = vfs_s_get_path (vpath, &super, 0);
|
||||
if (q == NULL)
|
||||
return NULL;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ino = vfs_s_find_inode (path_element->class, super, q, LINK_FOLLOW, FL_NONE);
|
||||
ino = vfs_s_find_inode (me, super, q, LINK_FOLLOW, FL_NONE);
|
||||
if (ino != NULL && (flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
|
||||
{
|
||||
path_element->class->verrno = EEXIST;
|
||||
me->verrno = EEXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = VFS_SUBCLASS (path_element->class);
|
||||
s = VFS_SUBCLASS (me);
|
||||
|
||||
if (ino == NULL)
|
||||
{
|
||||
|
@ -1325,25 +1325,25 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
struct vfs_s_inode *dir;
|
||||
|
||||
/* If the filesystem is read-only, disable file creation */
|
||||
if ((flags & O_CREAT) == 0 || path_element->class->write == NULL)
|
||||
if ((flags & O_CREAT) == 0 || me->write == NULL)
|
||||
return NULL;
|
||||
|
||||
name = g_path_get_dirname (q);
|
||||
dir = vfs_s_find_inode (path_element->class, super, name, LINK_FOLLOW, FL_DIR);
|
||||
dir = vfs_s_find_inode (me, super, name, LINK_FOLLOW, FL_DIR);
|
||||
g_free (name);
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
|
||||
name = g_path_get_basename (q);
|
||||
ent = vfs_s_generate_entry (path_element->class, name, dir, 0755);
|
||||
ent = vfs_s_generate_entry (me, name, dir, 0755);
|
||||
ino = ent->ino;
|
||||
vfs_s_insert_entry (path_element->class, dir, ent);
|
||||
vfs_s_insert_entry (me, dir, ent);
|
||||
if ((VFS_CLASS (s)->flags & VFSF_USETMP) != 0)
|
||||
{
|
||||
int tmp_handle;
|
||||
vfs_path_t *tmp_vpath;
|
||||
|
||||
tmp_handle = vfs_mkstemps (&tmp_vpath, path_element->class->name, name);
|
||||
tmp_handle = vfs_mkstemps (&tmp_vpath, me->name, name);
|
||||
ino->localname = vfs_path_free (tmp_vpath, FALSE);
|
||||
if (tmp_handle == -1)
|
||||
{
|
||||
|
@ -1360,7 +1360,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
|
||||
if (S_ISDIR (ino->st.st_mode))
|
||||
{
|
||||
path_element->class->verrno = EISDIR;
|
||||
me->verrno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1376,7 +1376,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (s->fh_open != NULL && s->fh_open (path_element->class, fh, flags, mode) != 0)
|
||||
if (s->fh_open != NULL && s->fh_open (me, fh, flags, mode) != 0)
|
||||
{
|
||||
vfs_s_free_fh (s, fh);
|
||||
return NULL;
|
||||
|
@ -1389,13 +1389,13 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
if (fh->handle == -1)
|
||||
{
|
||||
vfs_s_free_fh (s, fh);
|
||||
path_element->class->verrno = errno;
|
||||
me->verrno = errno;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* i.e. we had no open files and now we have one */
|
||||
vfs_rmstamp (path_element->class, (vfsid) super);
|
||||
vfs_rmstamp (me, (vfsid) super);
|
||||
super->fd_usage++;
|
||||
fh->ino->st.st_nlink++;
|
||||
return fh;
|
||||
|
@ -1573,13 +1573,13 @@ vfs_init_subclass (struct vfs_s_subclass *sub, const char *name, vfs_flags_t fla
|
|||
vfsid
|
||||
vfs_getid (const vfs_path_t * vpath)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
const struct vfs_class *me;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
if (!vfs_path_element_valid (path_element) || path_element->class->getid == NULL)
|
||||
me = vfs_path_get_last_path_vfs (vpath);
|
||||
if (me == NULL || me->getid == NULL)
|
||||
return NULL;
|
||||
|
||||
return (*path_element->class->getid) (vpath);
|
||||
return me->getid (vpath);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
23
lib/vfs/gc.c
23
lib/vfs/gc.c
|
@ -186,12 +186,11 @@ void
|
|||
vfs_stamp_path (const vfs_path_t * vpath)
|
||||
{
|
||||
vfsid id;
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
struct vfs_class *me;
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
id = vfs_getid (vpath);
|
||||
vfs_addstamp (path_element->class, id);
|
||||
vfs_addstamp (me, id);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -206,7 +205,7 @@ vfs_stamp_create (struct vfs_class *vclass, vfsid id)
|
|||
|
||||
ev_vfs_stamp_create_t event_data = { vclass, id, FALSE };
|
||||
const vfs_path_t *vpath;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
/* There are three directories we have to take care of: current_dir,
|
||||
current_panel->cwd and other_panel->cwd. Although most of the time either
|
||||
|
@ -217,12 +216,12 @@ vfs_stamp_create (struct vfs_class *vclass, vfsid id)
|
|||
return;
|
||||
|
||||
vpath = vfs_get_raw_current_dir ();
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
nvfsid = vfs_getid (vpath);
|
||||
vfs_rmstamp (path_element->class, nvfsid);
|
||||
vfs_rmstamp (me, nvfsid);
|
||||
|
||||
if (!(id == NULL || (path_element->class == vclass && nvfsid == id)))
|
||||
if (!(id == NULL || (me == vclass && nvfsid == id)))
|
||||
{
|
||||
mc_event_raise (MCEVENT_GROUP_CORE, "vfs_timestamp", (gpointer) & event_data);
|
||||
|
||||
|
@ -316,10 +315,12 @@ vfs_timeout_handler (void)
|
|||
void
|
||||
vfs_release_path (const vfs_path_t * vpath)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
vfsid id;
|
||||
struct vfs_class *me;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
vfs_stamp_create (path_element->class, vfs_getid (vpath));
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
id = vfs_getid (vpath);
|
||||
vfs_stamp_create (me, id);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -192,7 +192,7 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
|
|||
{
|
||||
int result = -1;
|
||||
mode_t mode = 0;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
if (vpath == NULL)
|
||||
return (-1);
|
||||
|
@ -210,17 +210,17 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
|
|||
va_end (ap);
|
||||
}
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
if (vfs_path_element_valid (path_element) && path_element->class->open != NULL)
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
if (me != NULL && me->open != NULL)
|
||||
{
|
||||
void *info;
|
||||
|
||||
/* open must be supported */
|
||||
info = path_element->class->open (vpath, flags, mode);
|
||||
info = me->open (vpath, flags, mode);
|
||||
if (info == NULL)
|
||||
errno = vfs_ferrno (path_element->class);
|
||||
errno = vfs_ferrno (me);
|
||||
else
|
||||
result = vfs_new_handle (path_element->class, info);
|
||||
result = vfs_new_handle (me, info);
|
||||
}
|
||||
else
|
||||
errno = ENOTSUP;
|
||||
|
@ -236,18 +236,18 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
|
|||
int mc_##name inarg \
|
||||
{ \
|
||||
int result; \
|
||||
const vfs_path_element_t *path_element; \
|
||||
struct vfs_class *me; \
|
||||
\
|
||||
if (vpath == NULL) \
|
||||
return (-1); \
|
||||
\
|
||||
path_element = vfs_path_get_by_index (vpath, -1); \
|
||||
if (!vfs_path_element_valid (path_element)) \
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath)); \
|
||||
if (me == NULL) \
|
||||
return (-1); \
|
||||
\
|
||||
result = path_element->class->name != NULL ? path_element->class->name callarg : -1; \
|
||||
result = me->name != NULL ? me->name callarg : -1; \
|
||||
if (result == -1) \
|
||||
errno = path_element->class->name != NULL ? vfs_ferrno (path_element->class) : ENOTSUP; \
|
||||
errno = me->name != NULL ? vfs_ferrno (me) : ENOTSUP; \
|
||||
return result; \
|
||||
}
|
||||
|
||||
|
@ -273,19 +273,14 @@ mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
|
||||
if (vpath1 != NULL && vpath2 != NULL)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath2, -1);
|
||||
if (vfs_path_element_valid (path_element))
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath2));
|
||||
if (me != NULL)
|
||||
{
|
||||
result =
|
||||
path_element->class->symlink != NULL ?
|
||||
path_element->class->symlink (vpath1, vpath2) : -1;
|
||||
|
||||
result = me->symlink != NULL ? me->symlink (vpath1, vpath2) : -1;
|
||||
if (result == -1)
|
||||
errno =
|
||||
path_element->class->symlink != NULL ?
|
||||
vfs_ferrno (path_element->class) : ENOTSUP;
|
||||
errno = me->symlink != NULL ? vfs_ferrno (me) : ENOTSUP;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -325,26 +320,23 @@ MC_HANDLEOP (int, fstat, (int handle, struct stat *buf), (fsinfo, buf))
|
|||
int mc_##name (const vfs_path_t *vpath1, const vfs_path_t *vpath2) \
|
||||
{ \
|
||||
int result; \
|
||||
const vfs_path_element_t *path_element1; \
|
||||
const vfs_path_element_t *path_element2; \
|
||||
struct vfs_class *me1, *me2; \
|
||||
\
|
||||
if (vpath1 == NULL || vpath2 == NULL) \
|
||||
return (-1); \
|
||||
\
|
||||
path_element1 = vfs_path_get_by_index (vpath1, (-1)); \
|
||||
path_element2 = vfs_path_get_by_index (vpath2, (-1)); \
|
||||
me1 = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1)); \
|
||||
me2 = VFS_CLASS (vfs_path_get_last_path_vfs (vpath2)); \
|
||||
\
|
||||
if (!vfs_path_element_valid (path_element1) || !vfs_path_element_valid (path_element2) || \
|
||||
path_element1->class != path_element2->class) \
|
||||
if (me1 == NULL || me2 == NULL || me1 != me2) \
|
||||
{ \
|
||||
errno = EXDEV; \
|
||||
return (-1); \
|
||||
} \
|
||||
\
|
||||
result = path_element1->class->name != NULL \
|
||||
? path_element1->class->name (vpath1, vpath2) : -1; \
|
||||
result = me1->name != NULL ? me1->name (vpath1, vpath2) : -1; \
|
||||
if (result == -1) \
|
||||
errno = path_element1->class->name != NULL ? vfs_ferrno (path_element1->class) : ENOTSUP; \
|
||||
errno = me1->name != NULL ? vfs_ferrno (me1) : ENOTSUP; \
|
||||
return result; \
|
||||
}
|
||||
|
||||
|
@ -372,16 +364,14 @@ int
|
|||
mc_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||
{
|
||||
int result = -1;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
if (vpath == NULL)
|
||||
vfs_die ("You don't want to pass NULL to mc_setctl.");
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
if (vfs_path_element_valid (path_element))
|
||||
result =
|
||||
path_element->class->setctl != NULL ? path_element->class->setctl (vpath,
|
||||
ctlop, arg) : 0;
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
if (me != NULL)
|
||||
result = me->setctl != NULL ? me->setctl (vpath, ctlop, arg) : 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -545,17 +535,17 @@ mc_closedir (DIR * dirp)
|
|||
int mc_##name (const vfs_path_t *vpath, struct stat *buf) \
|
||||
{ \
|
||||
int result = -1; \
|
||||
const vfs_path_element_t *path_element; \
|
||||
struct vfs_class *me; \
|
||||
\
|
||||
if (vpath == NULL) \
|
||||
return (-1); \
|
||||
\
|
||||
path_element = vfs_path_get_by_index (vpath, -1); \
|
||||
if (vfs_path_element_valid (path_element)) \
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath)); \
|
||||
if (me != NULL) \
|
||||
{ \
|
||||
result = path_element->class->name ? path_element->class->name (vpath, buf) : -1; \
|
||||
result = me->name ? me->name (vpath, buf) : -1; \
|
||||
if (result == -1) \
|
||||
errno = path_element->class->name ? vfs_ferrno (path_element->class) : ENOTSUP; \
|
||||
errno = me->name ? vfs_ferrno (me) : ENOTSUP; \
|
||||
} \
|
||||
\
|
||||
return result; \
|
||||
|
@ -564,27 +554,24 @@ int mc_##name (const vfs_path_t *vpath, struct stat *buf) \
|
|||
MC_STATOP (stat)
|
||||
MC_STATOP (lstat)
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
vfs_path_t *
|
||||
mc_getlocalcopy (const vfs_path_t * pathname_vpath)
|
||||
{
|
||||
vfs_path_t *result = NULL;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
if (pathname_vpath == NULL)
|
||||
return NULL;
|
||||
|
||||
path_element = vfs_path_get_by_index (pathname_vpath, -1);
|
||||
if (vfs_path_element_valid (path_element))
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (pathname_vpath));
|
||||
if (me != NULL)
|
||||
{
|
||||
result = path_element->class->getlocalcopy != NULL ?
|
||||
path_element->class->getlocalcopy (pathname_vpath) :
|
||||
mc_def_getlocalcopy (pathname_vpath);
|
||||
result = me->getlocalcopy != NULL ?
|
||||
me->getlocalcopy (pathname_vpath) : mc_def_getlocalcopy (pathname_vpath);
|
||||
if (result == NULL)
|
||||
errno = vfs_ferrno (path_element->class);
|
||||
errno = vfs_ferrno (me);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -596,15 +583,15 @@ mc_ungetlocalcopy (const vfs_path_t * pathname_vpath, const vfs_path_t * local_v
|
|||
gboolean has_changed)
|
||||
{
|
||||
int result = -1;
|
||||
const vfs_path_element_t *path_element;
|
||||
const struct vfs_class *me;
|
||||
|
||||
if (pathname_vpath == NULL)
|
||||
return (-1);
|
||||
|
||||
path_element = vfs_path_get_by_index (pathname_vpath, -1);
|
||||
if (vfs_path_element_valid (path_element))
|
||||
result = path_element->class->ungetlocalcopy != NULL ?
|
||||
path_element->class->ungetlocalcopy (pathname_vpath, local_vpath, has_changed) :
|
||||
me = vfs_path_get_last_path_vfs (pathname_vpath);
|
||||
if (me != NULL)
|
||||
result = me->ungetlocalcopy != NULL ?
|
||||
me->ungetlocalcopy (pathname_vpath, local_vpath, has_changed) :
|
||||
mc_def_ungetlocalcopy (pathname_vpath, local_vpath, has_changed);
|
||||
|
||||
return result;
|
||||
|
@ -626,6 +613,7 @@ mc_chdir (const vfs_path_t * vpath)
|
|||
struct vfs_class *old_vfs;
|
||||
vfsid old_vfsid;
|
||||
int result;
|
||||
struct vfs_class *me;
|
||||
const vfs_path_element_t *path_element;
|
||||
vfs_path_t *cd_vpath;
|
||||
|
||||
|
@ -640,23 +628,23 @@ mc_chdir (const vfs_path_t * vpath)
|
|||
else
|
||||
cd_vpath = vfs_path_clone (vpath);
|
||||
|
||||
path_element = vfs_path_get_by_index (cd_vpath, -1);
|
||||
if (!vfs_path_element_valid (path_element))
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (cd_vpath));
|
||||
if (me == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
goto error_end;
|
||||
}
|
||||
|
||||
if (path_element->class->chdir == NULL)
|
||||
if (me->chdir == NULL)
|
||||
{
|
||||
errno = ENOTSUP;
|
||||
goto error_end;
|
||||
}
|
||||
|
||||
result = path_element->class->chdir (cd_vpath);
|
||||
result = me->chdir (cd_vpath);
|
||||
if (result == -1)
|
||||
{
|
||||
errno = vfs_ferrno (path_element->class);
|
||||
errno = vfs_ferrno (me);
|
||||
goto error_end;
|
||||
}
|
||||
|
||||
|
@ -665,8 +653,7 @@ mc_chdir (const vfs_path_t * vpath)
|
|||
|
||||
/* Actually change directory */
|
||||
vfs_set_raw_current_dir (cd_vpath);
|
||||
|
||||
current_vfs = path_element->class;
|
||||
current_vfs = me;
|
||||
|
||||
/* This function uses the new current_dir implicitly */
|
||||
vfs_stamp_create (old_vfs, old_vfsid);
|
||||
|
|
|
@ -481,8 +481,6 @@ vfs_init (void)
|
|||
void
|
||||
vfs_setup_work_dir (void)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
vfs_setup_cwd ();
|
||||
|
||||
/* FIXME: is we really need for this check? */
|
||||
|
@ -491,8 +489,7 @@ vfs_setup_work_dir (void)
|
|||
vfs_die ("Current dir too long.\n");
|
||||
*/
|
||||
|
||||
path_element = vfs_path_get_by_index (current_path, -1);
|
||||
current_vfs = path_element->class;
|
||||
current_vfs = VFS_CLASS (vfs_path_get_last_path_vfs (current_path));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -640,7 +637,7 @@ vfs_setup_cwd (void)
|
|||
{
|
||||
char *current_dir;
|
||||
vfs_path_t *tmp_vpath;
|
||||
const vfs_path_element_t *path_element;
|
||||
const struct vfs_class *me;
|
||||
|
||||
if (vfs_get_raw_current_dir () == NULL)
|
||||
{
|
||||
|
@ -660,9 +657,8 @@ vfs_setup_cwd (void)
|
|||
}
|
||||
}
|
||||
|
||||
path_element = vfs_path_get_by_index (vfs_get_raw_current_dir (), -1);
|
||||
|
||||
if ((path_element->class->flags & VFSF_LOCAL) != 0)
|
||||
me = vfs_path_get_last_path_vfs (vfs_get_raw_current_dir ());
|
||||
if ((me->flags & VFSF_LOCAL) != 0)
|
||||
{
|
||||
current_dir = g_get_current_dir ();
|
||||
tmp_vpath = vfs_path_from_str (current_dir);
|
||||
|
|
|
@ -2919,7 +2919,7 @@ copy_dir_dir (file_op_total_context_t * tctx, file_op_context_t * ctx, const cha
|
|||
}
|
||||
|
||||
lp = g_new0 (struct link, 1);
|
||||
lp->vfs = vfs_path_get_by_index (src_vpath, -1)->class;
|
||||
lp->vfs = vfs_path_get_last_path_vfs (src_vpath);
|
||||
lp->ino = src_stat.st_ino;
|
||||
lp->dev = src_stat.st_dev;
|
||||
parent_dirs = g_slist_prepend (parent_dirs, lp);
|
||||
|
@ -2995,7 +2995,7 @@ copy_dir_dir (file_op_total_context_t * tctx, file_op_context_t * ctx, const cha
|
|||
|
||||
lp = g_new0 (struct link, 1);
|
||||
mc_stat (dst_vpath, &dst_stat);
|
||||
lp->vfs = vfs_path_get_by_index (dst_vpath, -1)->class;
|
||||
lp->vfs = vfs_path_get_last_path_vfs (dst_vpath);
|
||||
lp->ino = dst_stat.st_ino;
|
||||
lp->dev = dst_stat.st_dev;
|
||||
dest_dirs = g_slist_prepend (dest_dirs, lp);
|
||||
|
|
|
@ -465,11 +465,10 @@ check_panel_timestamp (const WPanel * panel, panel_view_mode_t mode, struct vfs_
|
|||
{
|
||||
if (mode == view_listing)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
const struct vfs_class *me;
|
||||
|
||||
path_element = vfs_path_get_by_index (panel->cwd_vpath, -1);
|
||||
|
||||
if (path_element->class != vclass)
|
||||
me = vfs_path_get_last_path_vfs (panel->cwd_vpath);
|
||||
if (me != vclass)
|
||||
return FALSE;
|
||||
|
||||
if (vfs_getid (panel->cwd_vpath) != id)
|
||||
|
|
|
@ -1279,10 +1279,7 @@ extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
|||
goto cleanup;
|
||||
if (!S_ISLNK (entry->ino->st.st_mode))
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
path_element->class->verrno = EINVAL;
|
||||
VFS_CLASS (vfs_path_get_last_path_vfs (vpath))->verrno = EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
len = strlen (entry->ino->linkname);
|
||||
|
@ -1348,10 +1345,7 @@ extfs_unlink (const vfs_path_t * vpath)
|
|||
goto cleanup;
|
||||
if (S_ISDIR (entry->ino->st.st_mode))
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
path_element->class->verrno = EISDIR;
|
||||
VFS_CLASS (vfs_path_get_last_path_vfs (vpath))->verrno = EISDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
if (extfs_cmd (" rm ", archive, entry, ""))
|
||||
|
@ -1374,18 +1368,18 @@ extfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
|||
const char *q;
|
||||
struct vfs_s_entry *entry;
|
||||
int result = -1;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
|
||||
(void) mode;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
q = extfs_get_path (vpath, &archive, FL_NONE);
|
||||
if (q == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (VFS_SUPER (archive)->root, q, FL_NONE);
|
||||
if (entry != NULL)
|
||||
{
|
||||
path_element->class->verrno = EEXIST;
|
||||
me->verrno = EEXIST;
|
||||
goto cleanup;
|
||||
}
|
||||
entry = extfs_find_entry (VFS_SUPER (archive)->root, q, FL_MKDIR);
|
||||
|
@ -1396,7 +1390,7 @@ extfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
|||
goto cleanup;
|
||||
if (!S_ISDIR (entry->ino->st.st_mode))
|
||||
{
|
||||
path_element->class->verrno = ENOTDIR;
|
||||
me->verrno = ENOTDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1432,10 +1426,7 @@ extfs_rmdir (const vfs_path_t * vpath)
|
|||
goto cleanup;
|
||||
if (!S_ISDIR (entry->ino->st.st_mode))
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
path_element->class->verrno = ENOTDIR;
|
||||
VFS_CLASS (vfs_path_get_last_path_vfs (vpath))->verrno = ENOTDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -1255,11 +1255,9 @@ fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
const char *crpath1, *crpath2;
|
||||
char *rpath1, *rpath2;
|
||||
struct vfs_s_super *super, *super2;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath1, -1);
|
||||
|
||||
crpath1 = vfs_s_get_path (vpath1, &super, 0);
|
||||
if (crpath1 == NULL)
|
||||
return -1;
|
||||
|
@ -1271,8 +1269,10 @@ fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
rpath1 = strutils_shell_escape (crpath1);
|
||||
rpath2 = strutils_shell_escape (crpath2);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super2, OPT_FLUSH, FISH_SUPER (super)->scr_mv,
|
||||
fish_send_command (me, super2, OPT_FLUSH, FISH_SUPER (super)->scr_mv,
|
||||
"FISH_FILEFROM=%s FISH_FILETO=%s;\n", rpath1, rpath2);
|
||||
|
||||
g_free (rpath1);
|
||||
|
@ -1289,11 +1289,9 @@ fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
const char *crpath1, *crpath2;
|
||||
char *rpath1, *rpath2;
|
||||
struct vfs_s_super *super, *super2;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath1, -1);
|
||||
|
||||
crpath1 = vfs_s_get_path (vpath1, &super, 0);
|
||||
if (crpath1 == NULL)
|
||||
return -1;
|
||||
|
@ -1305,8 +1303,10 @@ fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
rpath1 = strutils_shell_escape (crpath1);
|
||||
rpath2 = strutils_shell_escape (crpath2);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super2, OPT_FLUSH, FISH_SUPER (super)->scr_hardlink,
|
||||
fish_send_command (me, super2, OPT_FLUSH, FISH_SUPER (super)->scr_hardlink,
|
||||
"FISH_FILEFROM=%s FISH_FILETO=%s;\n", rpath1, rpath2);
|
||||
|
||||
g_free (rpath1);
|
||||
|
@ -1324,11 +1324,9 @@ fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath2, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath2, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
@ -1336,8 +1334,10 @@ fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||
rpath = strutils_shell_escape (crpath);
|
||||
qsetto = strutils_shell_escape (vfs_path_get_last_path_str (vpath1));
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath2));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_ln,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_ln,
|
||||
"FISH_FILEFROM=%s FISH_FILETO=%s;\n", qsetto, rpath);
|
||||
|
||||
g_free (qsetto);
|
||||
|
@ -1390,19 +1390,19 @@ fish_chmod (const vfs_path_t * vpath, mode_t mode)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_chmod,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_chmod,
|
||||
"FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n", rpath,
|
||||
(unsigned int) (mode & 07777));
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
pw = getpwuid (owner);
|
||||
|
@ -1436,17 +1436,17 @@ fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
|||
sowner = pw->pw_name;
|
||||
sgroup = gr->gr_name;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
/* FIXME: what should we report if chgrp succeeds but chown fails? */
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_chown,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_chown,
|
||||
"FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n", rpath, sowner,
|
||||
sgroup);
|
||||
|
||||
|
@ -1496,11 +1496,9 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
@ -1525,7 +1523,9 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
|
|||
gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
|
||||
gmt->tm_hour, gmt->tm_min, gmt->tm_sec, mtime_nsec);
|
||||
|
||||
ret = fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_utime,
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret = fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_utime,
|
||||
"FISH_FILENAME=%s FISH_FILEATIME=%ld FISH_FILEMTIME=%ld "
|
||||
"FISH_TOUCHATIME=%s FISH_TOUCHMTIME=%s FISH_TOUCHATIME_W_NSEC=\"%s\" "
|
||||
"FISH_TOUCHMTIME_W_NSEC=\"%s\";\n", rpath, (long) atime, (long) mtime,
|
||||
|
@ -1544,19 +1544,19 @@ fish_unlink (const vfs_path_t * vpath)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_unlink,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_unlink,
|
||||
"FISH_FILENAME=%s;\n", rpath);
|
||||
|
||||
g_free (rpath);
|
||||
|
@ -1572,19 +1572,19 @@ fish_exists (const vfs_path_t * vpath)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_exists,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_exists,
|
||||
"FISH_FILENAME=%s;\n", rpath);
|
||||
|
||||
g_free (rpath);
|
||||
|
@ -1600,21 +1600,21 @@ fish_mkdir (const vfs_path_t * vpath, mode_t mode)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
(void) mode;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_mkdir,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_mkdir,
|
||||
"FISH_FILENAME=%s;\n", rpath);
|
||||
g_free (rpath);
|
||||
|
||||
|
@ -1623,7 +1623,7 @@ fish_mkdir (const vfs_path_t * vpath, mode_t mode)
|
|||
|
||||
if (fish_exists (vpath) == 0)
|
||||
{
|
||||
path_element->class->verrno = EACCES;
|
||||
me->verrno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1637,19 +1637,19 @@ fish_rmdir (const vfs_path_t * vpath)
|
|||
const char *crpath;
|
||||
char *rpath;
|
||||
struct vfs_s_super *super;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
int ret;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
crpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
ret =
|
||||
fish_send_command (path_element->class, super, OPT_FLUSH, FISH_SUPER (super)->scr_rmdir,
|
||||
fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_rmdir,
|
||||
"FISH_FILENAME=%s;\n", rpath);
|
||||
|
||||
g_free (rpath);
|
||||
|
|
|
@ -2121,28 +2121,28 @@ ftpfs_send_command (const vfs_path_t * vpath, const char *cmd, int flags)
|
|||
char *p;
|
||||
struct vfs_s_super *super;
|
||||
int r;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
gboolean flush_directory_cache = (flags & OPT_FLUSH) != 0;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
rpath = vfs_s_get_path (vpath, &super, 0);
|
||||
if (rpath == NULL)
|
||||
return (-1);
|
||||
|
||||
p = ftpfs_translate_path (path_element->class, super, rpath);
|
||||
r = ftpfs_command (path_element->class, super, WAIT_REPLY, cmd, p);
|
||||
p = ftpfs_translate_path (me, super, rpath);
|
||||
r = ftpfs_command (me, super, WAIT_REPLY, cmd, p);
|
||||
g_free (p);
|
||||
vfs_stamp_create (vfs_ftpfs_ops, super);
|
||||
if ((flags & OPT_IGNORE_ERROR) != 0)
|
||||
r = COMPLETE;
|
||||
if (r != COMPLETE)
|
||||
{
|
||||
path_element->class->verrno = EPERM;
|
||||
me->verrno = EPERM;
|
||||
return (-1);
|
||||
}
|
||||
if (flush_directory_cache)
|
||||
vfs_s_invalidate (path_element->class, super);
|
||||
vfs_s_invalidate (me, super);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -596,7 +596,6 @@ sftpfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError ** m
|
|||
tmp_path_len = ctmp_path->len;
|
||||
|
||||
path1 = vfs_path_get_last_path_str (vpath1);
|
||||
|
||||
fixfname = sftpfs_fix_filename (path1);
|
||||
|
||||
do
|
||||
|
|
|
@ -107,23 +107,23 @@ static void *
|
|||
sftpfs_cb_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
||||
{
|
||||
vfs_file_handler_t *fh;
|
||||
const vfs_path_element_t *path_element;
|
||||
struct vfs_class *me;
|
||||
struct vfs_s_super *super;
|
||||
const char *path_super;
|
||||
struct vfs_s_inode *path_inode;
|
||||
GError *mcerror = NULL;
|
||||
gboolean is_changed = FALSE;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
|
||||
path_super = vfs_s_get_path (vpath, &super, 0);
|
||||
if (path_super == NULL)
|
||||
return NULL;
|
||||
|
||||
path_inode = vfs_s_find_inode (path_element->class, super, path_super, LINK_FOLLOW, FL_NONE);
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
path_inode = vfs_s_find_inode (me, super, path_super, LINK_FOLLOW, FL_NONE);
|
||||
if (path_inode != NULL && ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)))
|
||||
{
|
||||
path_element->class->verrno = EEXIST;
|
||||
me->verrno = EEXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -134,22 +134,22 @@ sftpfs_cb_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
struct vfs_s_inode *dir;
|
||||
|
||||
name = g_path_get_dirname (path_super);
|
||||
dir = vfs_s_find_inode (path_element->class, super, name, LINK_FOLLOW, FL_DIR);
|
||||
dir = vfs_s_find_inode (me, super, name, LINK_FOLLOW, FL_DIR);
|
||||
g_free (name);
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
|
||||
name = g_path_get_basename (path_super);
|
||||
ent = vfs_s_generate_entry (path_element->class, name, dir, 0755);
|
||||
ent = vfs_s_generate_entry (me, name, dir, 0755);
|
||||
g_free (name);
|
||||
path_inode = ent->ino;
|
||||
vfs_s_insert_entry (path_element->class, dir, ent);
|
||||
vfs_s_insert_entry (me, dir, ent);
|
||||
is_changed = TRUE;
|
||||
}
|
||||
|
||||
if (S_ISDIR (path_inode->st.st_mode))
|
||||
{
|
||||
path_element->class->verrno = EISDIR;
|
||||
me->verrno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ sftpfs_cb_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
vfs_rmstamp (path_element->class, (vfsid) super);
|
||||
vfs_rmstamp (me, (vfsid) super);
|
||||
super->fd_usage++;
|
||||
fh->ino->st.st_nlink++;
|
||||
return fh;
|
||||
|
|
|
@ -333,9 +333,9 @@ static void *
|
|||
undelfs_opendir (const vfs_path_t * vpath)
|
||||
{
|
||||
char *file, *f = NULL;
|
||||
const vfs_path_element_t *path_element;
|
||||
const char *class_name;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
class_name = vfs_path_get_last_path_vfs (vpath)->name;
|
||||
undelfs_get_path (vpath, &file, &f);
|
||||
if (file == NULL)
|
||||
{
|
||||
|
@ -379,10 +379,10 @@ undelfs_opendir (const vfs_path_t * vpath)
|
|||
/* Now load the deleted information */
|
||||
if (!undelfs_loaddel ())
|
||||
goto quit_opendir;
|
||||
vfs_print_message (_("%s: done."), path_element->class->name);
|
||||
vfs_print_message (_("%s: done."), class_name);
|
||||
return fs;
|
||||
quit_opendir:
|
||||
vfs_print_message (_("%s: failure"), path_element->class->name);
|
||||
vfs_print_message (_("%s: failure"), class_name);
|
||||
ext2fs_close (fs);
|
||||
fs = NULL;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue