2005.04.11 07:38 "[Tiff] TIFF_MAPPED", by Katrina Maramba

2005.04.11 14:17 "Re: [Tiff] TIFF_MAPPED", by Bob Friesenhahn

Can anybody tell me what the TIFF_MAPPED macro means? It's comment says "file is mapped into memory". What does this mean? When can I have a 'memory mapped file'?

Libtiff normally memory maps input files on platforms where it makes sense. You can re-inforce your desire for memory-mapped input by adding 'M' to the TIFFOpen() option string, or prevent it by adding 'm' to the option string.

You can gain a bit more control over what libtiff does by using TIFFClientOpen() to define the I/O functions it should use. One of these functions is to memory map the file.

Please note that libtiff memory maps the entire file. It does not attempt to do any "windowing" on the memory mapping. This means if the input TIFF file is larger than the available process address space, the mapping will fail.

          * Setup initial directory.
         switch (mode[0]) {
         case 'r':
                 tif->tif_nextdiroff = tif->tif_header.tiff_diroff;
                  * Try to use a memory-mapped file if the client
                  * has not explicitly suppressed usage with the
                  * 'm' flag in the open mode (see above).
                 if ((tif->tif_flags & TIFF_MAPPED) &&
         !TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))
                         tif->tif_flags &= ~TIFF_MAPPED;
                 if (TIFFReadDirectory(tif)) {
                         tif->tif_rawcc = -1;
                         tif->tif_flags |= TIFF_BUFFERSETUP;
                         return (tif);

Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/