From owner-freebsd-current Wed Aug 18 6:45:25 1999 Delivered-To: freebsd-current@freebsd.org Received: from jade.chc-chimes.com (jade.chc-chimes.com [216.28.46.6]) by hub.freebsd.org (Postfix) with ESMTP id 358DB14D82; Wed, 18 Aug 1999 06:44:30 -0700 (PDT) (envelope-from billf@jade.chc-chimes.com) Received: by jade.chc-chimes.com (Postfix, from userid 1001) id 489011C19; Wed, 18 Aug 1999 08:46:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by jade.chc-chimes.com (Postfix) with ESMTP id 3A2F13823; Wed, 18 Aug 1999 08:46:09 -0400 (EDT) Date: Wed, 18 Aug 1999 08:46:09 -0400 (EDT) From: Bill Fumerola To: committers@FreeBSD.org, current@FreeBSD.org Subject: HEADS UP: devtoname Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG As a result of a discussion between myself, Bruce Evans, and Poul-Henning Kemp, there now exists a kernel function: char *devtoname (dev_t dev) Use it like so: printf("dev: %s", devtoname(dev)); Intead of the previous: printf("dev: %x", dev); Using the old format will only print a pointer that will be of no use after an error has occured. Developers who are using a debugger wouldn't need this debug message anyways, so the memory address is of use to no-one. Examples of how to fix existing code has been committed in cam/scsi/scsi_pt.c and i386/isa/spkr.c, though I'm sure there exists a plethora of old code which uses the old style. The function was written by phk. -- - bill fumerola - billf@chc-chimes.com - BF1560 - computer horizons corp - - ph:(800) 252-2421 - bfumerol@computerhorizons.com - billf@FreeBSD.org - ---------- Forwarded message ---------- Date: Wed, 18 Aug 1999 08:48:08 +0930 From: Greg Lehey To: Bill Fumerola Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: HEADS UP: devtoname (was: cvs commit: src/sys/cam/scsi scsi_pt.c src/sys/sys conf.h src/sys/i386/isa spkr.c src/sys/kern kern_conf.c) On Tuesday, 17 August 1999 at 13:25:51 -0700, Bill Fumerola wrote: > billf 1999/08/17 13:25:50 PDT > > Modified files: > sys/cam/scsi scsi_pt.c > sys/sys conf.h > sys/i386/isa spkr.c > sys/kern kern_conf.c > Log: > Welcome devtoname(), to most likely be used when printing information > about a dev_t. > > printf("%x", dev) now becomes printf("%s", devtoname(dev)) because > printing actual information about the device is much more useful then > printing a pointer to an address that would never help the developer debug. This is nice stuff. I think it's worth a heads up. It's far too easy to miss this kind of thing in the daily flood of updated $Id$ strings. Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message