From owner-freebsd-hackers Tue Sep 16 00:13:44 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id AAA21873 for hackers-outgoing; Tue, 16 Sep 1997 00:13:44 -0700 (PDT) Received: from cicero.cybercity.dk (cicero.cybercity.dk [195.8.128.13]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id AAA21852 for ; Tue, 16 Sep 1997 00:13:38 -0700 (PDT) Received: from schizo.dk.tfs.com (mail.trw.dk [195.8.133.123]) by cicero.cybercity.dk (8.8.5/8.8.5) with ESMTP id JAA05841; Tue, 16 Sep 1997 09:07:46 +0200 (CEST) Received: from critter.freebsd.dk (critter.dk.tfs.com [140.145.230.252]) by schizo.dk.tfs.com (8.8.7/8.7.3) with ESMTP id JAA07946; Tue, 16 Sep 1997 09:05:00 +0200 (MET DST) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.8.7/8.8.7) with ESMTP id IAA00273; Tue, 16 Sep 1997 08:18:25 +0200 (CEST) To: Eivind Eklund cc: hackers@FreeBSD.ORG Subject: Re: Pre-conditions (was Re: cvs commit: src/sys/nfs nfs_vnops.c) In-reply-to: Your message of "Tue, 16 Sep 1997 01:32:28 +0200." <199709152332.BAA25440@bitbox.follo.net> Date: Tue, 16 Sep 1997 08:18:25 +0200 Message-ID: <271.874390705@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk In message <199709152332.BAA25440@bitbox.follo.net>, Eivind Eklund writes: > >> Modified files: >> sys/nfs nfs_vnops.c >> Log: >> Don't repeat checks done at general level. > >On a fairly general level: I'd have changed these to consistency >checks enclosed in #if DEBUG/#endif, and a panic (lacking a good >standardized assert facility; assert() is message-less and thus not >good enough). I like to make 'each routine its own castle' in >debugging mode, not trusting ANYTHING that is passed in from anywhere. > >How is this for other people? Is that considered unnecessary >cluttering of the sources? Done correctly, I find it a very good form >of documentation of each functions pre-conditions (and possibly >post-conditions/invariants, but that is much more clutter). If circumstances warrant it, ie: you suspect a problem in that area, by all means go ahead. If there is no sign of trouble, don't clutter the sources. In this particular case we're talkink about checks done against the vnodes, ie the generic layer, they belong in the generic layer, not in the individual filesystems. -- Poul-Henning Kamp FreeBSD coreteam member phk@FreeBSD.ORG "Real hackers run -current on their laptop."