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

Thiago Macieira thiago at kde.org
Mon Mar 19 02:53:17 PDT 2012


On segunda-feira, 19 de março de 2012 12.43.37, PCMan wrote:
> 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
> shared-mime-database.
> 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?

Even before that: how does one set the st_rdev field to anything? There is no 
setter function counterpart to stat. Changing the file size involves writing to 
it; changing the UID and GID are done by chown and chgrp; the mode with chmod; 
the times are done with utime and utimes.

I don't remember any function that sets the st_rdev field aside from mknod.

Moreover, I don't see any guarantee that the filesystem has room for the 
st_rdev field for regular files in its on-disk format.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20120319/b5321e31/attachment.pgp>


More information about the xdg mailing list