Update natm PCB debugging code:
- Depend on opt_ddb.h, since npcb_dump() is ifdef'd DDB. - Include ddb/ddb.h so we can call db_printf() and use DB_SHOW_COMMAND(). - Don't test results of malloc() under DIAGNOSTIC, let the memory allocator take care of its own invariants. MFC after: 1 month
This commit is contained in:
parent
04f2073775
commit
3f0c18fdda
@ -36,12 +36,15 @@
|
||||
* from trying to use each other's VCs.
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
@ -51,6 +54,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <netnatm/natm.h>
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
struct npcblist natm_pcbs;
|
||||
|
||||
/*
|
||||
@ -63,12 +68,6 @@ npcb_alloc(int wait)
|
||||
struct natmpcb *npcb;
|
||||
|
||||
npcb = malloc(sizeof(*npcb), M_PCB, wait | M_ZERO);
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (wait == M_WAITOK && npcb == NULL)
|
||||
panic("npcb_alloc: malloc didn't wait");
|
||||
#endif
|
||||
|
||||
if (npcb != NULL)
|
||||
npcb->npcb_flags = NPCB_FREE;
|
||||
return (npcb);
|
||||
@ -150,20 +149,16 @@ npcb_add(struct natmpcb *npcb, struct ifnet *ifp, u_int16_t vci, u_int8_t vpi)
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
|
||||
int
|
||||
npcb_dump(void)
|
||||
DB_SHOW_COMMAND(natm, db_show_natm)
|
||||
{
|
||||
struct natmpcb *cpcb;
|
||||
|
||||
printf("npcb dump:\n");
|
||||
db_printf("npcb dump:\n");
|
||||
LIST_FOREACH(cpcb, &natm_pcbs, pcblist) {
|
||||
printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, "
|
||||
"inq=%d\n", cpcb->npcb_ifp->if_xname, cpcb->npcb_vci,
|
||||
cpcb->npcb_vpi, cpcb->ipaddr.s_addr, cpcb->npcb_socket,
|
||||
cpcb->npcb_flags, cpcb->npcb_inq);
|
||||
db_printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, "
|
||||
"flags=0x%x, inq=%d\n", cpcb->npcb_ifp->if_xname,
|
||||
cpcb->npcb_vci, cpcb->npcb_vpi, cpcb->ipaddr.s_addr,
|
||||
cpcb->npcb_socket, cpcb->npcb_flags, cpcb->npcb_inq);
|
||||
}
|
||||
printf("done\n");
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user