[Fontconfig] commit (branch): read and write cache files.

Patrick Lam plam at MIT.EDU
Tue Jul 26 04:39:32 EST 2005

Keith Packard wrote:
> I was thinking we'd continue to use per-directory caches unless you
> don't think that will work. The reason here is that each user can add
> directories to the set, and having only a global cache means that
> everyone would have a ~/.fonts.cache-2 file. Right now, the local caches
> are significantly more expensive to use as many additional stat(2) calls
> are needed to validate the cache.

I think that per-directory caches will work once I implement banked
references to mmaped objects, e.g. right now we have

typedef struct _FcValueListPtr {
    FcStorage               storage;
    union {
        int                 stat;
        struct _FcValueList *dyn;
    } u;
} FcValueListPtr;

and after my next change we'll have

typedef struct _FcStaticPtr {
	int bank;
	int offset;
} FcStaticPtr;

typedef struct _FcValueListPtr {
    FcStorage               storage;
    union {
        FcStaticPtr         stat;
        struct _FcValueList *dyn;
    } u;
} FcValueListPtr;

I wonder if we should manually pack the FcStaticPtr into, say, 24 bits
for offset and 8 bits for bank.  Or if we should wonder about that for
now.  The banked data structures enable per-directory caches.

The only remaining issue is that FcObjectPtr is now an int, and we want
to keep it that way.  We can probably do something clever there, maybe
again the 24/8 split or something.

> If we need a single global cache, it would need to live in /var
> somewhere, which is something of a pain as there isn't strong concensus
> on what /var should look like these days. A quick read through the LSB
> might provide some suggestions.

Hopefully we can avoid the single global cache.


More information about the Fontconfig mailing list