Re: [PATCH] ramfs: pretend dirent sizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Blunck wrote:


Also, how is lseek + readdir supposed to work in general?


This is how libc is reading directories (at least on arch s390x):

getdents() != 0
lseek() to d_off of last dirent
getdents() != 0
lseek() to d_off of last dirent
getdents() == 0
return

Therefore I really need values that make sense for d_off. Therefore I really need values that make (some kind of) sense for i_size.


Please be aware that not all filesystems treat directories as sequential
files, filled with with odd sized records.  Some directories are distributed
across the entire file system and the d_off fields really contain the
address on disk of the next entry in the directory. The d_off field is really
just a cookie and is not meant to be interpreted as an offset into the
directory.  The lseek() system call is used, but only because that was a
handy way of positioning the pointer into the directory.  It is unfortunate
that the getdents(2) system call was not defined with a cookie as one of
its arguments to indicate where to start fetching entries from.  This would
have reduced the confusion about treating directories as files or not.

   Thanx...

      ps
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux