Date: Wed, 18 Aug 1999 08:46:09 -0400 (EDT) From: Bill Fumerola <billf@jade.chc-chimes.com> To: committers@FreeBSD.org, current@FreeBSD.org Subject: HEADS UP: devtoname Message-ID: <Pine.BSF.4.10.9908180845240.55279-100000@jade.chc-chimes.com>
next in thread | raw e-mail | index | archive | help
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 <grog@lemis.com> To: Bill Fumerola <billf@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9908180845240.55279-100000>