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

Stef Bon stefbon at gmail.com
Tue Mar 13 17:13:11 PDT 2012


2012/3/14 François Revol <revol at free.fr>:
> On -10/01/-28163 20:59, Trans wrote:
>> On Tue, Mar 13, 2012 at 6:42 AM, Stef Bon <stefbon at gmail.com> wrote:
>>> Below is the
>>> message about storing information in the st.st_rdev field, which is
>>> not used for "normal" files and directories. I did not get a reply
>>> there, so I better post it here. What about it?
>>>
>>>
>>>
>>
>> BIG FAT +1
>>
>> I have thought for a long time now that file systems are way behind the
>> times without a type field.
>
> Depending how and where you want this, it will cause trouble...
>
> cause:
> a) it's not in POSIX.

what do you mean?? My suggestion is about storing a type id in the
st_rdev field part of stat. Is the standard stat not part of POSIX?

> b) we don't all agree on mime types for directories and other things...
> BeOS used application/x-vnd.Be-directory since long before any desktop
> on GNU/Linux even considered using mime types...

Well, that's not a problem. When translating the mimetype id found in
st.st_rdev, it's up to the platform you are working on, in which
mimetype specification to translate that. For Linux this (and this is
a suggestion, nothing final) would be for directories:

100        local.map.documents
101        local.map.audio
102        local.map.video

etcetera

The full mimetype for a directory is then:

mimetype="inode/directory;role=local.map.audio"

This mimetype is linked to an icon, possibly with a default and
configurable per user.

On a BeOS this would be translated in something else, but that's
possible. I do not know BeOS. The id in the file is the same. A mp3
file is on a BeOS file also a mp3 file, just like it is on any other
system right?

And yes, I think this has to be done on slow filesystems, and network
filesystems (or via Internet) this is sadly still the case.
Filesystems themselves do not have to do anything about it, only
having the ability to store an id in st_rdev. When the file is
created/moved this field has to be set.


Stef


More information about the xdg mailing list