Can directory files have holes in them ?
Chris Torek
chris at mimsy.UUCP
Sun Oct 8 01:32:41 AEST 1989
In article <1240 at virtech.UUCP> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>[someone's] example shows a regular file with holes in it. The
>original poster was asking about a directory file with holes in it. I,
>for one, cannot figure any way you could get holes in a directory
>because the mechanism to generate holes is to lseek beyond the end of
>the file and write some information, thereby generating a hole between
>the old end of the file and the new data (assuming there was at least 1
>full block between the two.
Well, actually, it is by setting an offset (uio->uio_offset, or
u.u_offset in other kernels) sufficiently large so that when bwrite()
calls bmap(), and bmap() finds there is no data block for the given
offset, and the kernel allocates one, that one happens to be `after' an
offset that also has no data block. (Sometimes necessary indirect
blocks are also missing, and the allocation gets complicated, but it
all works out the same.)
Anyway, holes in a directory would be invalid in 4.2 and 4.3BSD because
the d_reclen field should never be zero.
The original question was why dump is careful not to look at holes
in directories. The only possible answer is `paranoia'.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list