Module Name: src Committed By: tsutsui Date: Wed Mar 31 14:12:55 UTC 2010
Modified Files: src/sys/arch/atari/atari: disksubr.c intr.c machdep.c Log Message: Misc KNF and cosmetics. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/atari/atari/disksubr.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/atari/atari/intr.c cvs rdiff -u -r1.165 -r1.166 src/sys/arch/atari/atari/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/atari/atari/disksubr.c diff -u src/sys/arch/atari/atari/disksubr.c:1.41 src/sys/arch/atari/atari/disksubr.c:1.42 --- src/sys/arch/atari/atari/disksubr.c:1.41 Tue Oct 20 19:10:10 2009 +++ src/sys/arch/atari/atari/disksubr.c Wed Mar 31 14:12:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.41 2009/10/20 19:10:10 snj Exp $ */ +/* $NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.41 2009/10/20 19:10:10 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.42 2010/03/31 14:12:55 tsutsui Exp $"); #ifndef DISKLABEL_NBDA #define DISKLABEL_NBDA /* required */ @@ -69,13 +69,15 @@ * Returns NULL on success and an error string on failure. */ const char * -readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, struct cpu_disklabel *clp) +readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, + struct cpu_disklabel *clp) { - int e; + int e; if (clp != NULL) memset(clp, 0, sizeof *clp); - else printf("Warning: clp == NULL\n"); + else + printf("Warning: clp == NULL\n"); /* * Give some guaranteed validity to the disk label. @@ -85,7 +87,7 @@ if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; if (lp->d_secpercyl == 0) - return("Zero secpercyl"); + return "Zero secpercyl"; /* * Some parts of the kernel (see scsipi/cd.c for an example) @@ -117,39 +119,41 @@ e = ahdi_label(dev, strat, lp, clp); #endif if (e < 0) - return("I/O error"); + return "I/O error"; /* Unknown format or uninitialized volume? */ if (e > 0) uprintf("Warning: unknown disklabel format" - "- assuming empty disk\n"); + "- assuming empty disk\n"); /* Calulate new checksum. */ lp->d_magic = lp->d_magic2 = DISKMAGIC; lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); - return(NULL); + return NULL; } /* * Check new disk label for sensibility before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, struct cpu_disklabel *clp) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, + struct cpu_disklabel *clp) { + /* special case to allow disklabel to be invalidated */ if (nlp->d_magic == 0xffffffff) { *olp = *nlp; - return(0); + return 0; } /* sanity clause */ - if (nlp->d_secpercyl == 0 || nlp->d_npartitions > MAXPARTITIONS - || nlp->d_secsize == 0 || (nlp->d_secsize % DEV_BSIZE) != 0 - || nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC - || dkcksum(nlp) != 0) - return(EINVAL); + if (nlp->d_secpercyl == 0 || nlp->d_npartitions > MAXPARTITIONS || + nlp->d_secsize == 0 || (nlp->d_secsize % DEV_BSIZE) != 0 || + nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || + dkcksum(nlp) != 0) + return EINVAL; #ifdef DISKLABEL_AHDI if (clp && clp->cd_bblock) @@ -160,11 +164,11 @@ int i = ffs(openmask) - 1; openmask &= ~(1 << i); if (i >= nlp->d_npartitions) - return(EBUSY); + return EBUSY; op = &olp->d_partitions[i]; np = &nlp->d_partitions[i]; if (np->p_offset != op->p_offset || np->p_size < op->p_size) - return(EBUSY); + return EBUSY; /* * Copy internally-set partition information * if new label doesn't include it. XXX @@ -179,22 +183,23 @@ nlp->d_checksum = 0; nlp->d_checksum = dkcksum(nlp); *olp = *nlp; - return(0); + return 0; } /* * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, struct cpu_disklabel *clp) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, + struct cpu_disklabel *clp) { - struct buf *bp; - u_int blk; - int rv; + struct buf *bp; + u_int blk; + int rv; blk = clp->cd_bblock; if (blk == NO_BOOT_BLOCK) - return(ENXIO); + return ENXIO; bp = geteblk(BBMINSIZE); bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); @@ -204,7 +209,7 @@ bp->b_cylinder = blk / lp->d_secpercyl; (*strat)(bp); rv = biowait(bp); - if (!rv) { + if (rv == 0) { struct bootblock *bb = (struct bootblock *)bp->b_data; /* * Allthough the disk pack label may appear anywhere @@ -228,7 +233,7 @@ rv = biowait(bp); } brelse(bp, 0); - return(rv); + return rv; } /* @@ -240,15 +245,11 @@ * +1 if no valid label was found. */ static int -bsd_label(dev, strat, label, blkno, offsetp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *label; - u_int blkno, - *offsetp; +bsd_label(dev_t dev, void (*strat)(struct buf *), struct disklabel *label, + u_int blkno, u_int *offsetp) { - struct buf *bp; - int rv; + struct buf *bp; + int rv; bp = geteblk(BBMINSIZE); bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); @@ -261,29 +262,28 @@ rv = -1; if (!biowait(bp)) { struct bootblock *bb; - u_int32_t *p, *end; + uint32_t *p, *end; rv = 1; bb = (struct bootblock *)bp->b_data; - end = (u_int32_t *)((char *)&bb[1] - sizeof(struct disklabel)); - for (p = (u_int32_t *)bb; p < end; ++p) { + end = (uint32_t *)((char *)&bb[1] - sizeof(struct disklabel)); + for (p = (uint32_t *)bb; p < end; ++p) { struct disklabel *dl = (struct disklabel *)&p[1]; /* * Compatibility kludge: the boot block magic number is * new in 1.1A, in previous versions the disklabel was * stored at the end of the boot block (offset 7168). */ - if ( ( (p[0] == NBDAMAGIC && blkno == 0) - || (p[0] == AHDIMAGIC && blkno != 0) + if (((p[0] == NBDAMAGIC && blkno == 0) || + (p[0] == AHDIMAGIC && blkno != 0) #ifdef COMPAT_11 || (char *)dl - (char *)bb == 7168 #endif - ) - && dl->d_npartitions <= MAXPARTITIONS - && dl->d_magic2 == DISKMAGIC - && dl->d_magic == DISKMAGIC - && dkcksum(dl) == 0 - ) { + ) && + dl->d_npartitions <= MAXPARTITIONS && + dl->d_magic2 == DISKMAGIC && + dl->d_magic == DISKMAGIC && + dkcksum(dl) == 0) { if (offsetp != NULL) *offsetp = (char *)dl - (char *)bb; *label = *dl; @@ -293,7 +293,7 @@ } } brelse(bp, 0); - return(rv); + return rv; } #ifdef DISKLABEL_AHDI @@ -307,24 +307,24 @@ static void ck_label(struct disklabel *dl, struct cpu_disklabel *cdl) { - u_int *rp, i; + u_int *rp, i; for (i = 0; i < dl->d_npartitions; ++i) { struct partition *p = &dl->d_partitions[i]; if (i == RAW_PART || p->p_size == 0) continue; - if ( (p->p_offset >= cdl->cd_bslst - && p->p_offset <= cdl->cd_bslend) - || (cdl->cd_bslst >= p->p_offset - && cdl->cd_bslst < p->p_offset + p->p_size)) { + if ((p->p_offset >= cdl->cd_bslst && + p->p_offset <= cdl->cd_bslend) || + (cdl->cd_bslst >= p->p_offset && + cdl->cd_bslst < p->p_offset + p->p_size)) { uprintf("Warning: NetBSD partition %c includes" - " AHDI bad sector list\n", 'a'+i); + " AHDI bad sector list\n", 'a'+i); } for (rp = &cdl->cd_roots[0]; *rp; ++rp) { - if (*rp >= p->p_offset - && *rp < p->p_offset + p->p_size) { + if (*rp >= p->p_offset && + *rp < p->p_offset + p->p_size) { uprintf("Warning: NetBSD partition %c" - " includes AHDI auxiliary root\n", 'a'+i); + " includes AHDI auxiliary root\n", 'a' + i); } } } @@ -340,17 +340,18 @@ * +1 if no valid AHDI label was found. */ int -ahdi_label(dev_t dev, void (*strat)(struct buf *), struct disklabel *dl, struct cpu_disklabel *cdl) +ahdi_label(dev_t dev, void (*strat)(struct buf *), struct disklabel *dl, + struct cpu_disklabel *cdl) { - struct ahdi_ptbl apt; - u_int i; - int j; + struct ahdi_ptbl apt; + u_int i; + int j; /* * The AHDI format requires a specific block size. */ if (dl->d_secsize != AHDI_BSIZE) - return(1); + return 1; /* * Fetch the AHDI partition descriptors. @@ -358,11 +359,12 @@ apt.at_cdl = cdl; apt.at_nroots = apt.at_nparts = 0; i = ahdi_getparts(dev, strat, dl->d_secpercyl, - AHDI_BBLOCK, AHDI_BBLOCK, &apt); + AHDI_BBLOCK, AHDI_BBLOCK, &apt); if (i) { if (i < dl->d_secperunit) - return(-1); /* disk read error */ - else return(1); /* reading past end of medium */ + return -1; /* disk read error */ + else + return 1; /* reading past end of medium */ } /* @@ -376,31 +378,31 @@ */ apt.at_bslst = apt.at_bslend = 0; uprintf("Warning: Illegal 'bad sector list' format" - "- assuming non exists\n"); + "- assuming non exists\n"); } if (apt.at_hdsize == 0 || apt.at_nparts == 0) /* unlikely */ - return(1); + return 1; if (apt.at_nparts > AHDI_MAXPARTS) /* XXX kludge */ - return(-1); + return -1; for (i = 0; i < apt.at_nparts; ++i) { struct ahdi_part *p1 = &apt.at_parts[i]; for (j = 0; j < apt.at_nroots; ++j) { - u_int aux = apt.at_roots[j]; + u_int aux = apt.at_roots[j]; if (aux >= p1->ap_st && aux <= p1->ap_end) - return(1); + return 1; } for (j = i + 1; j < apt.at_nparts; ++j) { struct ahdi_part *p2 = &apt.at_parts[j]; if (p1->ap_st >= p2->ap_st && p1->ap_st <= p2->ap_end) - return(1); + return 1; if (p2->ap_st >= p1->ap_st && p2->ap_st <= p1->ap_end) - return(1); + return 1; } if (p1->ap_st >= apt.at_bslst && p1->ap_st <= apt.at_bslend) - return(1); + return 1; if (apt.at_bslst >= p1->ap_st && apt.at_bslst <= p1->ap_end) - return(1); + return 1; } /* @@ -409,17 +411,17 @@ apt.at_bblock = NO_BOOT_BLOCK; for (i = 0; i < apt.at_nparts; ++i) { struct ahdi_part *pd = &apt.at_parts[i]; - u_int id = *((u_int32_t *)&pd->ap_flg); + u_int id = *((uint32_t *)&pd->ap_flg); if (id == AHDI_PID_NBD || id == AHDI_PID_RAW) { - u_int blkno = pd->ap_st; + u_int blkno = pd->ap_st; j = bsd_label(dev, strat, dl, blkno, &apt.at_label); if (j < 0) { - return(j); /* I/O error */ + return j; /* I/O error */ } - if (!j) { + if (j == 0) { apt.at_bblock = blkno; /* got it */ ck_label(dl, cdl); - return(0); + return 0; } /* * Not yet, but if this is the first NBD partition @@ -428,8 +430,8 @@ * in case there is no valid disk label on any of the * other AHDI partitions. */ - if (id == AHDI_PID_NBD - && apt.at_bblock == NO_BOOT_BLOCK) + if (id == AHDI_PID_NBD && + apt.at_bblock == NO_BOOT_BLOCK) apt.at_bblock = blkno; } } @@ -441,7 +443,7 @@ * writedisklabel() calls will fail. */ ahdi_to_bsd(dl, &apt); - return(0); + return 0; } /* @@ -459,16 +461,16 @@ static void ahdi_to_bsd(struct disklabel *dl, struct ahdi_ptbl *apt) { - int i, have_root, user_part; + int i, have_root, user_part; user_part = RAW_PART; have_root = (apt->at_bblock != NO_BOOT_BLOCK); for (i = 0; i < apt->at_nparts; ++i) { struct ahdi_part *pd = &apt->at_parts[i]; - int fst, pno = -1; + int fst, pno = -1; - switch (*((u_int32_t *)&pd->ap_flg)) { + switch (*((uint32_t *)&pd->ap_flg)) { case AHDI_PID_NBD: /* * If this partition has been marked as the @@ -526,17 +528,13 @@ * number of the offending block is returned. */ static u_int -ahdi_getparts(dev, strat, secpercyl, rsec, esec, apt) - dev_t dev; - void (*strat)(struct buf *); - u_int secpercyl, - rsec, esec; - struct ahdi_ptbl *apt; +ahdi_getparts(dev_t dev, void (*strat)(struct buf *), u_int secpercyl, + u_int rsec, u_int esec, struct ahdi_ptbl *apt) { - struct ahdi_part *part, *end; - struct ahdi_root *root; - struct buf *bp; - u_int rv; + struct ahdi_part *part, *end; + struct ahdi_root *root; + struct buf *bp; + u_int rv; bp = geteblk(AHDI_BSIZE); bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); @@ -553,25 +551,26 @@ if (rsec == AHDI_BBLOCK) end = &root->ar_parts[AHDI_MAXRPD]; - else end = &root->ar_parts[AHDI_MAXARPD]; + else + end = &root->ar_parts[AHDI_MAXARPD]; for (part = root->ar_parts; part < end; ++part) { - u_int id = *((u_int32_t *)&part->ap_flg); + u_int id = *((uint32_t *)&part->ap_flg); if (!(id & 0x01000000)) continue; if ((id &= 0x00ffffff) == AHDI_PID_XGM) { - u_int offs = part->ap_st + esec; + u_int offs = part->ap_st + esec; if (apt->at_nroots < AHDI_MAXROOTS) apt->at_roots[apt->at_nroots] = offs; apt->at_nroots += 1; rv = ahdi_getparts(dev, strat, secpercyl, offs, (esec == AHDI_BBLOCK) ? offs : esec, apt); - if (rv) + if (rv != 0) goto done; continue; } else if (apt->at_nparts < AHDI_MAXPARTS) { struct ahdi_part *p = &apt->at_parts[apt->at_nparts]; - *((u_int32_t *)&p->ap_flg) = id; + *((uint32_t *)&p->ap_flg) = id; p->ap_st = part->ap_st + rsec; p->ap_end = p->ap_st + part->ap_size - 1; } @@ -583,6 +582,6 @@ rv = 0; done: brelse(bp, 0); - return(rv); + return rv; } #endif /* DISKLABEL_AHDI */ Index: src/sys/arch/atari/atari/intr.c diff -u src/sys/arch/atari/atari/intr.c:1.20 src/sys/arch/atari/atari/intr.c:1.21 --- src/sys/arch/atari/atari/intr.c:1.20 Tue Feb 9 23:05:16 2010 +++ src/sys/arch/atari/atari/intr.c Wed Mar 31 14:12:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.20 2010/02/09 23:05:16 wiz Exp $ */ +/* $NetBSD: intr.c,v 1.21 2010/03/31 14:12:55 tsutsui Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.20 2010/02/09 23:05:16 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21 2010/03/31 14:12:55 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -132,25 +132,25 @@ * Do some validity checking on the 'vector' argument and determine * vector list this interrupt should be on. */ - switch(type & (AUTO_VEC|USER_VEC)) { - case AUTO_VEC: - if (vector < AVEC_MIN || vector > AVEC_MAX) - return (NULL); - vec_list = &autovec_list[vector-1]; - hard_vec = &autovects[vector-1]; - ih->ih_intrcnt = &intrcnt_auto[vector-1]; - break; - case USER_VEC: - if (vector < UVEC_MIN || vector > UVEC_MAX) - return (NULL); - vec_list = &uservec_list[vector]; - hard_vec = &uservects[vector]; - ih->ih_intrcnt = &intrcnt_user[vector]; - break; - default: - printf("intr_establish: bogus vector type\n"); - free(ih, M_DEVBUF); - return(NULL); + switch (type & (AUTO_VEC|USER_VEC)) { + case AUTO_VEC: + if (vector < AVEC_MIN || vector > AVEC_MAX) + return NULL; + vec_list = &autovec_list[vector-1]; + hard_vec = &autovects[vector-1]; + ih->ih_intrcnt = &intrcnt_auto[vector-1]; + break; + case USER_VEC: + if (vector < UVEC_MIN || vector > UVEC_MAX) + return NULL; + vec_list = &uservec_list[vector]; + hard_vec = &uservects[vector]; + ih->ih_intrcnt = &intrcnt_user[vector]; + break; + default: + printf("intr_establish: bogus vector type\n"); + free(ih, M_DEVBUF); + return NULL; } /* @@ -163,7 +163,7 @@ LIST_INSERT_HEAD(vec_list, ih, ih_link); if (type & FAST_VEC) *hard_vec = (u_long)ih->ih_fun; - else if(*hard_vec != (u_long)intr_glue) { + else if (*hard_vec != (u_long)intr_glue) { /* * Normally, all settable vectors are already * re-routed to the intr_glue() function. The @@ -187,7 +187,7 @@ if (cur_vec->ih_type & FAST_VEC) { free(ih, M_DEVBUF); printf("intr_establish: vector cannot be shared\n"); - return (NULL); + return NULL; } /* @@ -202,7 +202,7 @@ LIST_INSERT_BEFORE(cur_vec, ih, ih_link); splx(s); - return (ih); + return ih; } } @@ -227,21 +227,21 @@ vector = ih->ih_vector; switch(ih->ih_type & (AUTO_VEC|USER_VEC)) { - case AUTO_VEC: - if (vector < AVEC_MIN || vector > AVEC_MAX) - return 0; - vec_list = &autovec_list[vector-1]; - hard_vec = &autovects[vector-1]; - break; - case USER_VEC: - if (vector < UVEC_MIN || vector > UVEC_MAX) - return 0; - vec_list = &uservec_list[vector]; - hard_vec = &uservects[vector]; - break; - default: - printf("intr_disestablish: bogus vector type\n"); - return 0; + case AUTO_VEC: + if (vector < AVEC_MIN || vector > AVEC_MAX) + return 0; + vec_list = &autovec_list[vector-1]; + hard_vec = &autovects[vector-1]; + break; + case USER_VEC: + if (vector < UVEC_MIN || vector > UVEC_MAX) + return 0; + vec_list = &uservec_list[vector]; + hard_vec = &uservects[vector]; + break; + default: + printf("intr_disestablish: bogus vector type\n"); + return 0; } /* @@ -286,27 +286,28 @@ vec_list = &autovec_list[vector - AVEC_LOC]; else if (vector <= (UVEC_LOC+UVEC_MAX) && vector >= UVEC_LOC) vec_list = &uservec_list[vector - UVEC_LOC]; - else panic("intr_dispatch: Bogus vector %d", vector); + else + panic("intr_dispatch: Bogus vector %d", vector); if ((ih = vec_list->lh_first) == NULL) { printf("intr_dispatch: vector %d unexpected\n", vector); if (++unexpected > 10) - panic("intr_dispatch: too many unexpected interrupts"); + panic("intr_dispatch: too many unexpected interrupts"); return; } ih->ih_intrcnt[0]++; /* Give all the handlers a chance. */ - for ( ; ih != NULL; ih = ih->ih_link.le_next) - handled |= (*ih->ih_fun)((ih->ih_type & ARG_CLOCKFRAME) - ? &frame : ih->ih_arg, frame.cf_sr); + for (; ih != NULL; ih = ih->ih_link.le_next) + handled |= (*ih->ih_fun)((ih->ih_type & ARG_CLOCKFRAME) ? + &frame : ih->ih_arg, frame.cf_sr); if (handled) - straycount = 0; + straycount = 0; else if (++straycount > 50) - panic("intr_dispatch: too many stray interrupts"); + panic("intr_dispatch: too many stray interrupts"); else - printf("intr_dispatch: stray level %d interrupt\n", vector); + printf("intr_dispatch: stray level %d interrupt\n", vector); } bool Index: src/sys/arch/atari/atari/machdep.c diff -u src/sys/arch/atari/atari/machdep.c:1.165 src/sys/arch/atari/atari/machdep.c:1.166 --- src/sys/arch/atari/atari/machdep.c:1.165 Mon Feb 8 19:02:26 2010 +++ src/sys/arch/atari/atari/machdep.c Wed Mar 31 14:12:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.165 2010/02/08 19:02:26 joerg Exp $ */ +/* $NetBSD: machdep.c,v 1.166 2010/03/31 14:12:55 tsutsui Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.165 2010/02/08 19:02:26 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.166 2010/03/31 14:12:55 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -173,7 +173,7 @@ void consinit(void) { - int i; + int i; /* * Initialize error message buffer. pmap_bootstrap() has @@ -206,7 +206,7 @@ ksyms_addsyms_elf(*(int *)&end, ((int *)&end) + 1, esym); #else ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr), - (void *)&end, esym); + (void *)&end, esym); #endif } #endif @@ -223,15 +223,14 @@ void cpu_startup(void) { - extern int iomem_malloc_safe; - char pbuf[9]; - + extern int iomem_malloc_safe; + char pbuf[9]; #ifdef DEBUG - extern int pmapdebug; - int opmapdebug = pmapdebug; + extern int pmapdebug; + int opmapdebug = pmapdebug; #endif - vaddr_t minaddr, maxaddr; - extern vsize_t mem_size; /* from pmap.c */ + vaddr_t minaddr, maxaddr; + extern vsize_t mem_size; /* from pmap.c */ #ifdef DEBUG pmapdebug = 0; @@ -339,13 +338,13 @@ case CPU_68060: { - u_int32_t pcr; + uint32_t pcr; char cputxt[30]; __asm(".word 0x4e7a,0x0808;" "movl %%d0,%0" : "=d"(pcr) : : "d0"); sprintf(cputxt, "68%s060 rev.%d", - pcr & 0x10000 ? "LC/EC" : "", (pcr>>8)&0xff); + pcr & 0x10000 ? "LC/EC" : "", (pcr >> 8) & 0xff); cpu = cputxt; mmu = "/MMU"; } @@ -454,7 +453,7 @@ return p + BYTES_PER_DUMP; } -u_int32_t dumpmag = 0x8fca0101; /* magic number for savecore */ +uint32_t dumpmag = 0x8fca0101; /* magic number for savecore */ int dumpsize = 0; /* also for savecore (pages) */ long dumplo = 0; /* (disk blocks) */ @@ -571,7 +570,7 @@ * Print Mb's to go */ n = nbytes - i; - if (n && (n % (1024*1024)) == 0) + if (n && (n % (1024 * 1024)) == 0) printf_nolog("%d ", n / (1024 * 1024)); /* @@ -625,16 +624,16 @@ void straytrap(int pc, u_short evec) { - static int prev_evec; + static int prev_evec; printf("unexpected trap (vector offset 0x%x) from 0x%x\n", evec & 0xFFF, pc); - if(prev_evec == evec) { + if (prev_evec == evec) { delay(1000000); prev_evec = 0; - } - else prev_evec = evec; + } else + prev_evec = evec; } void @@ -663,18 +662,18 @@ } switch (size) { case 1: - i = *(volatile char *)addr; + i = *(volatile uint8_t *)addr; break; case 2: - i = *(volatile short *)addr; + i = *(volatile uint16_t *)addr; break; case 4: - i = *(volatile long *)addr; + i = *(volatile uint32_t *)addr; break; default: panic("badbaddr: unknown size"); } - nofault = (int *) 0; + nofault = (int *)0; return 0; } @@ -714,25 +713,25 @@ void add_sicallback(void (*function)(void *, void *), void *rock1, void *rock2) { - struct si_callback *si; - int s; + struct si_callback *si; + int s; /* * this function may be called from high-priority interrupt handlers. * We may NOT block for memory-allocation in here!. */ - s = splhigh(); + s = splhigh(); if ((si = si_free) != NULL) si_free = si->next; splx(s); - if(si == NULL) { + if (si == NULL) { si = malloc(sizeof(*si), M_TEMP, M_NOWAIT); #ifdef DIAGNOSTIC if (si) ++ncbd; /* count # dynamically allocated */ #endif - if (!si) + if (si == NULL) return; } @@ -764,8 +763,8 @@ void rem_sicallback(void (*function)(void *rock1, void *rock2)) { - struct si_callback *si, *psi, *nsi; - int s; + struct si_callback *si, *psi, *nsi; + int s; s = splhigh(); for (psi = 0, si = si_callbacks; si; ) { @@ -776,7 +775,7 @@ else { si->next = si_free; si_free = si; - if (psi) + if (psi != NULL) psi->next = nsi; else si_callbacks = nsi; @@ -790,10 +789,10 @@ static void call_sicallbacks(void) { - struct si_callback *si; - int s; - void *rock1, *rock2; - void (*function)(void *, void *); + struct si_callback *si; + int s; + void *rock1, *rock2; + void (*function)(void *, void *); do { s = splhigh (); @@ -801,7 +800,7 @@ si_callbacks = si->next; splx(s); - if (si) { + if (si != NULL) { function = si->function; rock1 = si->rock1; rock2 = si->rock2; @@ -826,7 +825,7 @@ function(rock1, rock2); splx(s); } - } while (si); + } while (si != NULL); #ifdef DIAGNOSTIC if (ncbd) { #ifdef DEBUG @@ -873,7 +872,7 @@ #ifdef COMPAT_NOMID if (!((execp->a_midmag >> 16) & 0x0fff) && execp->a_midmag == ZMAGIC) - return(exec_aout_prep_zmagic(l->l_proc, epp)); + return exec_aout_prep_zmagic(l->l_proc, epp); #endif return error; }