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

Stef Bon stefbon at gmail.com
Mon Mar 19 14:56:49 PDT 2012


2012/3/19 Thiago Macieira <thiago at kde.org>:
> On segunda-feira, 19 de março de 2012 12.43.37, PCMan wrote:
>
>
> 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.

Yes, that's an issue. Getting the value is easy, setting is something else.
I do not know any method/call to do that either.

>
> 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.
>

That's also true, but maybe that is not a problem. The way stat is
stored is in most cases generic I think, and does not differ between
different types of files. But I'm not sure about that.

Stef


More information about the xdg mailing list