Subject: Re: Explanation of the EBUSY error on device opening, bugs to fix
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/28/2001 15:38:36
> [...EBUSY...chrtoblk...]
> Next bug: I was reading entry #61 of the table, whereas there are
> only 59 entries on macppc.

I found this the hard way myself, once.  Now, one of the things I do
when I start playing with a port is to do something like this to
chrtoblk (this is extracted directly from my private patch for
sys/arch/sparc/sparc/conf.c):

@@ -429,6 +461,8 @@
 {
        int blkmaj;
 
+       if ((sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0])) < nchrdev)
+               panic("chrtoblktbl too small for cdevsw");
        if (major(dev) >= nchrdev)
                return (NODEV);
        blkmaj = chrtoblktbl[major(dev)];

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B