[Thunar-dev] reducing stat()'s and fread's

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Sat Jun 4 15:05:23 CEST 2005


Wit Wilinski wrote:
> Hi!

Hey Wit,

> 	I just thunar's wiki and found somebody mentioned that stat()'s should be reduced. Maybe my unconventional approach would be useful.
> The idea is to store some file's information, including mime type in filesystem's metadata.
> Description is attached to this mail

The shared mime database spec mentions that an implementation MAY query 
the MIME type from an extended attribute:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.13.html#id2506422

This can be supported, but since most file systems don't support 
extended attributes (and those that do, differ in implementations across 
operating systems), it is on low priority. In addition, this requires 
support from the applications that store the files, because the file 
manager can only guess MIME types based on the shared mime database, and 
only the application knows for sure, what it's about to save. So writing 
the attribute from within the file manager would violate the concept.

We currently use xdgmime for the detection (this will change in the 
future, but for now, it's better to concentrate on the higher level 
stuff), which is wrapped by libexo. For linux, somebody could prepare a 
patch to xdg_mime_get_mime_type_from_file(), which would query the 
extattr first (see ROX for an example of how to do this).

greets,
Benedikt



More information about the Thunar-dev mailing list