Deleted Added
full compact
subr_disk.c (102241) subr_disk.c (103675)
1/*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
1/*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
9 * $FreeBSD: head/sys/kern/subr_disk.c 102241 2002-08-21 23:39:52Z archie $
9 * $FreeBSD: head/sys/kern/subr_disk.c 103675 2002-09-20 12:52:03Z phk $
10 *
11 */
12
13#include "opt_geom.h"
10 *
11 */
12
13#include "opt_geom.h"
14#ifndef GEOM
15
16#include <sys/param.h>
17#include <sys/systm.h>
14
15#include <sys/param.h>
16#include <sys/systm.h>
18#include <sys/kernel.h>
19#include <sys/sysctl.h>
17#include <sys/stdint.h>
20#include <sys/bio.h>
21#include <sys/conf.h>
22#include <sys/disk.h>
18#include <sys/bio.h>
19#include <sys/conf.h>
20#include <sys/disk.h>
21#ifndef GEOM
22#include <sys/kernel.h>
23#include <sys/sysctl.h>
23#include <sys/malloc.h>
24#include <sys/sysctl.h>
25#include <machine/md_var.h>
26#include <sys/ctype.h>
27
28static MALLOC_DEFINE(M_DISK, "disk", "disk data");
29
30static d_strategy_t diskstrategy;

--- 396 unchanged lines hidden (view full) ---

427
428SYSCTL_INT(_debug_sizeof, OID_AUTO, diskslices, CTLFLAG_RD,
429 0, sizeof(struct diskslices), "sizeof(struct diskslices)");
430
431SYSCTL_INT(_debug_sizeof, OID_AUTO, disk, CTLFLAG_RD,
432 0, sizeof(struct disk), "sizeof(struct disk)");
433
434#endif
24#include <sys/malloc.h>
25#include <sys/sysctl.h>
26#include <machine/md_var.h>
27#include <sys/ctype.h>
28
29static MALLOC_DEFINE(M_DISK, "disk", "disk data");
30
31static d_strategy_t diskstrategy;

--- 396 unchanged lines hidden (view full) ---

428
429SYSCTL_INT(_debug_sizeof, OID_AUTO, diskslices, CTLFLAG_RD,
430 0, sizeof(struct diskslices), "sizeof(struct diskslices)");
431
432SYSCTL_INT(_debug_sizeof, OID_AUTO, disk, CTLFLAG_RD,
433 0, sizeof(struct disk), "sizeof(struct disk)");
434
435#endif
436
437/*-
438 * Disk error is the preface to plaintive error messages
439 * about failing disk transfers. It prints messages of the form
440 * "hp0g: BLABLABLA cmd=read fsbn 12345 of 12344-12347"
441 * blkdone should be -1 if the position of the error is unknown.
442 * The message is printed with printf.
443 */
444void
445disk_err(struct bio *bp, const char *what, int blkdone, int nl)
446{
447 daddr_t sn;
448
449 printf("%s: %s", devtoname(bp->bio_dev), what);
450 switch(bp->bio_cmd) {
451 case BIO_READ: printf("cmd=read"); break;
452 case BIO_WRITE: printf("cmd=write"); break;
453 case BIO_DELETE: printf("cmd=delete"); break;
454 case BIO_GETATTR: printf("cmd=getattr"); break;
455 case BIO_SETATTR: printf("cmd=setattr"); break;
456 default: printf("cmd=%x", bp->bio_cmd); break;
457 }
458 sn = bp->bio_blkno;
459 if (bp->bio_bcount <= DEV_BSIZE) {
460 printf("fsbn %jd%s", (intmax_t)sn, nl ? "\n" : "");
461 return;
462 }
463 if (blkdone >= 0) {
464 sn += blkdone;
465 printf("fsbn %jd of ", (intmax_t)sn);
466 }
467 printf("%jd-%jd", (intmax_t)bp->bio_blkno,
468 (intmax_t)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE));
469 if (nl)
470 printf("\n");
471}