mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* vfs.h: Rename commands for mc_ctl() and mc_setctl() to make it
clear which function they are used with. * vfs.c (mc_ctl): Change last argument to (void*). (mc_set): Likewise. Adjust all dependencies.
This commit is contained in:
parent
fc7267906f
commit
52844a3092
14
src/file.c
14
src/file.c
@ -688,7 +688,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path,
|
||||
|
||||
for (;;) {
|
||||
/* src_read */
|
||||
if (mc_ctl (src_desc, MCCTL_IS_NOTREADY, 0))
|
||||
if (mc_ctl (src_desc, VFS_CTL_IS_NOTREADY, 0))
|
||||
n_read = -1;
|
||||
else
|
||||
while ((n_read = mc_read (src_desc, buf, buf_size)) < 0) {
|
||||
@ -1896,8 +1896,8 @@ panel_operate (void *source_panel, FileOperation operation,
|
||||
|
||||
/* If we are the parent */
|
||||
if (v == 1) {
|
||||
mc_setctl (panel->cwd, MCCTL_FORGET_ABOUT, NULL);
|
||||
mc_setctl (dest, MCCTL_FORGET_ABOUT, NULL);
|
||||
mc_setctl (panel->cwd, VFS_SETCTL_FORGET, NULL);
|
||||
mc_setctl (dest, VFS_SETCTL_FORGET, NULL);
|
||||
/* file_op_context_destroy (ctx); */
|
||||
return 0;
|
||||
}
|
||||
@ -1909,11 +1909,11 @@ panel_operate (void *source_panel, FileOperation operation,
|
||||
created/touched. However, this will make our cache contain
|
||||
invalid data. */
|
||||
if (dest) {
|
||||
if (mc_setctl (dest, MCCTL_WANT_STALE_DATA, NULL))
|
||||
if (mc_setctl (dest, VFS_SETCTL_STALE_DATA, (void *) 1))
|
||||
save_dest = g_strdup (dest);
|
||||
}
|
||||
if (panel->cwd) {
|
||||
if (mc_setctl (panel->cwd, MCCTL_WANT_STALE_DATA, NULL))
|
||||
if (mc_setctl (panel->cwd, VFS_SETCTL_STALE_DATA, (void *) 1))
|
||||
save_cwd = g_strdup (panel->cwd);
|
||||
}
|
||||
|
||||
@ -2112,11 +2112,11 @@ panel_operate (void *source_panel, FileOperation operation,
|
||||
/* Clean up */
|
||||
|
||||
if (save_cwd) {
|
||||
mc_setctl (save_cwd, MCCTL_NO_STALE_DATA, NULL);
|
||||
mc_setctl (save_cwd, VFS_SETCTL_STALE_DATA, NULL);
|
||||
g_free (save_cwd);
|
||||
}
|
||||
if (save_dest) {
|
||||
mc_setctl (save_dest, MCCTL_NO_STALE_DATA, NULL);
|
||||
mc_setctl (save_dest, VFS_SETCTL_STALE_DATA, NULL);
|
||||
g_free (save_dest);
|
||||
}
|
||||
|
||||
|
@ -1959,7 +1959,7 @@ do_enter_on_file_entry (file_entry *fe)
|
||||
int ret;
|
||||
|
||||
tmp = concat_dir_and_file (vfs_get_current_dir (), fe->fname);
|
||||
ret = mc_setctl (tmp, MCCTL_EXTFS_RUN, NULL);
|
||||
ret = mc_setctl (tmp, VFS_SETCTL_RUN, NULL);
|
||||
g_free (tmp);
|
||||
/* We took action only if the dialog was shown or the execution
|
||||
* was successful */
|
||||
|
@ -1,5 +1,11 @@
|
||||
2003-10-16 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* vfs.h: Rename commands for mc_ctl() and mc_setctl() to make it
|
||||
clear which function they are used with.
|
||||
* vfs.c (mc_ctl): Change last argument to (void*).
|
||||
(mc_set): Likewise.
|
||||
Adjust all dependencies.
|
||||
|
||||
* xdirentry.h: Move system includes to the files that need them.
|
||||
|
||||
* xdirentry.h: Fix typos in field names.
|
||||
|
@ -992,27 +992,21 @@ vfs_s_getlocalcopy (struct vfs_class *me, char *path)
|
||||
return g_strdup (ino->localname);
|
||||
}
|
||||
|
||||
static int
|
||||
vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
|
||||
static int
|
||||
vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
{
|
||||
struct vfs_s_inode *ino = vfs_s_inode_from_path (me, path, 0);
|
||||
if (!ino)
|
||||
return 0;
|
||||
switch (ctlop){
|
||||
case MCCTL_WANT_STALE_DATA:
|
||||
ino->super->want_stale = 1;
|
||||
switch (ctlop) {
|
||||
case VFS_SETCTL_STALE_DATA:
|
||||
if (arg)
|
||||
ino->super->want_stale = 1;
|
||||
else {
|
||||
ino->super->want_stale = 0;
|
||||
vfs_s_invalidate (me, ino->super);
|
||||
}
|
||||
return 1;
|
||||
case MCCTL_NO_STALE_DATA:
|
||||
ino->super->want_stale = 0;
|
||||
vfs_s_invalidate(me, ino->super);
|
||||
return 1;
|
||||
#if 0 /* FIXME: We should implement these */
|
||||
case MCCTL_REMOVELOCALCOPY:
|
||||
return remove_temp_file (path);
|
||||
case MCCTL_FORGET_ABOUT:
|
||||
my_forget(path);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1345,10 +1345,11 @@ static void extfs_done (struct vfs_class *me)
|
||||
extfs_no = 0;
|
||||
}
|
||||
|
||||
static int extfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
|
||||
static int
|
||||
extfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
{
|
||||
if (ctlop == MCCTL_EXTFS_RUN) {
|
||||
extfs_run (path);
|
||||
if (ctlop == VFS_SETCTL_RUN) {
|
||||
extfs_run (path);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -645,11 +645,11 @@ linear_close (struct vfs_class *me, struct vfs_s_fh *fh)
|
||||
}
|
||||
|
||||
static int
|
||||
fish_ctl (void *fh, int ctlop, int arg)
|
||||
fish_ctl (void *fh, int ctlop, void *arg)
|
||||
{
|
||||
return 0;
|
||||
switch (ctlop) {
|
||||
case MCCTL_IS_NOTREADY:
|
||||
case VFS_CTL_IS_NOTREADY:
|
||||
{
|
||||
int v;
|
||||
|
||||
|
@ -1506,10 +1506,10 @@ linear_close (struct vfs_class *me, struct vfs_s_fh *fh)
|
||||
linear_abort(me, fh);
|
||||
}
|
||||
|
||||
static int ftpfs_ctl (void *fh, int ctlop, int arg)
|
||||
static int ftpfs_ctl (void *fh, int ctlop, void *arg)
|
||||
{
|
||||
switch (ctlop) {
|
||||
case MCCTL_IS_NOTREADY:
|
||||
case VFS_CTL_IS_NOTREADY:
|
||||
{
|
||||
int v;
|
||||
|
||||
|
@ -1141,10 +1141,10 @@ my_forget (char *path)
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
|
||||
mcfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
{
|
||||
switch (ctlop) {
|
||||
case MCCTL_FORGET_ABOUT:
|
||||
case VFS_SETCTL_FORGET:
|
||||
my_forget (path);
|
||||
return 0;
|
||||
}
|
||||
|
12
vfs/smbfs.c
12
vfs/smbfs.c
@ -1727,14 +1727,14 @@ my_forget (char *path)
|
||||
g_free (user);
|
||||
}
|
||||
|
||||
static int
|
||||
smbfs_setctl (struct vfs_class *me, char *path, int ctlop, char *arg)
|
||||
static int
|
||||
smbfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
{
|
||||
DEBUG(3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop));
|
||||
DEBUG (3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop));
|
||||
switch (ctlop) {
|
||||
case MCCTL_FORGET_ABOUT:
|
||||
my_forget(path);
|
||||
return 0;
|
||||
case VFS_SETCTL_FORGET:
|
||||
my_forget (path);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ mc_open (const char *filename, int flags, ...)
|
||||
MC_HANDLEOP(read, (int handle, char *buffer, int count), (vfs_info (handle), buffer, count) )
|
||||
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, int arg)
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_op (handle);
|
||||
|
||||
@ -442,7 +442,7 @@ mc_ctl (int handle, int ctlop, int arg)
|
||||
}
|
||||
|
||||
int
|
||||
mc_setctl (char *path, int ctlop, char *arg)
|
||||
mc_setctl (char *path, int ctlop, void *arg)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
|
32
vfs/vfs.h
32
vfs/vfs.h
@ -74,8 +74,8 @@ struct vfs_class {
|
||||
int (*mkdir) (struct vfs_class *me, char *path, mode_t mode);
|
||||
int (*rmdir) (struct vfs_class *me, char *path);
|
||||
|
||||
int (*ctl) (void *vfs_info, int ctlop, int arg);
|
||||
int (*setctl) (struct vfs_class *me, char *path, int ctlop, char *arg);
|
||||
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
||||
int (*setctl) (struct vfs_class *me, char *path, int ctlop, void *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len, int prot,
|
||||
int flags, void *vfs_info, off_t offset);
|
||||
@ -183,8 +183,8 @@ int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed);
|
||||
char *mc_def_getlocalcopy (struct vfs_class *vfs, char *filename);
|
||||
int mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local,
|
||||
int has_changed);
|
||||
int mc_ctl (int fd, int ctlop, int arg);
|
||||
int mc_setctl (char *path, int ctlop, char *arg);
|
||||
int mc_ctl (int fd, int ctlop, void *arg);
|
||||
int mc_setctl (char *path, int ctlop, void *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t);
|
||||
int mc_munmap (caddr_t addr, size_t len);
|
||||
@ -227,15 +227,21 @@ struct smb_authinfo *vfs_smb_get_authinfo (const char *host,
|
||||
void vfs_print_stats (const char *fs_name, const char *action,
|
||||
const char *file_name, off_t have, off_t need);
|
||||
|
||||
/* Don't use values 0..4 for a while -- 10/98, pavel@ucw.cz */
|
||||
#define MCCTL_REMOVELOCALCOPY 5
|
||||
#define MCCTL_IS_NOTREADY 6
|
||||
#define MCCTL_FORGET_ABOUT 7
|
||||
#define MCCTL_EXTFS_RUN 8
|
||||
/* These two make vfs layer give out potentially incorrect data, but
|
||||
they also make some operation 100 times faster. Use with caution. */
|
||||
#define MCCTL_WANT_STALE_DATA 9
|
||||
#define MCCTL_NO_STALE_DATA 10
|
||||
/* Operations for mc_ctl - on open file */
|
||||
enum {
|
||||
VFS_CTL_IS_NOTREADY
|
||||
};
|
||||
|
||||
/* Operations for mc_setctl - on path */
|
||||
enum {
|
||||
VFS_SETCTL_FORGET,
|
||||
VFS_SETCTL_RUN,
|
||||
VFS_SETCTL_LOGFILE,
|
||||
|
||||
/* Setting this makes vfs layer give out potentially incorrect data,
|
||||
but it also makes some operations much faster. Use with caution. */
|
||||
VFS_SETCTL_STALE_DATA
|
||||
};
|
||||
|
||||
#define O_ALL (O_CREAT | O_EXCL | O_NOCTTY | O_NDELAY | O_SYNC | O_WRONLY | O_RDWR | O_RDONLY)
|
||||
/* Midnight commander code should _not_ use other flags than those
|
||||
|
Loading…
Reference in New Issue
Block a user