Skip to content

Commit

Permalink
4517853 debug.h should include macros to assert implication and equiv…
Browse files Browse the repository at this point in the history
…alence

6915090 struct memlist should have ml_ member prefixes
  • Loading branch information
Jonathan Adams authored and Jonathan Adams committed Jan 13, 2010
1 parent 9217f8f commit 56f3320
Show file tree
Hide file tree
Showing 54 changed files with 1,248 additions and 1,249 deletions.
9 changes: 4 additions & 5 deletions usr/src/cmd/mdb/common/modules/genunix/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -667,8 +667,7 @@ pagelookup_help(void)
" %<b>vp%</b>::pagelookup -o %<b>offset%</b>\n"
" %<b>offset%</b>::pagelookup -v %<b>vp%</b>\n"
"\n"
"The latter two forms are useful in pipelines.\n"
);
"The latter two forms are useful in pipelines.\n");
}

int
Expand Down Expand Up @@ -863,7 +862,7 @@ memlist_walk_step(mdb_walk_state_t *wsp)
return (WALK_ERR);
}

wsp->walk_addr = (uintptr_t)ml.next;
wsp->walk_addr = (uintptr_t)ml.ml_next;

return (wsp->walk_callback(mlp, &ml, wsp->walk_cbdata));
}
Expand Down Expand Up @@ -919,7 +918,7 @@ memlist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_ERR);
}

mdb_printf("%0?lx %16llx %16llx\n", addr, ml.address, ml.size);
mdb_printf("%0?lx %16llx %16llx\n", addr, ml.ml_address, ml.ml_size);

return (DCMD_OK);
}
Expand Down
18 changes: 8 additions & 10 deletions usr/src/psm/stand/boot/sparc/common/bootprop.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include <sys/types.h>
#include <sys/promif.h>
#include <sys/bootconf.h>
Expand Down Expand Up @@ -135,16 +133,16 @@ bgetproplen(struct bootops *bop, char *name)
strequal(name, p->name))) {

for (ml = *((struct memlist **)p->val);
ml != NIL;
ml = ml->next)
ml != NIL;
ml = ml->ml_next)

/*
* subtract out the ptrs for our local
* linked list. The application will
* only see an array.
*/
size += (int)(sizeof (struct memlist) -
2*sizeof (struct memlist *));
2*sizeof (struct memlist *));
return (size);

} else if (strequal(name, p->name)) {
Expand Down Expand Up @@ -209,12 +207,12 @@ bgetprop(struct bootops *bop, char *name, void *buf)
u_longlong_t *t = buf;

for (ml = *((struct memlist **)p->val);
ml != NIL;
ml = ml->next) {
ml != NIL;
ml = ml->ml_next) {

/* copy out into an array */
*t++ = ml->address;
*t++ = ml->size;
*t++ = ml->ml_address;
*t++ = ml->ml_size;
}
return (BOOT_SUCCESS);
} else if (strequal(name, p->name)) {
Expand Down
21 changes: 9 additions & 12 deletions usr/src/psm/stand/boot/sparc/common/sun4u_memlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
Expand All @@ -20,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include <sys/types.h>
#include <sys/param.h>
#include <sys/promif.h>
Expand Down Expand Up @@ -114,7 +111,7 @@ fill_memlists(char *name, char *prop, struct memlist *old)
prom_panic("Cannot get list.\n");
if (links > sizeof (scratch_memlist)) {
prom_printf("%s list <%s> exceeds boot capabilities\n",
name, prop);
name, prop);
prom_panic("fill_memlists - memlist size");
}
links = links / sizeof (struct sun4u_prom_memlist);
Expand Down Expand Up @@ -203,17 +200,17 @@ reg_to_list(struct sun4u_prom_memlist *ar, size_t n, struct memlist *old)
if (!head)
head = ptr;
if (last)
last->next = ptr;
ptr->address = flag ? addr : start1;
ptr->size = size ? size : ar[i].size;
ptr->prev = last;
last->ml_next = ptr;
ptr->ml_address = flag ? addr : start1;
ptr->ml_size = size ? size : ar[i].size;
ptr->ml_prev = last;
last = ptr;

size = 0;
flag = 0;
addr = 0;
}

last->next = NULL;
last->ml_next = NULL;
return (head);
}
25 changes: 11 additions & 14 deletions usr/src/stand/lib/sa/memlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
Expand All @@ -20,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 1992-2003 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysmacros.h>
Expand Down Expand Up @@ -53,9 +50,9 @@ print_memlist(struct memlist *av)

while (p != NULL) {
printf("addr = 0x%x:0x%x, size = 0x%x:0x%x\n",
(uint_t)(p->address >> 32), (uint_t)p->address,
(uint_t)(p->size >> 32), (uint_t)p->size);
p = p->next;
(uint_t)(p->ml_address >> 32), (uint_t)p->ml_address,
(uint_t)(p->ml_size >> 32), (uint_t)p->ml_size);
p = p->ml_next;
}

}
Expand Down Expand Up @@ -125,11 +122,11 @@ get_memlist_struct(void)
sizeof (struct memlist));
bzero(free_memlist_ptr, (ALLOC_SZ * sizeof (struct memlist)));
for (i = 0; i < ALLOC_SZ; i++)
ptr[i].next = &ptr[i+1];
ptr[i-1].next = NULL;
ptr[i].ml_next = &ptr[i+1];
ptr[i-1].ml_next = NULL;
}
ptr = free_memlist_ptr;
free_memlist_ptr = ptr->next;
free_memlist_ptr = ptr->ml_next;
return (ptr);
}

Expand All @@ -144,8 +141,8 @@ add_to_freelist(struct memlist *ptr)
if (free_memlist_ptr == NULL) {
free_memlist_ptr = ptr;
} else {
for (tmp = free_memlist_ptr; tmp->next; tmp = tmp->next)
for (tmp = free_memlist_ptr; tmp->ml_next; tmp = tmp->ml_next)
;
tmp->next = ptr;
tmp->ml_next = ptr;
}
}
6 changes: 3 additions & 3 deletions usr/src/uts/common/cpr/cpr_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -177,8 +177,8 @@ cpr_set_bitmap_size(void)
size_t size = 0;

memlist_read_lock();
for (pmem = phys_install; pmem; pmem = pmem->next)
size += pmem->size;
for (pmem = phys_install; pmem; pmem = pmem->ml_next)
size += pmem->ml_size;
memlist_read_unlock();
cpr_bitmap_size = BITMAP_BYTES(size);
}
Expand Down
12 changes: 6 additions & 6 deletions usr/src/uts/common/crypto/io/swrand.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,15 +701,15 @@ physmem_ent_gen(physmem_entsrc_t *entsrc)
/* Pick a memory block to read */
block = oblock = srndpool[i] % entsrc->nblocks;

for (pmem = phys_install; pmem != NULL; pmem = pmem->next) {
if (block < pmem->size / MEMBLOCKSIZE)
for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) {
if (block < pmem->ml_size / MEMBLOCKSIZE)
break;
block -= pmem->size / MEMBLOCKSIZE;
block -= pmem->ml_size / MEMBLOCKSIZE;
}

ASSERT(pmem != NULL);

offset = pmem->address + block * MEMBLOCKSIZE;
offset = pmem->ml_address + block * MEMBLOCKSIZE;

if (!address_in_memlist(phys_install, offset, MEMBLOCKSIZE)) {
memlist_read_unlock();
Expand Down Expand Up @@ -842,8 +842,8 @@ physmem_count_blocks()

memlist_read_lock();
entsrc.nblocks = 0;
for (pmem = phys_install; pmem != NULL; pmem = pmem->next) {
entsrc.nblocks += pmem->size / MEMBLOCKSIZE;
for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) {
entsrc.nblocks += pmem->ml_size / MEMBLOCKSIZE;
if (entsrc.nblocks > MAXMEMBLOCKS) {
entsrc.nblocks = MAXMEMBLOCKS;
break;
Expand Down
10 changes: 5 additions & 5 deletions usr/src/uts/common/fs/sockfs/socksubr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -1614,7 +1614,7 @@ pr_addr(int family, struct sockaddr *addr, t_uscalar_t addrlen)
}

/* The logical equivalence operator (a if-and-only-if b) */
#define EQUIV(a, b) (((a) && (b)) || (!(a) && (!(b))))
#define EQUIVALENT(a, b) (((a) && (b)) || (!(a) && (!(b))))

/*
* Verify limitations and invariants on oob state.
Expand Down Expand Up @@ -1663,7 +1663,7 @@ so_verify_oobstate(struct sonode *so)
havemark = (SOCK_IS_NONSTR(so)) ? so->so_oobmark > 0 :
SOTOTPI(so)->sti_oobsigcnt > 0;

if (!EQUIV(havemark || (so->so_state & SS_RCVATMARK),
if (!EQUIVALENT(havemark || (so->so_state & SS_RCVATMARK),
so->so_state & SS_OOBPEND)) {
printf("Bad oob state 3 (%p): state %s\n",
(void *)so, pr_state(so->so_state, so->so_mode));
Expand All @@ -1674,7 +1674,7 @@ so_verify_oobstate(struct sonode *so)
* Unless SO_OOBINLINE we have so_oobmsg != NULL iff SS_HAVEOOBDATA
*/
if (!(so->so_options & SO_OOBINLINE) &&
!EQUIV(so->so_oobmsg != NULL, so->so_state & SS_HAVEOOBDATA)) {
!EQUIVALENT(so->so_oobmsg != NULL, so->so_state & SS_HAVEOOBDATA)) {
printf("Bad oob state 4 (%p): state %s\n",
(void *)so, pr_state(so->so_state, so->so_mode));
return (0);
Expand All @@ -1691,7 +1691,7 @@ so_verify_oobstate(struct sonode *so)

return (1);
}
#undef EQUIV
#undef EQUIVALENT
#endif /* DEBUG */

/* initialize sockfs zone specific kstat related items */
Expand Down
14 changes: 7 additions & 7 deletions usr/src/uts/common/io/dld/dld_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -301,12 +301,12 @@ proto_info_req(dld_str_t *dsp, mblk_t *mp)
}

done:
ASSERT(IMPLY(dlp->dl_qos_offset != 0, dlp->dl_qos_length != 0));
ASSERT(IMPLY(dlp->dl_qos_range_offset != 0,
dlp->dl_qos_range_length != 0));
ASSERT(IMPLY(dlp->dl_addr_offset != 0, dlp->dl_addr_length != 0));
ASSERT(IMPLY(dlp->dl_brdcst_addr_offset != 0,
dlp->dl_brdcst_addr_length != 0));
IMPLY(dlp->dl_qos_offset != 0, dlp->dl_qos_length != 0);
IMPLY(dlp->dl_qos_range_offset != 0,
dlp->dl_qos_range_length != 0);
IMPLY(dlp->dl_addr_offset != 0, dlp->dl_addr_length != 0);
IMPLY(dlp->dl_brdcst_addr_offset != 0,
dlp->dl_brdcst_addr_length != 0);

qreply(q, mp);
}
Expand Down
17 changes: 9 additions & 8 deletions usr/src/uts/common/io/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -762,9 +762,9 @@ mmmmap(dev_t dev, off_t off, int prot)
case M_MEM:
pf = btop(off);
memlist_read_lock();
for (pmem = phys_install; pmem != NULL; pmem = pmem->next) {
if (pf >= BTOP(pmem->address) &&
pf < BTOP(pmem->address + pmem->size)) {
for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) {
if (pf >= BTOP(pmem->ml_address) &&
pf < BTOP(pmem->ml_address + pmem->ml_size)) {
memlist_read_unlock();
return (impl_obmem_pfnum(pf));
}
Expand Down Expand Up @@ -983,7 +983,7 @@ mm_kstat_update(kstat_t *ksp, int rw)

count = 0;
memlist_read_lock();
for (pmem = phys_install; pmem != NULL; pmem = pmem->next) {
for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) {
count++;
}
memlist_read_unlock();
Expand All @@ -1010,11 +1010,12 @@ mm_kstat_snapshot(kstat_t *ksp, void *buf, int rw)

kspmem = (struct memunit *)buf;
memlist_read_lock();
for (pmem = phys_install; pmem != NULL; pmem = pmem->next, kspmem++) {
for (pmem = phys_install; pmem != NULL;
pmem = pmem->ml_next, kspmem++) {
if ((caddr_t)kspmem >= (caddr_t)buf + ksp->ks_data_size)
break;
kspmem->address = pmem->address;
kspmem->size = pmem->size;
kspmem->address = pmem->ml_address;
kspmem->size = pmem->ml_size;
}
memlist_read_unlock();

Expand Down
Loading

0 comments on commit 56f3320

Please sign in to comment.