Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.internals Subject: Re: How do you find the symbolic links to files. Message-ID: <109886@convex.convex.com> Date: 5 Dec 90 19:32:58 GMT References: <25146@adm.brl.mil> <1990Dec5.052124.28435@erg.sri.com> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 26 In article <1990Dec5.052124.28435@erg.sri.com> zwicky@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@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