From owner-freebsd-current@FreeBSD.ORG Sat Feb 7 14:42:31 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F83616A4CE for ; Sat, 7 Feb 2004 14:42:31 -0800 (PST) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2354B43D1D for ; Sat, 7 Feb 2004 14:42:31 -0800 (PST) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.10/8.12.10) with ESMTP id i17MgKVi032345; Sat, 7 Feb 2004 17:42:25 -0500 (EST) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i17IgWdT030078; Sat, 7 Feb 2004 13:42:32 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Sat, 7 Feb 2004 13:42:31 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Poul-Henning Kamp In-Reply-To: <11313.1076174567@critter.freebsd.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: REVIEW: #define NODEV NULL (kernel only) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Feb 2004 22:42:31 -0000 On Sat, 7 Feb 2004, Poul-Henning Kamp wrote: > I am inching my way towards reference counted dev_t's in the kernel, and > part of this is to allow make_dev() to fail if we are short on > resources. > > To that end I would really like to get rid of the magic definition of > NODEV that we use in the kernel (which I belive is not even kosher C ?), > and simply substitute a NULL for a non-existent dev_t. > > Any objections to this patch ? No objections to this patch (which is definitely a good thing), but I am worried that letting make_dev() fail might open a can of worms. Or at least, lead to some confusion as to how to manage the failure mode. However, given that I think we need to have the dev_t storage owned by the kernel rather than the modules, I'm not sure there's much choice in the approach. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Senior Research Scientist, McAfee Research > Poul-Henning > > Index: sys/param.h > =================================================================== > RCS file: /home/ncvs/src/sys/sys/param.h,v > retrieving revision 1.178 > diff -u -r1.178 param.h > --- sys/param.h 30 Jan 2004 13:43:51 -0000 1.178 > +++ sys/param.h 7 Feb 2004 17:07:48 -0000 > @@ -189,10 +189,12 @@ > #define NBPW sizeof(int) /* number of bytes per word (integer) */ > > #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ > -#define NODEV (dev_t)(-1) /* non-existent device */ > #ifdef _KERNEL > +#define NODEV NULL > #define NOUDEV (udev_t)(-1) /* non-existent device */ > #define NOMAJ 256 /* non-existent device */ > +#else > +#define NODEV (dev_t)(-1) > #endif > > #define CBLOCK 128 /* Clist block size, must be a power of 2. */ > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >