From owner-freebsd-hackers Tue Jan 14 18:57:19 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id SAA29120 for hackers-outgoing; Tue, 14 Jan 1997 18:57:19 -0800 (PST) Received: from pdx1.world.net (pdx1.world.net [192.243.32.18]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id SAA29114 for ; Tue, 14 Jan 1997 18:57:16 -0800 (PST) From: proff@suburbia.net Received: from suburbia.net (suburbia.net [203.4.184.1]) by pdx1.world.net (8.7.5/8.7.3) with SMTP id SAA08767 for ; Tue, 14 Jan 1997 18:57:59 -0800 (PST) Received: (qmail 25675 invoked by uid 110); 15 Jan 1997 02:56:30 -0000 Message-ID: <19970115025630.25674.qmail@suburbia.net> Subject: cyclic file type In-Reply-To: <199701150000.RAA02388@phaeton.artisoft.com> from Terry Lambert at "Jan 14, 97 05:00:14 pm" To: terry@lambert.org (Terry Lambert) Date: Wed, 15 Jan 1997 13:56:30 +1100 (EST) Cc: hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > It's quite easy actually. There are two ways: > > > > (a) always truncate by the size of the last write. > > (b) define the cycle period to be a multiple of > > the record size. > > This will work if the record size does not vary. Yes, I'm presuming this. > > This also assumes that you are truncating on character, not block > boundries, or that the structures are some even log2 of the block > size (if you truncate on block boundries). > > Having a file specific truncator that just shifted records down > in the file, on record boundries, would undoubtedly work, but you > would need NULLFS working for you to derive a layer so that you > could hide it happening, at the user level. NULLFS-current is working for me, at least for an anon ftp mount. I think you are looking at this at too low a level. If we mandate that CYCLIC files are not mmapable (which seems a fair presumption), and store a pointer to the current beginning of the file within the cycle region then why not merely modify read, write and lseek to recalculate offsets relative to this pointer? Boundaries are only a little more problematic, requiring two split reads or two split writes to cover the wrap. By "truncate" I wasn't actually referring to literal forward truncation, but the changing of a high-level start-of-cycle pointer, as per a cyclic stack. Cheers, Julian.