Suggestion to keep the type of a file or directory in the stat field st_rdev.

PCMan at
Sun Mar 18 21:43:37 PDT 2012

Another problem is, how can you map mime-type ids to mime-type strings?
It's not possible to hard code an array of known mime-types and look it up
with the ids.
Mime-types can be added to and removed from the system dynamically using
The only possible way to do it I can think of is to have a list of known
types and use them only.
Or do you have a better way to do it?

On Sun, Mar 18, 2012 at 11:31 PM, Stef Bon <stefbon at> wrote:

> Using Xattr is also possible.
> But keep in mind that storing this kind of information in extended
> attributes
> will result in two extra calls per file or directory, while when
> storing this in the rdev field no extra calls are required. And why
> use xattr when the rdev field is available?
> Still the storing of the type of the file or directory is the storing
> of an numerical value.
> Stef
> 2012/3/17 PCMan < at>:
> > Can't xattr be used for this purpose?
> > IIRC storing mime-types in xattr is proposed long time ago.
> > However, most applications do not seem to use this.
> > Though it might be less efficient than a numeric id, this might be a more
> > portable way than using the rdev hack.
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xdg mailing list