Casper.Dik at sun.com wrote:
>
> >It would be possible to introduce a new getdents() call that produces
> >a different format. Older applications would use the old getdents() call.
>
> The getdents() call returns a structure which looks like:
>
> typedef struct dirent {
> ino_t d_ino; /* "inode number" of entry */
> off_t d_off; /* offset of disk directory entry */
> unsigned short d_reclen; /* length of this record */
> char d_name[1]; /* name of file */
> } dirent_t;
>
> It's easy to store the little bit of additional information by
> bumping d_reclen and adding it add the end.
>
> This would not be noticable as the name is NUL terminated and we
> control all the getdents return paths in the kernel.
>
> For the readdir() call it gets trickier but still not impossible.
Du you like to use strlen in the access macro?
How do you like to distinguish between both formats in special
if there may be padding?
FreeBSD uses
struct dirent {
__uint32_t d_fileno; /* file number of entry */
__uint16_t d_reclen; /* length of this record */
__uint8_t d_type; /* file type, see below */
__uint8_t d_namlen; /* length of string in d_name */
#if __BSD_VISIBLE
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
#else
char d_name[255 + 1]; /* name must be no longer than this */
#endif
};
where the definition of d_name looks questionalble in special as it is
desirable to increase MAXNAMELEN as I did already mention before
while discussing the needs of Joliet CDs/DVDs.
J?rg
--
EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin
js at cs.tu-berlin.de (uni)
schilling at fokus.fraunhofer.de (work) Blog:
http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily