From bb14c4e1da234f7f204123e92acd0a3da20f576a Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Tue, 5 Jul 2005 21:01:57 +0000 Subject: [PATCH] * 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. --- vfs/ChangeLog | 6 ++++++ vfs/local.c | 25 ----------------------- vfs/local.h | 5 ----- vfs/sfs.c | 4 ---- vfs/vfs-impl.h | 6 ------ vfs/vfs.c | 55 -------------------------------------------------- vfs/vfs.h | 4 ---- 7 files changed, 6 insertions(+), 99 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 8bcc188bf..85e782cd1 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,9 @@ +2005-07-05 Roland Illig + + * 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 * xdirentry.h: Added missing #include directives. diff --git a/vfs/local.c b/vfs/local.c index f0f3a4281..3a539191b 100644 --- a/vfs/local.c +++ b/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); } diff --git a/vfs/local.h b/vfs/local.h index 3855f1f2b..daa894002 100644 --- a/vfs/local.h +++ b/vfs/local.h @@ -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 diff --git a/vfs/sfs.c b/vfs/sfs.c index 3a3d221a6..6e1d66405 100644 --- a/vfs/sfs.c +++ b/vfs/sfs.c @@ -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); } diff --git a/vfs/vfs-impl.h b/vfs/vfs-impl.h index eb67b3b8e..668a7b639 100644 --- a/vfs/vfs-impl.h +++ b/vfs/vfs-impl.h @@ -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 }; /* diff --git a/vfs/vfs.c b/vfs/vfs.c index 8174984e8..68c63561f 100644 --- a/vfs/vfs.c +++ b/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) { diff --git a/vfs/vfs.h b/vfs/vfs.h index 634634eae..d6e2f19e3 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -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 {