Re: File questions: Head truncate? sharing FDs between procs?

From: Andreas Dilger (adilger@turbolabs.com)
Date: Tue May 23 2000 - 14:44:57 EST


Ian Nelson writes:
> I think I know the answer to this first question already. Is there a
> head trunc function? I don't think there is but you never know. The
> situation is like this: we've got a large file (multiple gigs) and at
> some point while still writing data to it we realize that we don't want
> the first 500MB so we want to trunc it off the front of the file will
> keeping it open and keep writing to it. Anyone want head trunc if I get
> strapped in to writing it?

We have written such a function (called "punch") which can arbitrarily
zero/remove data at the beginning/middle/end of a file. It is a superset
of normal truncate and the head truncate function you describe. The punch
code itself is complete and has been used in an application for a long
time, but there is a little work to do to get it up-to-speed for the
newer kernels, namely vmpunch() (which will be a superset of vmtruncate).

If you are interested in the current code, let me know.

Cheers, Andreas

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:24 EST