Re: Suggestion for file type detection approach



Le mar 13/01/2004 à 18:11, Jeffrey Stedfast a écrit :

> > Not commenting on the general issue, but the EA caching thing is a
> > non-starter. Reading an EA is just like reading a normal file, its not
> > stored in the dirent. So, given that its as fast to read a block as it
> > is to read the few bytes of the mimetype string, reading EAs is bound to
> > be the same speed as sniffing.

Except if the filesystem implementation stores the EAs in contiguous
blocks and does a reasonable readahead.

> er, good point. no reason you couldn't have an inode->mime_type mappings
> file somewhere in the directory tho... that should be extremely fast.

Sure, but then you need a good strategy when updating this file (e.g. if
you add/remove a file in the directory). This starts to look a bit like
an embedded database.
Anyway, any strategy will give better results than seeking around
sniffing file types. The mime_type cache is the way of the future.

	Xav




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]