Re: VFS 64-bit clean

Stephen C. Tweedie (
Thu, 26 Feb 1998 23:48:28 GMT


On Wed, 25 Feb 1998 22:37:48 +0200, Itai Nahshon <>

> What does Posix say about directory operations if the directory is
> changed (telldir, seekdir and readdir)? It will be difficult to
> guarantee
> any kind of consistency.

Nope --- we can store any context we need to do sequential scans in the
struct file internally to the kernel, and seekdir/telldir are not part
of POSIX so they needn't be a problem.

> Even if posix does not require anything, a program that reads a
> directory must be able to resynchronize to the next directory entry if
> the directory was modified beneath it.

Yes, and all that is required there is for the kernel to track an open
directory file object correctly --- the "cursor" used by the kernel to
keep the current pointer need not be made visible to the user, so this
is purely an implementation detail. For example, we could store (by
reference) the last dirent given to the user in the struct file, which
is sufficient to allow us to resume the search reliably at any point.
We can also store hint information (such as a sequence number and btree
index block) to optimise the common case where the btree nodes have not
changed from one readdir() to the next.

As for seekdir/telldir, if we do want to provide minimal compatibility
then I'd be happy to make telldir() return 0 every time, and make
seekdir() always seek back to the start of the directory. I imagine
that will cater for the vast majority of uses of these functions.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to