From 9b4ec8bad20283e6550e87d74b47f7fb55e096eb Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 8 May 2003 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2003-05-08 --- bitsy/wavelan.c | 25 ++++++++++++++++++------- boot/paq.c | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/bitsy/wavelan.c b/bitsy/wavelan.c index 7035f575..ecad1a93 100644 --- a/bitsy/wavelan.c +++ b/bitsy/wavelan.c @@ -557,11 +557,20 @@ w_scaninfo(Ether* ether, Ctlr *ctlr, int len) Netfile **ep, *f, **fp; Block *bp; WScan *wsp; + ushort *scanbuf; + scanbuf = malloc(len*2); + if(scanbuf == nil) + return; + for (i = 0; i < len ; i++) - ctlr->scanbuf[i] = csr_ins(ctlr, WR_Data1); + scanbuf[i] = csr_ins(ctlr, WR_Data1); + + /* calculate number of samples */ + len /= 25; + if(len == 0) + goto out; - len *= 2; i = ether->scan; ep = ðer->f[Ntypes]; for(fp = ether->f; fp < ep && i > 0; fp++){ @@ -569,14 +578,14 @@ w_scaninfo(Ether* ether, Ctlr *ctlr, int len) if(f == nil || f->scan == 0) continue; - bp = iallocb(2048); + bp = iallocb(100*len); if(bp == nil) break; - for(j = 0; j < len/(2*25); j++){ - wsp = (WScan*)(&ctlr->scanbuf[j*25]); + for(j = 0; j < len; j++){ + wsp = (WScan*)(&scanbuf[j*25]); if(wsp->ssid_len > 32) wsp->ssid_len = 32; - bp->wp += snprint((char*)bp->wp, 2048, + bp->wp = (uchar*)seprint((char*)bp->wp, (char*)bp->lim, "ssid=%.*s;bssid=%E;signal=%d;noise=%d;chan=%d%s\n", wsp->ssid_len, wsp->ssid, wsp->bssid, wsp->signal, wsp->noise, wsp->chan, (wsp->capinfo&(1<<4))?";wep":""); @@ -584,6 +593,8 @@ w_scaninfo(Ether* ether, Ctlr *ctlr, int len) qpass(f->in, bp); i--; } +out: + free(scanbuf); } static int @@ -1197,7 +1208,7 @@ wavelanreset(Ether* ether, Ctlr *ctlr) ether->scanbs = w_scanbs; ether->arg = ether; - DEBUG("#l%d: irq %ld port %lx type %s", + DEBUG("#l%d: irq %lud port %lx type %s", ether->ctlrno, ether->intnum, ether->ports[0].port, ether->type); DEBUG(" %2.2uX%2.2uX%2.2uX%2.2uX%2.2uX%2.2uX\n", ether->ea[0], ether->ea[1], ether->ea[2], diff --git a/boot/paq.c b/boot/paq.c index c5d10a86..f404e5bb 100644 --- a/boot/paq.c +++ b/boot/paq.c @@ -8,7 +8,7 @@ char *fparts[] = "add params 0x0040000 0x0080000", "add kernel 0x0080000 0x0140000", "add user 0x0140000 0x0200000", - "add ramdisk 0x0200000 0x0800000", + "add ramdisk 0x0200000 0x0c00000", }; void