mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Following prototypes of functions was changed in VFS-module API:
* getid * mkdir * rmdir * setctl Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
d67da5dfa8
commit
152124d9b7
@ -818,13 +818,17 @@ vfs_s_ungetlocalcopy (const vfs_path_t * vpath, const char *local, int has_chang
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||||
{
|
{
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
switch (ctlop)
|
switch (ctlop)
|
||||||
{
|
{
|
||||||
case VFS_SETCTL_STALE_DATA:
|
case VFS_SETCTL_STALE_DATA:
|
||||||
{
|
{
|
||||||
struct vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0);
|
struct vfs_s_inode *ino =
|
||||||
|
vfs_s_inode_from_path (path_element->class, vpath->unparsed, 0);
|
||||||
|
|
||||||
if (ino == NULL)
|
if (ino == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -833,15 +837,15 @@ vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ino->super->want_stale = 0;
|
ino->super->want_stale = 0;
|
||||||
vfs_s_invalidate (me, ino->super);
|
vfs_s_invalidate (path_element->class, ino->super);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case VFS_SETCTL_LOGFILE:
|
case VFS_SETCTL_LOGFILE:
|
||||||
MEDATA->logfile = fopen ((char *) arg, "w");
|
((struct vfs_s_subclass *) path_element->class->data)->logfile = fopen ((char *) arg, "w");
|
||||||
return 1;
|
return 1;
|
||||||
case VFS_SETCTL_FLUSH:
|
case VFS_SETCTL_FLUSH:
|
||||||
MEDATA->flush = 1;
|
((struct vfs_s_subclass *) path_element->class->data)->flush = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -851,12 +855,15 @@ vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
|||||||
/* ----------------------------- Stamping support -------------------------- */
|
/* ----------------------------- Stamping support -------------------------- */
|
||||||
|
|
||||||
static vfsid
|
static vfsid
|
||||||
vfs_s_getid (struct vfs_class *me, const char *path)
|
vfs_s_getid (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
struct vfs_s_super *archive = NULL;
|
struct vfs_s_super *archive = NULL;
|
||||||
char *p;
|
char *p;
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
p = vfs_s_get_path (me, path, &archive, FL_NO_OPEN);
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
|
p = vfs_s_get_path (path_element->class, vpath->unparsed, &archive, FL_NO_OPEN);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
g_free (p);
|
g_free (p);
|
||||||
@ -1380,18 +1387,15 @@ vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub)
|
|||||||
/** Find VFS id for given directory name */
|
/** Find VFS id for given directory name */
|
||||||
|
|
||||||
vfsid
|
vfsid
|
||||||
vfs_getid (struct vfs_class *vclass, const char *dir)
|
vfs_getid (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
char *dir1;
|
vfs_path_element_t *path_element;
|
||||||
vfsid id = NULL;
|
|
||||||
|
|
||||||
/* append slash if needed */
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
dir1 = concat_dir_and_file (dir, "");
|
if (path_element == NULL || path_element->class->getid == NULL)
|
||||||
if (vclass->getid)
|
return NULL;
|
||||||
id = (*vclass->getid) (vclass, dir1);
|
|
||||||
|
|
||||||
g_free (dir1);
|
return (*path_element->class->getid) (vpath);
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
49
lib/vfs/gc.c
49
lib/vfs/gc.c
@ -153,12 +153,16 @@ vfs_rmstamp (struct vfs_class *v, vfsid id)
|
|||||||
void
|
void
|
||||||
vfs_stamp_path (const char *path)
|
vfs_stamp_path (const char *path)
|
||||||
{
|
{
|
||||||
struct vfs_class *vfs;
|
|
||||||
vfsid id;
|
vfsid id;
|
||||||
|
vfs_path_t *vpath;
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
vfs = vfs_get_class (path);
|
vpath = vfs_path_from_str (path);
|
||||||
id = vfs_getid (vfs, path);
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
vfs_addstamp (vfs, id);
|
|
||||||
|
id = vfs_getid (vpath);
|
||||||
|
vfs_addstamp (path_element->class, id);
|
||||||
|
vfs_path_free (vpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -169,10 +173,11 @@ vfs_stamp_path (const char *path)
|
|||||||
void
|
void
|
||||||
vfs_stamp_create (struct vfs_class *vclass, vfsid id)
|
vfs_stamp_create (struct vfs_class *vclass, vfsid id)
|
||||||
{
|
{
|
||||||
struct vfs_class *nvfs;
|
|
||||||
vfsid nvfsid;
|
vfsid nvfsid;
|
||||||
|
|
||||||
ev_vfs_stamp_create_t event_data = { vclass, id, FALSE };
|
ev_vfs_stamp_create_t event_data = { vclass, id, FALSE };
|
||||||
|
vfs_path_t *vpath;
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
/* There are three directories we have to take care of: current_dir,
|
/* There are three directories we have to take care of: current_dir,
|
||||||
current_panel->cwd and other_panel->cwd. Athough most of the time either
|
current_panel->cwd and other_panel->cwd. Athough most of the time either
|
||||||
@ -182,20 +187,21 @@ vfs_stamp_create (struct vfs_class *vclass, vfsid id)
|
|||||||
if (!mc_event_present (MCEVENT_GROUP_CORE, "vfs_timestamp"))
|
if (!mc_event_present (MCEVENT_GROUP_CORE, "vfs_timestamp"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nvfs = vfs_get_class (vfs_get_current_dir ());
|
vpath = vfs_path_from_str (vfs_get_current_dir ());
|
||||||
nvfsid = vfs_getid (nvfs, vfs_get_current_dir ());
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
vfs_rmstamp (nvfs, nvfsid);
|
|
||||||
|
|
||||||
if (id == NULL || (nvfs == vclass && nvfsid == id))
|
nvfsid = vfs_getid (vpath);
|
||||||
return;
|
vfs_rmstamp (path_element->class, nvfsid);
|
||||||
|
|
||||||
mc_event_raise (MCEVENT_GROUP_CORE, "vfs_timestamp", (gpointer) &event_data);
|
if (!(id == NULL || (path_element->class == vclass && nvfsid == id)))
|
||||||
|
{
|
||||||
|
mc_event_raise (MCEVENT_GROUP_CORE, "vfs_timestamp", (gpointer) & event_data);
|
||||||
|
|
||||||
if (event_data.ret)
|
if (!event_data.ret && vclass != NULL && vclass->nothingisopen != NULL
|
||||||
return;
|
&& vclass->nothingisopen (id) != 0)
|
||||||
|
vfs_addstamp (vclass, id);
|
||||||
if (vclass != NULL && vclass->nothingisopen != NULL && vclass->nothingisopen (id) != 0)
|
}
|
||||||
vfs_addstamp (vclass, id);
|
vfs_path_free (vpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -260,12 +266,13 @@ vfs_timeout_handler (void)
|
|||||||
void
|
void
|
||||||
vfs_release_path (const char *dir)
|
vfs_release_path (const char *dir)
|
||||||
{
|
{
|
||||||
struct vfs_class *oldvfs;
|
vfs_path_t *vpath;
|
||||||
vfsid oldvfsid;
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
oldvfs = vfs_get_class (dir);
|
vpath = vfs_path_from_str (dir);
|
||||||
oldvfsid = vfs_getid (oldvfs, dir);
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
vfs_stamp_create (oldvfs, oldvfsid);
|
|
||||||
|
vfs_stamp_create (path_element->class, vfs_getid (vpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -29,7 +29,6 @@ struct vfs_stamping
|
|||||||
void vfs_stamp (struct vfs_class *vclass, vfsid id);
|
void vfs_stamp (struct vfs_class *vclass, vfsid id);
|
||||||
void vfs_rmstamp (struct vfs_class *vclass, vfsid id);
|
void vfs_rmstamp (struct vfs_class *vclass, vfsid id);
|
||||||
void vfs_stamp_create (struct vfs_class *vclass, vfsid id);
|
void vfs_stamp_create (struct vfs_class *vclass, vfsid id);
|
||||||
vfsid vfs_getid (struct vfs_class *vclass, const char *dir);
|
|
||||||
void vfs_gc_done (void);
|
void vfs_gc_done (void);
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
@ -260,8 +260,8 @@ MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vpath, owner, g
|
|||||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vpath, times))
|
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vpath, times))
|
||||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vpath, buf, bufsiz))
|
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vpath, buf, bufsiz))
|
||||||
MC_NAMEOP (unlink, (const char *path), (vpath))
|
MC_NAMEOP (unlink, (const char *path), (vpath))
|
||||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (path_element->class, vpath->unparsed, mode))
|
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vpath, mode))
|
||||||
MC_NAMEOP (rmdir, (const char *path), (path_element->class, vpath->unparsed))
|
MC_NAMEOP (rmdir, (const char *path), (vpath))
|
||||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vpath, mode, dev))
|
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vpath, mode, dev))
|
||||||
|
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
@ -399,8 +399,7 @@ mc_setctl (const char *path, int ctlop, void *arg)
|
|||||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
if (path_element != NULL && path_element->class != NULL)
|
if (path_element != NULL && path_element->class != NULL)
|
||||||
result =
|
result =
|
||||||
path_element->class->setctl != NULL ? path_element->class->setctl (path_element->class,
|
path_element->class->setctl != NULL ? path_element->class->setctl (vpath,
|
||||||
vpath->unparsed,
|
|
||||||
ctlop, arg) : 0;
|
ctlop, arg) : 0;
|
||||||
|
|
||||||
vfs_path_free (vpath);
|
vfs_path_free (vpath);
|
||||||
@ -729,8 +728,12 @@ mc_chdir (const char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
old_vfsid = vfs_getid (current_vfs, current_dir);
|
{
|
||||||
old_vfs = current_vfs;
|
vfs_path_t *current_vpath = vfs_path_from_str (current_dir);
|
||||||
|
old_vfsid = vfs_getid (current_vpath);
|
||||||
|
old_vfs = current_vfs;
|
||||||
|
vfs_path_free (current_vpath);
|
||||||
|
}
|
||||||
|
|
||||||
/* Actually change directory */
|
/* Actually change directory */
|
||||||
g_free (current_dir);
|
g_free (current_dir);
|
||||||
|
@ -178,7 +178,7 @@ typedef struct vfs_class
|
|||||||
off_t (*lseek) (void *vfs_info, off_t offset, int whence);
|
off_t (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||||
int (*mknod) (const vfs_path_t * vpath, mode_t mode, dev_t dev);
|
int (*mknod) (const vfs_path_t * vpath, mode_t mode, dev_t dev);
|
||||||
|
|
||||||
vfsid (*getid) (struct vfs_class * me, const char *path);
|
vfsid (*getid) (const vfs_path_t * vpath);
|
||||||
|
|
||||||
int (*nothingisopen) (vfsid id);
|
int (*nothingisopen) (vfsid id);
|
||||||
void (*free) (vfsid id);
|
void (*free) (vfsid id);
|
||||||
@ -186,11 +186,11 @@ typedef struct vfs_class
|
|||||||
char *(*getlocalcopy) (const vfs_path_t * vpath);
|
char *(*getlocalcopy) (const vfs_path_t * vpath);
|
||||||
int (*ungetlocalcopy) (const vfs_path_t * vpath, const char *local, int has_changed);
|
int (*ungetlocalcopy) (const vfs_path_t * vpath, const char *local, int has_changed);
|
||||||
|
|
||||||
int (*mkdir) (struct vfs_class * me, const char *path, mode_t mode);
|
int (*mkdir) (const vfs_path_t * vpath, mode_t mode);
|
||||||
int (*rmdir) (struct vfs_class * me, const char *path);
|
int (*rmdir) (const vfs_path_t * vpath);
|
||||||
|
|
||||||
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
||||||
int (*setctl) (struct vfs_class * me, const char *path, int ctlop, void *arg);
|
int (*setctl) (const vfs_path_t * vpath, int ctlop, void *arg);
|
||||||
} vfs_class;
|
} vfs_class;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -216,7 +216,7 @@ extern int use_netrc;
|
|||||||
/* lib/vfs/direntry.c: */
|
/* lib/vfs/direntry.c: */
|
||||||
void *vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode);
|
void *vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode);
|
||||||
|
|
||||||
vfsid vfs_getid (struct vfs_class *vclass, const char *dir);
|
vfsid vfs_getid (const vfs_path_t * vpath);
|
||||||
|
|
||||||
void vfs_init (void);
|
void vfs_init (void);
|
||||||
void vfs_shut (void);
|
void vfs_shut (void);
|
||||||
|
@ -491,14 +491,16 @@ check_panel_timestamp (const WPanel * panel, panel_view_mode_t mode, struct vfs_
|
|||||||
{
|
{
|
||||||
if (mode == view_listing)
|
if (mode == view_listing)
|
||||||
{
|
{
|
||||||
struct vfs_class *nvfs;
|
vfs_path_t *vpath;
|
||||||
vfsid nvfsid;
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
nvfs = vfs_get_class (panel->cwd);
|
vpath = vfs_path_from_str (panel->cwd);
|
||||||
if (nvfs != vclass)
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
|
if (path_element->class != vclass)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
nvfsid = vfs_getid (nvfs, panel->cwd);
|
|
||||||
if (nvfsid != id)
|
if (vfs_getid (vpath) != id)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1245,24 +1245,25 @@ extfs_unlink (const vfs_path_t * vpath)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
extfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
extfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||||
{
|
{
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
char *q, *mpath;
|
char *q, *mpath;
|
||||||
struct entry *entry;
|
struct entry *entry;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
(void) mode;
|
(void) mode;
|
||||||
|
|
||||||
mpath = g_strdup (path);
|
mpath = g_strdup (vpath->unparsed);
|
||||||
|
|
||||||
q = extfs_get_path_mangle (me, mpath, &archive, FALSE);
|
q = extfs_get_path_mangle (path_element->class, mpath, &archive, FALSE);
|
||||||
if (q == NULL)
|
if (q == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
||||||
if (entry != NULL)
|
if (entry != NULL)
|
||||||
{
|
{
|
||||||
me->verrno = EEXIST;
|
path_element->class->verrno = EEXIST;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
entry = extfs_find_entry (archive->root_entry, q, TRUE, FALSE);
|
entry = extfs_find_entry (archive->root_entry, q, TRUE, FALSE);
|
||||||
@ -1273,7 +1274,7 @@ extfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!S_ISDIR (entry->inode->mode))
|
if (!S_ISDIR (entry->inode->mode))
|
||||||
{
|
{
|
||||||
me->verrno = ENOTDIR;
|
path_element->class->verrno = ENOTDIR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,16 +1293,17 @@ extfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
extfs_rmdir (struct vfs_class *me, const char *path)
|
extfs_rmdir (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
char *q, *mpath;
|
char *q, *mpath;
|
||||||
struct entry *entry;
|
struct entry *entry;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
mpath = g_strdup (path);
|
mpath = g_strdup (vpath->unparsed);
|
||||||
|
|
||||||
q = extfs_get_path_mangle (me, mpath, &archive, FALSE);
|
q = extfs_get_path_mangle (path_element->class, mpath, &archive, FALSE);
|
||||||
if (q == NULL)
|
if (q == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
||||||
@ -1312,7 +1314,7 @@ extfs_rmdir (struct vfs_class *me, const char *path)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!S_ISDIR (entry->inode->mode))
|
if (!S_ISDIR (entry->inode->mode))
|
||||||
{
|
{
|
||||||
me->verrno = ENOTDIR;
|
path_element->class->verrno = ENOTDIR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1366,12 +1368,13 @@ extfs_lseek (void *data, off_t offset, int whence)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static vfsid
|
static vfsid
|
||||||
extfs_getid (struct vfs_class *me, const char *path)
|
extfs_getid (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
struct archive *archive = NULL;
|
struct archive *archive = NULL;
|
||||||
char *p;
|
char *p;
|
||||||
|
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
p = extfs_get_path (me, path, &archive, TRUE);
|
p = extfs_get_path (path_element->class, vpath->unparsed, &archive, TRUE);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
g_free (p);
|
g_free (p);
|
||||||
@ -1683,13 +1686,15 @@ extfs_done (struct vfs_class *me)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
extfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
extfs_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||||
{
|
{
|
||||||
|
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
(void) arg;
|
(void) arg;
|
||||||
|
|
||||||
if (ctlop == VFS_SETCTL_RUN)
|
if (ctlop == VFS_SETCTL_RUN)
|
||||||
{
|
{
|
||||||
extfs_run (me, path);
|
extfs_run (path_element->class, vpath->unparsed);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1403,46 +1403,79 @@ fish_exists (struct vfs_class *me, const char *path)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
fish_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||||
{
|
{
|
||||||
gchar *shell_commands = NULL;
|
gchar *shell_commands = NULL;
|
||||||
int ret_code;
|
int ret_code;
|
||||||
|
char buf[BUF_LARGE];
|
||||||
PREFIX;
|
const char *crpath;
|
||||||
|
char *rpath, *mpath;
|
||||||
|
struct vfs_s_super *super;
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
(void) mode;
|
(void) mode;
|
||||||
|
|
||||||
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
|
mpath = g_strdup (vpath->unparsed);
|
||||||
|
crpath = vfs_s_get_path_mangle (path_element->class, mpath, &super, 0);
|
||||||
|
if (crpath == NULL)
|
||||||
|
{
|
||||||
|
g_free (mpath);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
rpath = strutils_shell_escape (crpath);
|
||||||
|
g_free (mpath);
|
||||||
|
|
||||||
shell_commands =
|
shell_commands =
|
||||||
g_strconcat (SUP->scr_env, "FISH_FILENAME=%s;\n", SUP->scr_mkdir, (char *) NULL);
|
g_strconcat (SUP->scr_env, "FISH_FILENAME=%s;\n", SUP->scr_mkdir, (char *) NULL);
|
||||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||||
g_free (shell_commands);
|
g_free (shell_commands);
|
||||||
|
|
||||||
g_free (rpath);
|
g_free (rpath);
|
||||||
ret_code = fish_send_command (me, super, buf, OPT_FLUSH);
|
ret_code = fish_send_command (path_element->class, super, buf, OPT_FLUSH);
|
||||||
|
|
||||||
if (ret_code != 0)
|
if (ret_code != 0)
|
||||||
return ret_code;
|
return ret_code;
|
||||||
|
|
||||||
if (!fish_exists (me, path))
|
if (!fish_exists (path_element->class, vpath->unparsed))
|
||||||
ERRNOR (EACCES, -1);
|
{
|
||||||
|
path_element->class->verrno = EACCES;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fish_rmdir (struct vfs_class *me, const char *path)
|
fish_rmdir (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
gchar *shell_commands = NULL;
|
gchar *shell_commands = NULL;
|
||||||
|
char buf[BUF_LARGE];
|
||||||
|
const char *crpath;
|
||||||
|
char *rpath, *mpath;
|
||||||
|
struct vfs_s_super *super;
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
PREFIX;
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
|
||||||
|
mpath = g_strdup (vpath->unparsed);
|
||||||
|
crpath = vfs_s_get_path_mangle (path_element->class, mpath, &super, 0);
|
||||||
|
if (crpath == NULL)
|
||||||
|
{
|
||||||
|
g_free (mpath);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
rpath = strutils_shell_escape (crpath);
|
||||||
|
g_free (mpath);
|
||||||
|
|
||||||
shell_commands =
|
shell_commands =
|
||||||
g_strconcat (SUP->scr_env, "FISH_FILENAME=%s;\n", SUP->scr_rmdir, (char *) NULL);
|
g_strconcat (SUP->scr_env, "FISH_FILENAME=%s;\n", SUP->scr_rmdir, (char *) NULL);
|
||||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||||
g_free (shell_commands);
|
g_free (shell_commands);
|
||||||
g_free (rpath);
|
g_free (rpath);
|
||||||
return fish_send_command (me, super, buf, OPT_FLUSH);
|
return fish_send_command (path_element->class, super, buf, OPT_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -2076,19 +2076,24 @@ ftpfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ftpfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
ftpfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||||
{
|
{
|
||||||
|
vfs_path_element_t *path_element;
|
||||||
(void) mode; /* FIXME: should be used */
|
(void) mode; /* FIXME: should be used */
|
||||||
|
|
||||||
return ftpfs_send_command (me, path, "MKD /%s", OPT_FLUSH);
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
return ftpfs_send_command (path_element->class, vpath->unparsed, "MKD /%s", OPT_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ftpfs_rmdir (struct vfs_class *me, const char *path)
|
ftpfs_rmdir (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
return ftpfs_send_command (me, path, "RMD /%s", OPT_FLUSH);
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
|
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||||
|
return ftpfs_send_command (path_element->class, vpath->unparsed, "RMD /%s", OPT_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -242,21 +242,17 @@ local_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
local_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||||
{
|
{
|
||||||
(void) me;
|
return mkdir (vpath->unparsed, mode);
|
||||||
|
|
||||||
return mkdir (path, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
local_rmdir (struct vfs_class *me, const char *path)
|
local_rmdir (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
(void) me;
|
return rmdir (vpath->unparsed);
|
||||||
|
|
||||||
return rmdir (path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -355,13 +355,11 @@ sfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static vfsid
|
static vfsid
|
||||||
sfs_getid (struct vfs_class *me, const char *path)
|
sfs_getid (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
GSList *cur;
|
GSList *cur;
|
||||||
|
|
||||||
(void) me;
|
cur = g_slist_find_custom (head, vpath->unparsed, cachedfile_compare);
|
||||||
|
|
||||||
cur = g_slist_find_custom (head, path, cachedfile_compare);
|
|
||||||
|
|
||||||
return (vfsid) (cur != NULL ? cur->data : NULL);
|
return (vfsid) (cur != NULL ? cur->data : NULL);
|
||||||
}
|
}
|
||||||
|
@ -1842,19 +1842,17 @@ smbfs_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
smbfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||||
{
|
{
|
||||||
smbfs_connection *sc;
|
smbfs_connection *sc;
|
||||||
char *remote_file;
|
char *remote_file;
|
||||||
char *cpath;
|
char *cpath;
|
||||||
|
|
||||||
(void) me;
|
DEBUG (3, ("smbfs_mkdir(path:%s, mode:%d)\n", vpath->unparsed, (int) mode));
|
||||||
|
if ((remote_file = smbfs_get_path (&sc, vpath->unparsed)) == 0)
|
||||||
DEBUG (3, ("smbfs_mkdir(path:%s, mode:%d)\n", path, (int) mode));
|
|
||||||
if ((remote_file = smbfs_get_path (&sc, path)) == 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
g_free (remote_file);
|
g_free (remote_file);
|
||||||
cpath = smbfs_convert_path (path, FALSE);
|
cpath = smbfs_convert_path (vpath->unparsed, FALSE);
|
||||||
|
|
||||||
if (!cli_mkdir (sc->cli, cpath))
|
if (!cli_mkdir (sc->cli, cpath))
|
||||||
{
|
{
|
||||||
@ -1871,19 +1869,17 @@ smbfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_rmdir (struct vfs_class *me, const char *path)
|
smbfs_rmdir (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
smbfs_connection *sc;
|
smbfs_connection *sc;
|
||||||
char *remote_file;
|
char *remote_file;
|
||||||
char *cpath;
|
char *cpath;
|
||||||
|
|
||||||
(void) me;
|
DEBUG (3, ("smbfs_rmdir(path:%s)\n", vpath->unparsed));
|
||||||
|
if ((remote_file = smbfs_get_path (&sc, vpath->unparsed)) == 0)
|
||||||
DEBUG (3, ("smbfs_rmdir(path:%s)\n", path));
|
|
||||||
if ((remote_file = smbfs_get_path (&sc, path)) == 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
g_free (remote_file);
|
g_free (remote_file);
|
||||||
cpath = smbfs_convert_path (path, FALSE);
|
cpath = smbfs_convert_path (vpath->unparsed, FALSE);
|
||||||
|
|
||||||
if (!cli_rmdir (sc->cli, cpath))
|
if (!cli_rmdir (sc->cli, cpath))
|
||||||
{
|
{
|
||||||
@ -1964,16 +1960,15 @@ smbfs_forget (const char *path)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smbfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
smbfs_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||||
{
|
{
|
||||||
(void) me;
|
|
||||||
(void) arg;
|
(void) arg;
|
||||||
|
|
||||||
DEBUG (3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop));
|
DEBUG (3, ("smbfs_setctl(path:%s, ctlop:%d)\n", vpath->unparsed, ctlop));
|
||||||
switch (ctlop)
|
switch (ctlop)
|
||||||
{
|
{
|
||||||
case VFS_SETCTL_FORGET:
|
case VFS_SETCTL_FORGET:
|
||||||
smbfs_forget (path);
|
smbfs_forget (vpath->unparsed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -726,12 +726,11 @@ undelfs_lseek (void *vfs_info, off_t offset, int whence)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static vfsid
|
static vfsid
|
||||||
undelfs_getid (struct vfs_class *me, const char *path)
|
undelfs_getid (const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
char *fname, *fsname;
|
char *fname, *fsname;
|
||||||
(void) me;
|
|
||||||
|
|
||||||
undelfs_get_path (path, &fsname, &fname);
|
undelfs_get_path (vpath->unparsed, &fsname, &fname);
|
||||||
|
|
||||||
if (!fsname)
|
if (!fsname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user