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. Submitted by: phk, bde
This commit is contained in:
parent
14bbfc5ddc
commit
b8e49f681b
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: scsi_pt.c,v 1.9 1999/05/30 16:51:05 phk Exp $
|
||||
* $Id: scsi_pt.c,v 1.10 1999/05/31 11:24:07 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -159,7 +159,7 @@ ptopen(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
}
|
||||
|
||||
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE,
|
||||
("ptopen: dev=0x%x (unit %d)\n", dev, unit));
|
||||
("ptopen: dev=%s (unit %d)\n", devtoname(dev), unit));
|
||||
|
||||
if ((error = cam_periph_lock(periph, PRIBIO|PCATCH)) != 0) {
|
||||
splx(s);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
|
||||
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
|
||||
*
|
||||
* $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
|
||||
* $Id: spkr.c,v 1.37 1999/05/31 11:26:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include "speaker.h"
|
||||
@ -480,7 +480,7 @@ spkropen(dev, flags, fmt, p)
|
||||
struct proc *p;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
(void) printf("spkropen: entering with dev = %x\n", dev);
|
||||
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
@ -506,8 +506,8 @@ spkrwrite(dev, uio, ioflag)
|
||||
int ioflag;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("spkrwrite: entering with dev = %x, count = %d\n",
|
||||
dev, uio->uio_resid);
|
||||
printf("spkrwrite: entering with dev = %s, count = %d\n",
|
||||
devtoname(dev), uio->uio_resid);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
@ -539,7 +539,7 @@ spkrclose(dev, flags, fmt, p)
|
||||
struct proc *p;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
(void) printf("spkrclose: entering with dev = %x\n", dev);
|
||||
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
|
||||
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
|
||||
*
|
||||
* $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
|
||||
* $Id: spkr.c,v 1.37 1999/05/31 11:26:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include "speaker.h"
|
||||
@ -480,7 +480,7 @@ spkropen(dev, flags, fmt, p)
|
||||
struct proc *p;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
(void) printf("spkropen: entering with dev = %x\n", dev);
|
||||
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
@ -506,8 +506,8 @@ spkrwrite(dev, uio, ioflag)
|
||||
int ioflag;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("spkrwrite: entering with dev = %x, count = %d\n",
|
||||
dev, uio->uio_resid);
|
||||
printf("spkrwrite: entering with dev = %s, count = %d\n",
|
||||
devtoname(dev), uio->uio_resid);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
@ -539,7 +539,7 @@ spkrclose(dev, flags, fmt, p)
|
||||
struct proc *p;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
(void) printf("spkrclose: entering with dev = %x\n", dev);
|
||||
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (minor(dev) != 0)
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_conf.c,v 1.56 1999/08/13 10:29:20 phk Exp $
|
||||
* $Id: kern_conf.c,v 1.57 1999/08/15 09:32:47 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -309,3 +309,10 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, char
|
||||
return (dev);
|
||||
}
|
||||
|
||||
char *
|
||||
devtoname(dev_t dev)
|
||||
{
|
||||
|
||||
return (dev->si_name);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.73 1999/08/14 11:40:49 phk Exp $
|
||||
* $Id: conf.h,v 1.74 1999/08/15 09:32:44 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -263,6 +263,7 @@ int cdevsw_remove __P((struct cdevsw *old));
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
struct cdevsw *devsw __P((dev_t dev));
|
||||
int devsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
char *devtoname __P((dev_t dev));
|
||||
int iskmemdev __P((dev_t dev));
|
||||
int iszerodev __P((dev_t dev));
|
||||
dev_t makebdev __P((int maj, int min));
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.73 1999/08/14 11:40:49 phk Exp $
|
||||
* $Id: conf.h,v 1.74 1999/08/15 09:32:44 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -263,6 +263,7 @@ int cdevsw_remove __P((struct cdevsw *old));
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
struct cdevsw *devsw __P((dev_t dev));
|
||||
int devsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
char *devtoname __P((dev_t dev));
|
||||
int iskmemdev __P((dev_t dev));
|
||||
int iszerodev __P((dev_t dev));
|
||||
dev_t makebdev __P((int maj, int min));
|
||||
|
Loading…
x
Reference in New Issue
Block a user