Subject: kern/26994: changes in break vinum
To: None <gnats-bugs@gnats.NetBSD.org>
From: Andreas Wiese <awiese@despammed.com>
List: netbsd-bugs
Date: 09/19/2004 13:30:58
>Number:         26994
>Category:       kern
>Synopsis:       kernel build fails because of format errors
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 19 11:33:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Wiese
>Release:        NetBSD 2.0H
>Organization:
Linux User Group Halberstadt
>Environment:
	
	
System: NetBSD schroeder.singeklub.invalid 2.0G NetBSD 2.0G (SCHROEDER) #1: Wed Sep 15 00:21:47 CEST 2004 root@schroeder.singeklub.invalid:/sys/arch/i386/compile/SCHROEDER i386
Architecture: i386
Machine: i386
>Description:
The kernel build with enabled 'pseudo-device vinum 8' fails with the
following error:

#v+
#   compile  SCHROEDER/vinumdaemon.o
cc -ffreestanding -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-
arith -Wmissing-prototypes -Wstrict-prototypes -Wno-sign-compare -fno-zero-initi
alized-in-bss -Di386 -I. -I../../../../arch -I../../../.. -nostdinc -DCRYPTO_MD_
DES_ENC -DCRYPTO_MD_DES_CBC -DCRYPTO_MD_BF_ENC -DCRYPTO_MD_BF_CBC -DLKM -DMAXUSE
RS=32 -D_KERNEL -D_KERNEL_OPT -I../../../../dist/pf -c ../../../../dev/vinum/vin
umdaemon.c
../../../../dev/vinum/vinumdaemon.c: In function `vinum_daemon':
../../../../dev/vinum/vinumdaemon.c:113: warning: long int format, int arg (arg 
8)
*** Error code 1

Stop.
make: stopped in /sys/arch/i386/compile/SCHROEDER
#v-

That's caused by the following:

,---[ /sys/dev/vinum/vinumdaemon.c ]---
| [...]
| log(LOG_WARNING,
|     "vinum: recovering I/O request: %p\n%s dev: %d.%d, offset 0x%llx, length %ld\n",
|     rq,
|     rq->bp->b_flags & B_READ ? "Read" : "Write",
|     major(rq->bp->b_dev),
|     minor(rq->bp->b_dev),
|     (long long int) rq->bp->b_blkno,
|     rq->bp->b_bcount);
`--------------------------------------

rq is of type `struct request *', rq->bp is of type `struct buf *' and the
type of rq->bp->b_blkno recently changed from `long' to `int'.  vinum seems
to have missed this change.

Similar things happen later in the build process in
/sys/dev/vinum/vinuminterrupt.c.

>How-To-Repeat:
Enable 'pseudo-device vinum 8' in your config and recompile the kernel.
>Fix:

BTW:  Which patch format is preferred here?  `diff' or `diff -u'?

Common subdirectories: src/sys/dev/vinum.org/CVS and src/sys/dev/vinum/CVS
diff -u src/sys/dev/vinum.org/vinumdaemon.c src/sys/dev/vinum/vinumdaemon.c
--- src/sys/dev/vinum.org/vinumdaemon.c	2004-09-19 13:22:18.000000000 +0200
+++ src/sys/dev/vinum/vinumdaemon.c	2004-09-19 13:25:00.000000000 +0200
@@ -104,7 +104,7 @@
 		    struct request *rq = request->info.rq;
 
 		    log(LOG_WARNING,
-			"vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%llx, length %ld\n",
+			"vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%llx, length %d\n",
 			rq,
 			rq->bp->b_flags & B_READ ? "Read" : "Write",
 			major(rq->bp->b_dev),
diff -u src/sys/dev/vinum.org/vinuminterrupt.c src/sys/dev/vinum/vinuminterrupt.c
--- src/sys/dev/vinum.org/vinuminterrupt.c	2004-09-19 13:22:18.000000000 +0200
+++ src/sys/dev/vinum/vinuminterrupt.c	2004-09-19 13:25:00.000000000 +0200
@@ -100,7 +100,7 @@
 		set_sd_state(rqe->sdno, sd_crashed, setstate_force); /* subdisk is crashed */
 	    }
 	    log(LOG_ERR,
-		"%s:%s read error, block %lld for %ld bytes\n",
+		"%s:%s read error, block %lld for %d bytes\n",
 		gravity,
 		sd->name,
 		(long long int) bp->b_blkno,
@@ -111,20 +111,20 @@
 		set_sd_state(rqe->sdno, sd_stale, setstate_force); /* subdisk is stale */
 	    }
 	    log(LOG_ERR,
-		"%s:%s write error, block %lld for %ld bytes\n",
+		"%s:%s write error, block %lld for %d bytes\n",
 		gravity,
 		sd->name,
 		(long long int)bp->b_blkno,
 		bp->b_bcount);
 	}
 	log(LOG_ERR,
-	    "%s: user buffer block %lld for %ld bytes\n",
+	    "%s: user buffer block %lld for %d bytes\n",
 	    sd->name,
 	    (long long int)ubp->b_blkno,
 	    ubp->b_bcount);
 	if (rq->error == ENXIO) {			    /* the drive's down too */
 	    log(LOG_ERR,
-		"%s: fatal drive I/O error, block %lld for %ld bytes\n",
+		"%s: fatal drive I/O error, block %lld for %d bytes\n",
 		DRIVE[rqe->driveno].label.name,
 		(long long int)bp->b_blkno,
 		bp->b_bcount);
>Release-Note:
>Audit-Trail:
>Unformatted: