Another problem is, how can you map mime-type ids to mime-type strings?<div>It's not possible to hard code an array of known mime-types and look it up with the ids.</div><div>Mime-types can be added to and removed from the system dynamically using shared-mime-database.</div>
<div>The only possible way to do it I can think of is to have a list of known types and use them only.</div><div>Or do you have a better way to do it?<br><br><div class="gmail_quote">On Sun, Mar 18, 2012 at 11:31 PM, Stef Bon <span dir="ltr"><<a href="mailto:stefbon@gmail.com">stefbon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Using Xattr is also possible.<br>
<br>
But keep in mind that storing this kind of information in extended attributes<br>
will result in two extra calls per file or directory, while when<br>
storing this in the rdev field no extra calls are required. And why<br>
use xattr when the rdev field is available?<br>
<br>
Still the storing of the type of the file or directory is the storing<br>
of an numerical value.<br>
<br>
Stef<br>
<br>
<br>
<br>
<br>
2012/3/17 PCMan <<a href="mailto:pcman.tw@gmail.com">pcman.tw@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Can't xattr be used for this purpose?<br>
> IIRC storing mime-types in xattr is proposed long time ago.<br>
> However, most applications do not seem to use this.<br>
> Though it might be less efficient than a numeric id, this might be a more<br>
> portable way than using the rdev hack.<br>
><br>
</div></div></blockquote></div><br></div>