Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 28 Feb 2002 21:37:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 28 Feb 2002 21:31:22 -0500 Received: from dsl-213-023-038-171.arcor-ip.net ([213.23.38.171]:36240 "EHLO starship.berlin") by vger.kernel.org with ESMTP id ; Thu, 28 Feb 2002 21:28:02 -0500 Content-Type: text/plain; charset=US-ASCII From: Daniel Phillips To: Erik Mouw , Alan Cox Subject: Re: read_proc issue Date: Wed, 27 Feb 2002 04:19:35 +0100 X-Mailer: KMail [version 1.3.2] Cc: Val Henson , "Randy.Dunlap" , Laurent , linux-kernel@vger.kernel.org In-Reply-To: <20020227140432.L20918@boardwalk> <20020228000532.GA8858@arthur.ubicom.tudelft.nl> In-Reply-To: <20020228000532.GA8858@arthur.ubicom.tudelft.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Message-Id: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On February 28, 2002 01:05 am, Erik Mouw wrote: > On Wed, Feb 27, 2002 at 09:42:04PM +0000, Alan Cox wrote: > > > I've encountered this problem before, too. What is the "One True Way" > > > to do this cleanly? In other words, if you want to do a calculation > > > once every time someone runs "cat /proc/foo", what is the cleanest way > > > to do that? The solution we came up with was to check the file offset > > > and only do the calculation if offset == 0, which seems pretty > > > hackish. > > > > Another approach is to do the calculation open and remember it in per > > fd private data. You can recover that and free it on release. It could > > even be a buffer holding the actual "content" > > It might also be an idea to export proc_calc_metrics() from > fs/proc/proc_misc.c because quite a lot of code actually tries to do > exactly the same. Look at all the parameters, they're trying to be a struct. How about cleaning it up before exporting? -- Daniel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/