* gc.c: Eliminate all code for timestamping parent filesystems.
It's broken and undocumented. Adjust all dependencies.
Этот коммит содержится в:
родитель
645eeb8118
Коммит
6ffd35bf07
@ -1,3 +1,8 @@
|
||||
2003-11-26 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* gc.c: Eliminate all code for timestamping parent filesystems.
|
||||
It's broken and undocumented. Adjust all dependencies.
|
||||
|
||||
2003-11-24 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* direntry.c (vfs_s_resolve_symlink): Eliminate
|
||||
|
@ -559,7 +559,7 @@ cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
if (parc->u.arch.st.st_mtime < archive_stat->st_mtime) {
|
||||
/* Yes, reload! */
|
||||
(*vfs_cpiofs_ops.free) ((vfsid) parc);
|
||||
vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc, 0);
|
||||
vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc);
|
||||
return 2;
|
||||
}
|
||||
/* Hasn't been modified, give it a new timeout */
|
||||
|
@ -475,7 +475,7 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
vfs_die ("You have to fill root inode\n");
|
||||
|
||||
vfs_s_insert_super (me, super);
|
||||
vfs_stamp_create (me, super, archive_name);
|
||||
vfs_stamp_create (me, super);
|
||||
|
||||
return_success:
|
||||
*archive = super;
|
||||
@ -767,7 +767,7 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
}
|
||||
|
||||
/* i.e. we had no open files and now we have one */
|
||||
vfs_rmstamp (me, (vfsid) super, 1);
|
||||
vfs_rmstamp (me, (vfsid) super);
|
||||
super->fd_usage++;
|
||||
fh->ino->st.st_nlink++;
|
||||
return fh;
|
||||
@ -850,7 +850,7 @@ vfs_s_close (void *fh)
|
||||
|
||||
FH_SUPER->fd_usage--;
|
||||
if (!FH_SUPER->fd_usage)
|
||||
vfs_stamp_create (me, FH_SUPER, FH_SUPER->name);
|
||||
vfs_stamp_create (me, FH_SUPER);
|
||||
|
||||
if (FH->linear == LS_LINEAR_OPEN)
|
||||
MEDATA->linear_close (me, fh);
|
||||
@ -1043,27 +1043,14 @@ vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
/* ----------------------------- Stamping support -------------------------- */
|
||||
|
||||
static vfsid
|
||||
vfs_s_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
|
||||
vfs_s_getid (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct vfs_s_super *archive;
|
||||
struct vfs_class *v;
|
||||
char *p;
|
||||
vfsid id;
|
||||
struct vfs_stamping *par;
|
||||
|
||||
*parent = NULL;
|
||||
if (!(p = vfs_s_get_path (me, path, &archive, FL_NO_OPEN)))
|
||||
return NULL;
|
||||
g_free(p);
|
||||
v = vfs_get_class (archive->name);
|
||||
id = vfs_getid (v, archive->name, &par);
|
||||
if (id) {
|
||||
*parent = g_new (struct vfs_stamping, 1);
|
||||
(*parent)->v = v;
|
||||
(*parent)->id = id;
|
||||
(*parent)->parent = par;
|
||||
(*parent)->next = NULL;
|
||||
}
|
||||
return (vfsid) archive;
|
||||
}
|
||||
|
||||
|
33
vfs/extfs.c
33
vfs/extfs.c
@ -468,9 +468,6 @@ extfs_get_path_mangle (char *inname, struct archive **archive, int is_dir,
|
||||
if (result == -1)
|
||||
ERRNOR (EIO, NULL);
|
||||
|
||||
if (archive_name)
|
||||
vfs_stamp_create (&vfs_extfs_ops, parc, archive_name);
|
||||
|
||||
return_success:
|
||||
*archive = parc;
|
||||
return local;
|
||||
@ -713,7 +710,7 @@ extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
extfs_info->local_handle = local_handle;
|
||||
|
||||
/* i.e. we had no open files and now we have one */
|
||||
vfs_rmstamp (&vfs_extfs_ops, (vfsid) archive, 1);
|
||||
vfs_rmstamp (&vfs_extfs_ops, (vfsid) archive);
|
||||
archive->fd_usage++;
|
||||
return extfs_info;
|
||||
}
|
||||
@ -753,10 +750,8 @@ extfs_close (void *data)
|
||||
}
|
||||
|
||||
file->archive->fd_usage--;
|
||||
if (!file->archive->fd_usage) {
|
||||
vfs_stamp_create (&vfs_extfs_ops, file->archive,
|
||||
file->archive->name);
|
||||
}
|
||||
if (!file->archive->fd_usage)
|
||||
vfs_stamp_create (&vfs_extfs_ops, file->archive);
|
||||
|
||||
g_free (data);
|
||||
if (errno_code)
|
||||
@ -1108,30 +1103,16 @@ static int extfs_lseek (void *data, off_t offset, int whence)
|
||||
return lseek (file->local_handle, offset, whence);
|
||||
}
|
||||
|
||||
static vfsid extfs_getid (struct vfs_class *me, const char *path, struct vfs_stamping **parent)
|
||||
static vfsid
|
||||
extfs_getid (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct archive *archive;
|
||||
struct vfs_class *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *par;
|
||||
char *p;
|
||||
|
||||
*parent = NULL;
|
||||
if (!(p = extfs_get_path (path, &archive, 1, 1)))
|
||||
return NULL;
|
||||
g_free(p);
|
||||
if (archive->name){
|
||||
v = vfs_get_class (archive->name);
|
||||
id = vfs_getid (v, archive->name, &par);
|
||||
if (id) {
|
||||
*parent = g_new (struct vfs_stamping, 1);
|
||||
(*parent)->v = v;
|
||||
(*parent)->id = id;
|
||||
(*parent)->parent = par;
|
||||
(*parent)->next = NULL;
|
||||
}
|
||||
}
|
||||
return (vfsid) archive;
|
||||
g_free (p);
|
||||
return (vfsid) archive;
|
||||
}
|
||||
|
||||
static int extfs_nothingisopen (vfsid id)
|
||||
|
@ -687,7 +687,7 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, char *cmd, in
|
||||
int r;
|
||||
|
||||
r = fish_command (me, super, WAIT_REPLY, cmd);
|
||||
vfs_stamp_create (&vfs_fish_ops, super, NULL);
|
||||
vfs_stamp_create (&vfs_fish_ops, super);
|
||||
if (r != COMPLETE) ERRNOR (E_REMOTE, -1);
|
||||
if (flags & OPT_FLUSH)
|
||||
vfs_s_invalidate(me, super);
|
||||
|
@ -1455,7 +1455,7 @@ ftpfs_send_command(struct vfs_class *me, char *filename, char *cmd, int flags)
|
||||
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, NULL);
|
||||
vfs_stamp_create (&vfs_ftpfs_ops, super);
|
||||
if (flags & OPT_IGNORE_ERROR)
|
||||
r = COMPLETE;
|
||||
if (r != COMPLETE)
|
||||
|
171
vfs/gc.c
171
vfs/gc.c
@ -45,7 +45,7 @@ static struct vfs_stamping *stamps;
|
||||
|
||||
|
||||
static void
|
||||
vfs_addstamp (struct vfs_class *v, vfsid id, struct vfs_stamping *parent)
|
||||
vfs_addstamp (struct vfs_class *v, vfsid id)
|
||||
{
|
||||
if (!(v->flags & VFSF_LOCAL) && id != NULL) {
|
||||
struct vfs_stamping *stamp;
|
||||
@ -61,17 +61,6 @@ vfs_addstamp (struct vfs_class *v, vfsid id, struct vfs_stamping *parent)
|
||||
stamp = g_new (struct vfs_stamping, 1);
|
||||
stamp->v = v;
|
||||
stamp->id = id;
|
||||
if (parent) {
|
||||
struct vfs_stamping *st = stamp;
|
||||
while (parent) {
|
||||
st->parent = g_new (struct vfs_stamping, 1);
|
||||
*st->parent = *parent;
|
||||
parent = parent->parent;
|
||||
st = st->parent;
|
||||
}
|
||||
st->parent = 0;
|
||||
} else
|
||||
stamp->parent = 0;
|
||||
|
||||
gettimeofday (&(stamp->time), NULL);
|
||||
stamp->next = 0;
|
||||
@ -94,44 +83,20 @@ vfs_stamp (struct vfs_class *v, vfsid id)
|
||||
|
||||
for (stamp = stamps; stamp != NULL; stamp = stamp->next)
|
||||
if (stamp->v == v && stamp->id == id) {
|
||||
|
||||
gettimeofday (&(stamp->time), NULL);
|
||||
if (stamp->parent != NULL)
|
||||
vfs_stamp (stamp->parent->v, stamp->parent->id);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vfs_rm_parents (struct vfs_stamping *stamp)
|
||||
{
|
||||
struct vfs_stamping *parent;
|
||||
|
||||
while (stamp) {
|
||||
parent = stamp->parent;
|
||||
g_free (stamp);
|
||||
stamp = parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vfs_rmstamp (struct vfs_class *v, vfsid id, int removeparents)
|
||||
vfs_rmstamp (struct vfs_class *v, vfsid id)
|
||||
{
|
||||
struct vfs_stamping *stamp, *st1;
|
||||
|
||||
for (stamp = stamps, st1 = NULL; stamp != NULL;
|
||||
st1 = stamp, stamp = stamp->next)
|
||||
if (stamp->v == v && stamp->id == id) {
|
||||
if (stamp->parent != NULL) {
|
||||
if (removeparents)
|
||||
vfs_rmstamp (stamp->parent->v, stamp->parent->id, 1);
|
||||
vfs_rm_parents (stamp->parent);
|
||||
stamp->parent = NULL;
|
||||
continue; /* rescan the tree */
|
||||
}
|
||||
if (st1 == NULL) {
|
||||
stamps = stamp->next;
|
||||
} else {
|
||||
@ -146,14 +111,12 @@ vfs_rmstamp (struct vfs_class *v, vfsid id, int removeparents)
|
||||
|
||||
/* Wrapper around getid methods */
|
||||
vfsid
|
||||
vfs_getid (struct vfs_class *vclass, const char *path,
|
||||
struct vfs_stamping **parent)
|
||||
vfs_getid (struct vfs_class *vclass, const char *path)
|
||||
{
|
||||
vfsid id = NULL;
|
||||
|
||||
*parent = NULL;
|
||||
if (vclass->getid)
|
||||
id = (*vclass->getid) (vclass, path, parent);
|
||||
id = (*vclass->getid) (vclass, path);
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -161,96 +124,38 @@ vfs_getid (struct vfs_class *vclass, const char *path,
|
||||
|
||||
/* Same as vfs_getid, but append slash to the path if needed */
|
||||
vfsid
|
||||
vfs_ncs_getid (struct vfs_class *nvfs, const char *dir,
|
||||
struct vfs_stamping **par)
|
||||
vfs_ncs_getid (struct vfs_class *nvfs, const char *dir)
|
||||
{
|
||||
vfsid nvfsid;
|
||||
char *dir1;
|
||||
|
||||
dir1 = concat_dir_and_file (dir, "");
|
||||
nvfsid = vfs_getid (nvfs, dir1, par);
|
||||
nvfsid = vfs_getid (nvfs, dir1);
|
||||
g_free (dir1);
|
||||
return nvfsid;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a new timestamp item by VFS class and VFS id.
|
||||
* If parent_name is provided, get ID for it and make it our parent.
|
||||
* This should be an archive name, so that the parent archive could be
|
||||
* freed in the same time as the VFS object for the given VFS id.
|
||||
*/
|
||||
void
|
||||
vfs_stamp_create (struct vfs_class *vclass, vfsid id,
|
||||
const char *parent_name)
|
||||
{
|
||||
struct vfs_stamping *parent, *pparent;
|
||||
struct vfs_class *pclass;
|
||||
vfsid par_id;
|
||||
|
||||
parent = NULL;
|
||||
if (parent_name) {
|
||||
pclass = vfs_get_class (parent_name);
|
||||
par_id = vfs_getid (pclass, parent_name, &pparent);
|
||||
if (par_id) {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
parent->v = pclass;
|
||||
parent->next = 0;
|
||||
parent->id = par_id;
|
||||
parent->parent = pparent;
|
||||
}
|
||||
}
|
||||
|
||||
vfs_add_noncurrent_stamps (vclass, id, parent);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
is_parent (struct vfs_class *nvfs, vfsid nvfsid,
|
||||
struct vfs_stamping *parent)
|
||||
{
|
||||
struct vfs_stamping *stamp;
|
||||
|
||||
for (stamp = parent; stamp; stamp = stamp->parent)
|
||||
if (stamp->v == nvfs && stamp->id == nvfsid)
|
||||
break;
|
||||
|
||||
return (stamp ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vfs_stamp_path (char *path)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
vfsid id;
|
||||
struct vfs_stamping *par, *stamp;
|
||||
|
||||
vfs = vfs_get_class (path);
|
||||
id = vfs_ncs_getid (vfs, path, &par);
|
||||
vfs_addstamp (vfs, id, par);
|
||||
|
||||
for (stamp = par; stamp != NULL; stamp = stamp->parent)
|
||||
vfs_addstamp (stamp->v, stamp->id, stamp->parent);
|
||||
vfs_rm_parents (par);
|
||||
id = vfs_ncs_getid (vfs, path);
|
||||
vfs_addstamp (vfs, id);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
|
||||
struct vfs_stamping *parent)
|
||||
/*
|
||||
* Create a new timestamp item by VFS class and VFS id.
|
||||
*/
|
||||
void
|
||||
vfs_stamp_create (struct vfs_class *oldvfs, vfsid oldvfsid)
|
||||
{
|
||||
struct vfs_class *nvfs, *n2vfs, *n3vfs;
|
||||
vfsid nvfsid, n2vfsid, n3vfsid;
|
||||
struct vfs_stamping *par, *stamp;
|
||||
int f;
|
||||
|
||||
/* FIXME: As soon as we convert to multiple panels, this stuff
|
||||
has to change. It works like this: We do not time out the
|
||||
vfs's which are current in any panel and on the other
|
||||
side we add the old directory with all its parents which
|
||||
are not in any panel (if we find such one, we stop adding
|
||||
parents to the time-outing structure. */
|
||||
|
||||
/* 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
|
||||
@ -261,22 +166,17 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
|
||||
return;
|
||||
|
||||
nvfs = vfs_get_class (vfs_get_current_dir ());
|
||||
nvfsid = vfs_ncs_getid (nvfs, vfs_get_current_dir (), &par);
|
||||
vfs_rmstamp (nvfs, nvfsid, 1);
|
||||
nvfsid = vfs_ncs_getid (nvfs, vfs_get_current_dir ());
|
||||
vfs_rmstamp (nvfs, nvfsid);
|
||||
|
||||
f = is_parent (oldvfs, oldvfsid, par);
|
||||
vfs_rm_parents (par);
|
||||
if ((nvfs == oldvfs && nvfsid == oldvfsid) || oldvfsid == NULL
|
||||
|| f) {
|
||||
if ((nvfs == oldvfs && nvfsid == oldvfsid) || oldvfsid == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_current_type () == view_listing) {
|
||||
n2vfs = vfs_get_class (current_panel->cwd);
|
||||
n2vfsid = vfs_ncs_getid (n2vfs, current_panel->cwd, &par);
|
||||
f = is_parent (oldvfs, oldvfsid, par);
|
||||
vfs_rm_parents (par);
|
||||
if ((n2vfs == oldvfs && n2vfsid == oldvfsid) || f)
|
||||
n2vfsid = vfs_ncs_getid (n2vfs, current_panel->cwd);
|
||||
if (n2vfs == oldvfs && n2vfsid == oldvfsid)
|
||||
return;
|
||||
} else {
|
||||
n2vfs = NULL;
|
||||
@ -285,10 +185,8 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
|
||||
|
||||
if (get_other_type () == view_listing) {
|
||||
n3vfs = vfs_get_class (other_panel->cwd);
|
||||
n3vfsid = vfs_ncs_getid (n3vfs, other_panel->cwd, &par);
|
||||
f = is_parent (oldvfs, oldvfsid, par);
|
||||
vfs_rm_parents (par);
|
||||
if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f)
|
||||
n3vfsid = vfs_ncs_getid (n3vfs, other_panel->cwd);
|
||||
if (n3vfs == oldvfs && n3vfsid == oldvfsid)
|
||||
return;
|
||||
} else {
|
||||
n3vfs = NULL;
|
||||
@ -298,25 +196,7 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
|
||||
if (!oldvfs->nothingisopen || !(*oldvfs->nothingisopen) (oldvfsid))
|
||||
return;
|
||||
|
||||
vfs_addstamp (oldvfs, oldvfsid, parent);
|
||||
for (stamp = parent; stamp != NULL; stamp = stamp->parent) {
|
||||
if ((stamp->v == nvfs && stamp->id == nvfsid)
|
||||
|| (stamp->v == n2vfs && stamp->id == n2vfsid)
|
||||
|| (stamp->v == n3vfs && stamp->id == n3vfsid)
|
||||
|| !stamp->id || !stamp->v->nothingisopen
|
||||
|| !(*stamp->v->nothingisopen) (stamp->id))
|
||||
break;
|
||||
vfs_addstamp (stamp->v, stamp->id, stamp->parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
|
||||
struct vfs_stamping *parent)
|
||||
{
|
||||
_vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
|
||||
vfs_rm_parents (parent);
|
||||
vfs_addstamp (oldvfs, oldvfsid);
|
||||
}
|
||||
|
||||
|
||||
@ -370,7 +250,7 @@ vfs_expire (int now)
|
||||
st = stamp->next;
|
||||
if (stamp->v->free)
|
||||
(*stamp->v->free) (stamp->id);
|
||||
vfs_rmstamp (stamp->v, stamp->id, 0);
|
||||
vfs_rmstamp (stamp->v, stamp->id);
|
||||
stamp = st;
|
||||
} else
|
||||
stamp = stamp->next;
|
||||
@ -403,11 +283,10 @@ vfs_release_path (const char *dir)
|
||||
{
|
||||
struct vfs_class *oldvfs;
|
||||
vfsid oldvfsid;
|
||||
struct vfs_stamping *parent;
|
||||
|
||||
oldvfs = vfs_get_class (dir);
|
||||
oldvfsid = vfs_ncs_getid (oldvfs, dir, &parent);
|
||||
vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
|
||||
oldvfsid = vfs_ncs_getid (oldvfs, dir);
|
||||
vfs_stamp_create (oldvfs, oldvfsid);
|
||||
}
|
||||
|
||||
|
||||
@ -426,5 +305,5 @@ vfs_gc_done (void)
|
||||
}
|
||||
|
||||
if (stamps)
|
||||
vfs_rmstamp (stamps->v, stamps->id, 1);
|
||||
vfs_rmstamp (stamps->v, stamps->id);
|
||||
}
|
||||
|
18
vfs/gc.h
18
vfs/gc.h
@ -4,28 +4,22 @@
|
||||
struct vfs_stamping {
|
||||
struct vfs_class *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *parent;
|
||||
struct vfs_stamping *next;
|
||||
struct timeval time;
|
||||
};
|
||||
|
||||
extern int vfs_timeout;
|
||||
|
||||
void vfs_stamp (struct vfs_class *, vfsid);
|
||||
void vfs_rmstamp (struct vfs_class *, vfsid, int);
|
||||
void vfs_add_noncurrent_stamps (struct vfs_class *, vfsid,
|
||||
struct vfs_stamping *);
|
||||
void vfs_stamp_create (struct vfs_class *vclass, vfsid id,
|
||||
const char *parent_name);
|
||||
void vfs_stamp (struct vfs_class *v, vfsid id);
|
||||
void vfs_rmstamp (struct vfs_class *v, vfsid id);
|
||||
void vfs_stamp_create (struct vfs_class *vclass, vfsid id);
|
||||
void vfs_add_current_stamps (void);
|
||||
void vfs_timeout_handler (void);
|
||||
void vfs_expire (int);
|
||||
void vfs_expire (int now);
|
||||
int vfs_timeouts (void);
|
||||
void vfs_release_path (const char *dir);
|
||||
vfsid vfs_getid (struct vfs_class *vclass, const char *path,
|
||||
struct vfs_stamping **parent);
|
||||
vfsid vfs_ncs_getid (struct vfs_class *nvfs, const char *dir,
|
||||
struct vfs_stamping **par);
|
||||
vfsid vfs_getid (struct vfs_class *vclass, const char *path);
|
||||
vfsid vfs_ncs_getid (struct vfs_class *nvfs, const char *dir);
|
||||
void vfs_gc_done (void);
|
||||
|
||||
#endif /* __GC_H */
|
||||
|
32
vfs/sfs.c
32
vfs/sfs.c
@ -173,7 +173,7 @@ sfs_redirect (struct vfs_class *me, const char *name)
|
||||
cur->next = head;
|
||||
head = cur;
|
||||
|
||||
vfs_stamp_create (&vfs_sfs_ops, head, NULL);
|
||||
vfs_stamp_create (&vfs_sfs_ops, head);
|
||||
|
||||
return cache;
|
||||
}
|
||||
@ -241,14 +241,9 @@ static int sfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
}
|
||||
|
||||
static vfsid
|
||||
sfs_getid (struct vfs_class *me, const char *path,
|
||||
struct vfs_stamping **parent)
|
||||
sfs_getid (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct vfs_class *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *par;
|
||||
struct cachedfile *cur = head;
|
||||
char *path2;
|
||||
|
||||
while (cur) {
|
||||
if (!strcmp (path, cur->name))
|
||||
@ -256,29 +251,6 @@ sfs_getid (struct vfs_class *me, const char *path,
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
*parent = NULL;
|
||||
|
||||
if (!cur)
|
||||
return NULL;
|
||||
|
||||
path2 = g_strdup (path);
|
||||
|
||||
/* Strip suffix which led to this being sfs */
|
||||
v = vfs_split (path2, NULL, NULL);
|
||||
|
||||
/* ... and learn whoever was the parent system */
|
||||
v = vfs_split (path2, NULL, NULL);
|
||||
|
||||
id = vfs_getid (v, path2, &par);
|
||||
g_free (path2);
|
||||
|
||||
if (id) {
|
||||
*parent = g_new (struct vfs_stamping, 1);
|
||||
(*parent)->v = v;
|
||||
(*parent)->id = id;
|
||||
(*parent)->parent = par;
|
||||
(*parent)->next = NULL;
|
||||
}
|
||||
return (vfsid) cur;
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ tar_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
if (parc->u.arch.st.st_mtime < archive_stat->st_mtime) {
|
||||
/* Yes, reload! */
|
||||
(*vfs_tarfs_ops.free) ((vfsid) parc);
|
||||
vfs_rmstamp (&vfs_tarfs_ops, (vfsid) parc, 0);
|
||||
vfs_rmstamp (&vfs_tarfs_ops, (vfsid) parc);
|
||||
return 2;
|
||||
}
|
||||
/* Hasn't been modified, give it a new timeout */
|
||||
|
@ -655,13 +655,10 @@ undelfs_lseek(void *vfs_info, off_t offset, int whence)
|
||||
}
|
||||
|
||||
static vfsid
|
||||
undelfs_getid (struct vfs_class *me, const char *path,
|
||||
struct vfs_stamping **parent)
|
||||
undelfs_getid (struct vfs_class *me, const char *path)
|
||||
{
|
||||
char *fname, *fsname;
|
||||
|
||||
/* We run only on the local fs */
|
||||
*parent = NULL;
|
||||
undelfs_get_path (path, &fsname, &fname);
|
||||
|
||||
if (!fsname)
|
||||
|
@ -669,7 +669,6 @@ mc_chdir (const char *path)
|
||||
char *new_dir;
|
||||
struct vfs_class *old_vfs, *new_vfs;
|
||||
vfsid old_vfsid;
|
||||
struct vfs_stamping *parent;
|
||||
int result;
|
||||
|
||||
new_dir = vfs_canon (path);
|
||||
@ -685,7 +684,7 @@ mc_chdir (const char *path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
old_vfsid = vfs_ncs_getid (current_vfs, current_dir, &parent);
|
||||
old_vfsid = vfs_ncs_getid (current_vfs, current_dir);
|
||||
old_vfs = current_vfs;
|
||||
|
||||
/* Actually change directory */
|
||||
@ -694,7 +693,7 @@ mc_chdir (const char *path)
|
||||
current_vfs = new_vfs;
|
||||
|
||||
/* This function uses the new current_dir implicitly */
|
||||
vfs_add_noncurrent_stamps (old_vfs, old_vfsid, parent);
|
||||
vfs_stamp_create (old_vfs, old_vfsid);
|
||||
|
||||
/* Sometimes we assume no trailing slash on cwd */
|
||||
if (*current_dir) {
|
||||
|
@ -57,8 +57,7 @@ struct vfs_class {
|
||||
int (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
int (*mknod) (struct vfs_class *me, char *path, int mode, int dev);
|
||||
|
||||
vfsid (*getid) (struct vfs_class *me, const char *path,
|
||||
struct vfs_stamping ** parent);
|
||||
vfsid (*getid) (struct vfs_class *me, const char *path);
|
||||
|
||||
int (*nothingisopen) (vfsid id);
|
||||
void (*free) (vfsid id);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user