/********************************************************************* ********************************************************************** * KMOD COMPATIBILITY FUNCTIONS * * (formerly in kmod.c, or C++ bridges from) * ********************************************************************** ********************************************************************** * These two functions are used in various places in the kernel, but * are not exported. We might rename them at some point to start with * kext_ or OSKext. * * kmod_panic_dump() must not be called outside of a panic context. * kmod_dump_log() must not be called in a panic context. *********************************************************************/ void kmod_panic_dump(vm_offset_t * addr, unsigned int cnt) { extern int kdb_printf(const char *format, ...) __printflike(1,2); OSKext::printKextsInBacktrace(addr, cnt, &kdb_printf, /* takeLock? */ false); return; }
void diskerr(const struct buf *bp, const char *dname, const char *what, int pri, int blkdone, const struct disklabel *lp) { int unit = DISKUNIT(bp->b_dev), part = DISKPART(bp->b_dev); void (*pr)(const char *, ...) __printflike(1, 2); char partname = 'a' + part; daddr_t sn; if (/*CONSTCOND*/0) /* Compiler will error this is the format is wrong... */ printf("%" PRIdaddr, bp->b_blkno); if (pri != LOG_PRINTF) { static const char fmt[] = ""; log(pri, fmt); pr = addlog; } else pr = printf; (*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what, bp->b_flags & B_READ ? "read" : "writ"); sn = bp->b_blkno; if (bp->b_bcount <= DEV_BSIZE) (*pr)("%" PRIdaddr, sn); else { if (blkdone >= 0) { sn += blkdone; (*pr)("%" PRIdaddr " of ", sn); } (*pr)("%" PRIdaddr "-%" PRIdaddr "", bp->b_blkno, bp->b_blkno + (bp->b_bcount - 1) / DEV_BSIZE); } if (lp && (blkdone >= 0 || bp->b_bcount <= lp->d_secsize)) { sn += lp->d_partitions[part].p_offset; (*pr)(" (%s%d bn %" PRIdaddr "; cn %" PRIdaddr "", dname, unit, sn, sn / lp->d_secpercyl); sn %= lp->d_secpercyl; (*pr)(" tn %" PRIdaddr " sn %" PRIdaddr ")", sn / lp->d_nsectors, sn % lp->d_nsectors); } }