mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* vfs.h, vfs-impl.h, vfs.c, local.h, local.c, sfs.c: Removed
support for mmap() and munmap() from the VFS. It is unused and cannot be applied to remote file systems.
This commit is contained in:
parent
148f56adcd
commit
bb14c4e1da
@ -1,3 +1,9 @@
|
||||
2005-07-05 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* vfs.h, vfs-impl.h, vfs.c, local.h, local.c, sfs.c: Removed
|
||||
support for mmap() and munmap() from the VFS. It is unused and
|
||||
cannot be applied to remote file systems.
|
||||
|
||||
2005-07-03 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* xdirentry.h: Added missing #include directives.
|
||||
|
25
vfs/local.c
25
vfs/local.c
@ -286,27 +286,6 @@ local_ungetlocalcopy (struct vfs_class *me, const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t
|
||||
local_mmap (struct vfs_class *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset)
|
||||
{
|
||||
int fd = * (int *)data;
|
||||
|
||||
(void) me;
|
||||
|
||||
return mmap (addr, len, prot, flags, fd, offset);
|
||||
}
|
||||
|
||||
int
|
||||
local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data)
|
||||
{
|
||||
(void) me;
|
||||
(void) data;
|
||||
|
||||
return munmap (addr, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
local_which (struct vfs_class *me, const char *path)
|
||||
{
|
||||
@ -348,9 +327,5 @@ init_localfs (void)
|
||||
vfs_local_ops.ungetlocalcopy = local_ungetlocalcopy;
|
||||
vfs_local_ops.mkdir = local_mkdir;
|
||||
vfs_local_ops.rmdir = local_rmdir;
|
||||
#ifdef HAVE_MMAP
|
||||
vfs_local_ops.mmap = local_mmap;
|
||||
vfs_local_ops.munmap = local_munmap;
|
||||
#endif
|
||||
vfs_register_class (&vfs_local_ops);
|
||||
}
|
||||
|
@ -12,10 +12,5 @@ extern int local_read (void *data, char *buffer, int count);
|
||||
extern int local_fstat (void *data, struct stat *buf);
|
||||
extern int local_errno (struct vfs_class *me);
|
||||
extern int local_lseek (void *data, off_t offset, int whence);
|
||||
#ifdef HAVE_MMAP
|
||||
extern caddr_t local_mmap (struct vfs_class *me, caddr_t addr, size_t len,
|
||||
int prot, int flags, void *data, off_t offset);
|
||||
extern int local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -450,9 +450,5 @@ init_sfs (void)
|
||||
vfs_sfs_ops.free = sfs_free;
|
||||
vfs_sfs_ops.getlocalcopy = sfs_getlocalcopy;
|
||||
vfs_sfs_ops.ungetlocalcopy = sfs_ungetlocalcopy;
|
||||
#ifdef HAVE_MMAP
|
||||
vfs_sfs_ops.mmap = local_mmap;
|
||||
vfs_sfs_ops.munmap = local_munmap;
|
||||
#endif
|
||||
vfs_register_class (&vfs_sfs_ops);
|
||||
}
|
||||
|
@ -71,12 +71,6 @@ struct vfs_class {
|
||||
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
||||
int (*setctl) (struct vfs_class *me, const 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);
|
||||
int (*munmap) (struct vfs_class *me, caddr_t addr, size_t len,
|
||||
void *vfs_info);
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
55
vfs/vfs.c
55
vfs/vfs.c
@ -742,61 +742,6 @@ vfs_file_class_flags (const char *filename)
|
||||
return vfs->flags;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
static struct mc_mmapping {
|
||||
caddr_t addr;
|
||||
void *vfs_info;
|
||||
struct vfs_class *vfs;
|
||||
struct mc_mmapping *next;
|
||||
} *mc_mmaparray = NULL;
|
||||
|
||||
caddr_t
|
||||
mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
caddr_t result;
|
||||
struct mc_mmapping *mcm;
|
||||
|
||||
if (fd == -1)
|
||||
return (caddr_t) -1;
|
||||
|
||||
vfs = vfs_op (fd);
|
||||
result = vfs->mmap ? (*vfs->mmap)(vfs, addr, len, prot, flags, vfs_info (fd), offset) : (caddr_t)-1;
|
||||
if (result == (caddr_t)-1){
|
||||
errno = ferrno (vfs);
|
||||
return (caddr_t)-1;
|
||||
}
|
||||
mcm =g_new (struct mc_mmapping, 1);
|
||||
mcm->addr = result;
|
||||
mcm->vfs_info = vfs_info (fd);
|
||||
mcm->vfs = vfs;
|
||||
mcm->next = mc_mmaparray;
|
||||
mc_mmaparray = mcm;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
mc_munmap (caddr_t addr, size_t len)
|
||||
{
|
||||
struct mc_mmapping *mcm, *mcm2 = NULL;
|
||||
|
||||
for (mcm = mc_mmaparray; mcm != NULL; mcm2 = mcm, mcm = mcm->next){
|
||||
if (mcm->addr == addr){
|
||||
if (mcm2 == NULL)
|
||||
mc_mmaparray = mcm->next;
|
||||
else
|
||||
mcm2->next = mcm->next;
|
||||
if (mcm->vfs->munmap)
|
||||
(*mcm->vfs->munmap)(mcm->vfs, addr, len, mcm->vfs_info);
|
||||
g_free (mcm);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static char *
|
||||
mc_def_getlocalcopy (const char *filename)
|
||||
{
|
||||
|
@ -48,10 +48,6 @@ char *mc_getlocalcopy (const char *pathname);
|
||||
int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed);
|
||||
int mc_ctl (int fd, int ctlop, void *arg);
|
||||
int mc_setctl (const 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);
|
||||
#endif /* HAVE_MMAP */
|
||||
|
||||
/* Operations for mc_ctl - on open file */
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user