diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 87bd99390..95eb9d9be 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,5 +1,9 @@ 2003-10-16 Pavel Roskin + * direntry.c (vfs_s_setctl): Implement VFS_SETCTL_FLUSH. + * ftpfs.c: Remove ftpfs_flushdir. Use MEDATA->flush. + * fish.c: Use MEDATA->flush. + * direntry.c (vfs_s_setctl): Add support to VFS_SETCTL_LOGFILE. * ftpfs.c (ftpfs_set_debug): Remove. diff --git a/vfs/direntry.c b/vfs/direntry.c index 0d81c696b..c1b6a6f1d 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -1013,6 +1013,9 @@ vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, void *arg) case VFS_SETCTL_LOGFILE: MEDATA->logfile = fopen ((char *) arg, "w"); return 1; + case VFS_SETCTL_FLUSH: + MEDATA->flush = 1; + return 1; } return 0; } diff --git a/vfs/fish.c b/vfs/fish.c index 766d65d7e..51e254f66 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -67,11 +67,6 @@ #define TRANSIENT 4 /* transient negative completion */ #define ERROR 5 /* permanent negative completion */ -/* If true, the directory cache is forced to reload */ -static int force_expiration = 0; - -/* FIXME: prev two variables should be killed */ - /* command wait_flag: */ #define NONE 0x00 #define WAIT_REPLY 0x01 @@ -343,8 +338,8 @@ dir_uptodate(struct vfs_class *me, struct vfs_s_inode *ino) struct timeval tim; gettimeofday(&tim, NULL); - if (force_expiration) { - force_expiration = 0; + if (MEDATA->flush) { + MEDATA->flush = 0; return 0; } if (tim.tv_sec < ino->timestamp.tv_sec) diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 491b53471..0f7167443 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -131,9 +131,6 @@ int ftpfs_always_use_proxy; /* source routing host */ extern int source_route; -/* If true, the directory cache is forced to reload */ -static int force_expiration = 0; - #ifdef FIXME_LATER_ALIGATOR static struct linklist *connections_list; #endif @@ -827,19 +824,13 @@ archive_same(struct vfs_class *me, struct vfs_s_super *super, char *archive_name return port; } -void -ftpfs_flushdir (void) -{ - force_expiration = 1; -} - static int dir_uptodate(struct vfs_class *me, struct vfs_s_inode *ino) { struct timeval tim; - if (force_expiration) { - force_expiration = 0; + if (MEDATA->flush) { + MEDATA->flush = 0; return 0; } gettimeofday(&tim, NULL); diff --git a/vfs/vfs.h b/vfs/vfs.h index 29fcccbe1..2075a2c9b 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -142,10 +142,7 @@ void vfs_fill_names (void (*)(char *)); char *vfs_translate_url (const char *); #ifdef USE_NETCODE -void ftpfs_flushdir (void); extern int use_netrc; -#else -# define ftpfs_flushdir() #endif /* Only the routines outside of the VFS module need the emulation macros */ @@ -229,6 +226,7 @@ enum { VFS_SETCTL_FORGET, VFS_SETCTL_RUN, VFS_SETCTL_LOGFILE, + VFS_SETCTL_FLUSH, /* invalidate directory cache */ /* Setting this makes vfs layer give out potentially incorrect data, but it also makes some operations much faster. Use with caution. */ diff --git a/vfs/xdirentry.h b/vfs/xdirentry.h index c009fc6a8..edc91582d 100644 --- a/vfs/xdirentry.h +++ b/vfs/xdirentry.h @@ -119,6 +119,7 @@ struct vfs_s_subclass { int inode_counter; dev_t rdev; FILE *logfile; + int flush; /* if set to 1, invalidate directory cache */ int (*init_inode) (struct vfs_class *me, struct vfs_s_inode *ino); /* optional */ void (*free_inode) (struct vfs_class *me, struct vfs_s_inode *ino); /* optional */