Path: utzoo!attcan!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.internals Subject: Re: How do you find the symbolic links to files. Message-ID: <1990Dec13.203926.24216@athena.mit.edu> Date: 13 Dec 90 20:39:26 GMT References: <1990Dec7.192441.24778@dg-rtp.dg.com> <2469:Dec1001:13:4390@kramden.acf.nyu.edu> <1990Dec10.191522.2757@erg.sri.com> <2993:Dec1202:37:2090@kramden.acf.nyu.edu> <1990Dec12.174807.12868@specialix.co.uk> Sender: news@athena.mit.edu (News system) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 30 In article <1990Dec12.174807.12868@specialix.co.uk>, jonb@specialix.co.uk (Jon Brawn) writes: |> (This isn't a flame, I'm quite serious now!) |> Can anyone think up a good use for looking at the st_blocks field? I'm not sure whether you mean any use in general, or a use specifically related to backup and restore, since that's what's being discussed here. If you mean the former, then I can give you one way st_blocks is used. The expunge program in my undel2 package (available at a comp.sources.unix archive site near you, in volume22, make sure to also get "et" in the same volume :-) has options to report the amount of space made free by the expunging of each file, and the total amount of space freed after all appropriate files are expunged. It does this by multiplying the number of blocks (st_blocks) for each file by DEV_BSIZE (from and dividing by 1024 to get kilobytes instead of bytes (Yes, I should probably be calling statfs on the filesystem instead of using DEV_BSIZE, but it hasn't been a problem up to this point :-). The point of this is that when someone expunges files, they want to know how much space was actually freed, not what the total size of all the files in the filesystem is. Those two values would differ in the case of files with holes in them, and in the much more common case of files which are not exactly a multiple of the block size in length, since the space in the partially unfilled block at the end of a file is wasted. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710