- /*
- * Both address and size must be
- * positive, or the protocol has broken down.
- */
- if (addr <= 0 || size <= 0)
- goto badrmfree;
- /*
- * Locate the piece of the map which starts after the
- * returned space (or the end of the map).
- */
- firstbp = bp = (struct mapent *)(mp + 1);
- for (; bp->m_addr <= addr && bp->m_size != 0; bp++)
- continue;
- /*
- * If the piece on the left abuts us,
- * then we should combine with it.
- */
- if (bp > firstbp && (bp-1)->m_addr+(bp-1)->m_size >= addr) {
- /*
- * Check no overlap (internal error).
- */
- if ((bp-1)->m_addr+(bp-1)->m_size > addr)
- goto badrmfree;
- /*
- * Add into piece on the left by increasing its size.
- */
- (bp-1)->m_size += size;
- /*
- * If the combined piece abuts the piece on
- * the right now, compress it in also,
- * by shifting the remaining pieces of the map over.
- */
- if (bp->m_addr && addr+size >= bp->m_addr) {
- if (addr+size > bp->m_addr)
- goto badrmfree;
- (bp-1)->m_size += bp->m_size;
- while (bp->m_size) {
- bp++;
- (bp-1)->m_addr = bp->m_addr;
- (bp-1)->m_size = bp->m_size;
- }
+ for (ip = dmp->dm_map; dmp->dm_alloc > 0; ip++) {
+ if (ip - dmp->dm_map >= NDMAP) {
+ error("vsacct NDMAP");
+ break;
+ }
+ if (*ip == 0)
+ error("vsacct *ip == 0");
+ buckets[swatodev(*ip)][index]++;
+ dmp->dm_alloc -= blk;
+ if (blk < dmmax) {
+ blk *= 2;
+ index++;