for kern_conf.c, start allocating dynamic major numbers

half way through the range rather than possibly colliding with
fixed elements. Increase the size of the arrays to take this into account..
remember that each element in the array is now only 1 ponter  so this
isn't that much..

also note a possible bug in debugging code in uipc_socket2.c (add XXX)
This commit is contained in:
Julian Elischer 1996-08-19 19:22:26 +00:00
parent 072a289aa4
commit 313861b896
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17675
3 changed files with 17 additions and 13 deletions

View File

@ -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.9 1995/12/22 15:56:33 phk Exp $
* $Id: kern_conf.c,v 1.10 1996/07/23 21:52:06 phk Exp $
*/
#include <sys/param.h>
@ -39,8 +39,10 @@
#include <sys/conf.h>
#include <sys/vnode.h>
#define NUMCDEV 96
#define NUMBDEV 32
#define NUMBDEV 128
#define NUMCDEV 256
#define bdevsw_ALLOCSTART (NUMBDEV/2)
#define cdevsw_ALLOCSTART (NUMCDEV/2)
struct bdevsw *bdevsw[NUMBDEV];
int nblkdev = NUMBDEV;
@ -118,21 +120,21 @@ chrtoblk(dev_t dev)
* (re)place an entry in the bdevsw or cdevsw table
* return the slot used in major(*descrip)
*/
#define ADDENTRY(TTYPE,NXXXDEV) \
#define ADDENTRY(TTYPE,NXXXDEV,ALLOCSTART) \
int TTYPE##_add(dev_t *descrip, \
struct TTYPE *newentry, \
struct TTYPE **oldentry) \
{ \
int i ; \
if ( (int)*descrip == -1) { /* auto (0 is valid) */ \
if ( (int)*descrip == NODEV) { /* auto (0 is valid) */ \
/* \
* Search the table looking for a slot... \
*/ \
for (i = 0; i < NXXXDEV; i++) \
for (i = ALLOCSTART; i < NXXXDEV; i++) \
if (TTYPE[i] == NULL) \
break; /* found one! */ \
/* out of allocable slots? */ \
if (i == NXXXDEV) { \
if (i >= NXXXDEV) { \
return ENFILE; \
} \
} else { /* assign */ \
@ -155,8 +157,10 @@ int TTYPE##_add(dev_t *descrip, \
return 0; \
} \
ADDENTRY(bdevsw, nblkdev)
ADDENTRY(cdevsw, nchrdev)
ADDENTRY(bdevsw, nblkdev,bdevsw_ALLOCSTART)
ADDENTRY(cdevsw, nchrdev,cdevsw_ALLOCSTART)
/* Maybe the author might indicate what the f*@# tehis is for? */
void
cdevsw_make(struct bdevsw *from)

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
* $Id: uipc_socket2.c,v 1.10 1996/06/12 05:07:35 gpalmer Exp $
* $Id: uipc_socket2.c,v 1.12 1996/07/11 16:31:59 wollman Exp $
*/
#include <sys/param.h>
@ -446,7 +446,7 @@ sbcheck(sb)
for (m = sb->sb_mb; m; m = m->m_next) {
len += m->m_len;
mbcnt += MSIZE;
if (m->m_flags & M_EXT)
if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */
mbcnt += m->m_ext.ext_size;
if (m->m_nextpkt)
panic("sbcheck nextpkt");

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
* $Id: uipc_socket2.c,v 1.10 1996/06/12 05:07:35 gpalmer Exp $
* $Id: uipc_socket2.c,v 1.12 1996/07/11 16:31:59 wollman Exp $
*/
#include <sys/param.h>
@ -446,7 +446,7 @@ sbcheck(sb)
for (m = sb->sb_mb; m; m = m->m_next) {
len += m->m_len;
mbcnt += MSIZE;
if (m->m_flags & M_EXT)
if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */
mbcnt += m->m_ext.ext_size;
if (m->m_nextpkt)
panic("sbcheck nextpkt");