HAVE_MMAP still necessary ?

Enrico Weigelt weigelt at metux.de
Sat Dec 27 20:43:53 UTC 2008


* Enrico Weigelt <weigelt at metux.de> schrieb:
> 
> Hi folks,
> 
> 
> I really wonder whether the mmap() stuff is still needed at all.
> It doesnt seem to be really used anywhere.

Ups, didn't look hard enough (just scanned the vfs subdir) ;-O

Okay, there're mainly two mmap()-using places: 

a) cmd.c: compare_files() - it uses the mmap() call directly 
   (w/o going over mcvfs), and it seems to work on local files 
   only. wouldn't it make sense to let it run via mcvfs ? 

b) view.c: it tries to mmap() in the file, obviously to let the
   kernel do all the loading. 
   BUT: do we *really* want mmap() here, or just some "get me
   that file into memory"()-call (same in cmd.c) ?
  
In case we just want to have an faster way for loading files into 
memory (in case it's supported), I suggest some new vfs operation
for that, let's call it "loadFile()" - it returns some FILE_DATA
structure, containing size, buffer ptr and a callback vector for
free'ing. Everyone who wants the whole file (or large blocks) 
just uses this call instead of ugly #ifdef's, and it's up to vfs
to decide what to do behind the scenes.


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service - http://www.metux.de/
---------------------------------------------------------------------
 Please visit the OpenSource QM Taskforce:
 	http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
	http://patches.metux.de/
---------------------------------------------------------------------



More information about the mc-devel mailing list