RE: [question]

Jeremy Fitzhardinge (jeremy@goop.org)
Mon, 18 Jan 1999 16:13:18 -0800 (PST)


On 18-Jan-99 kees wrote:
> d_reclen is *very* different from the strlen of the entry. I would expect
> d_reclen to be equal to the strlen result. d_recelen seems to return the
> number of bytes of allocation in the directory file, these are multiple
> of 4 . 32 bits INTS.

Yes. For ext2 and other "normal" filesystems, reclen is the size of the entry
on disk. It isn't really a useful thing to know from user-mode, other than
using it to manually read the directory (if the filesystem allows) and
calculate seek offsets.

Other than always being bigger than the name length, there's nothing much you
can rely on about the reclen. The reclen can be much larger than the space
needed by the entry, because it also encompasses free space in the directory.

> In the GNU C_library in the function getcwd d_reclen (d_namelen) is used
> to build the pathname which sometimes give odd results i.e. somewhere in a
> mounted NCP or Samba tree.
> If one uses 'less' or 'vi' or '/bin/pwd' these programs complain that they
> are unable to find the current working directory.

reclen is never usable instead of namelen. Any software which uses reclen for
the name length is broken.

J

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/