How do you find the symbolic links to files.

Tom Christiansen tchrist at convex.COM
Thu Dec 6 06:32:58 AEST 1990


In article <1990Dec5.052124.28435 at erg.sri.com> zwicky at erg.sri.com (Elizabeth Zwicky) writes:
>Unfortunately, you
>have to get pretty intimate with the disk to tell that the 20 meg of
>nulls aren't there (well, it's not that unfortunate, since it is
>rather the point of the exercise, but it is at times inconvenient).

Naw, it's not that hard.  If you really want to, you could compare the
size fields with the blocks field returns by stat(2) and by this derive
holey ideas.  Or (as I prefer) for applications that are trying to
minimize space used (cp should have a flag for this; -z on a few systems),
you don't care whether a block of zeroes was or wasn't there: you want to
make it a whole to save space.  Check each block before you write it, and
just lseek ahead if it's all null.  

This works on a disk for copying files, but won't do you much good on a
tape, where some other scheme would have to worked out.  I've heard that
GNU tar does the right thing here.  You want the option because you may
judge this too much overhead for the default operation.  Of course, having
vector compare instructions to check that it's all zeroes speeds this up a
bit. :-)

--tom
--
Tom Christiansen		tchrist at convex.com	convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
 to look at yourself in the mirror the next morning."  -me



More information about the Comp.unix.internals mailing list