shithub: gefs

Download patch

ref: 5badc3e05b21eff267cf84b03ef0eba045f4aee0
parent: 7d78f855dec94551acb6e02fad0fe42c6425aeec
author: Michael Forney <[email protected]>
date: Sun Feb 6 05:39:47 EST 2022

use uvlong for block hash and print with fixed width

--- a/blk.c
+++ b/blk.c
@@ -703,7 +703,7 @@
 void
 finalize(Blk *b)
 {
-	vlong h;
+	uvlong h;
 
 	setflag(b, Bfinal);
 	if(b->type != Traw)
@@ -763,7 +763,7 @@
 		setmalloctag(b, getcallerpc(&bp));
 	h = blkhash(b);
 	if((flg&GBnochk) == 0 && h != bp.hash){
-		fprint(2, "corrupt block %B: %llx != %llx\n", bp, blkhash(b), bp.hash);
+		fprint(2, "corrupt block %B: %.16llux != %.16llux\n", bp, blkhash(b), bp.hash);
 		qunlock(&fs->blklk[i]);
 		abort();
 		return nil;
--- a/dat.h
+++ b/dat.h
@@ -290,7 +290,7 @@
 
 struct Bptr {
 	vlong	addr;
-	vlong	hash;
+	uvlong	hash;
 	vlong	gen;
 };
 
--- a/dump.c
+++ b/dump.c
@@ -153,7 +153,7 @@
 	Bptr bp;
 
 	bp = va_arg(fmt->args, Bptr);
-	return fmtprint(fmt, "(%llx,%llx,%llx)", bp.addr, bp.hash, bp.gen);
+	return fmtprint(fmt, "(%llx,%.16llux,%llx)", bp.addr, bp.hash, bp.gen);
 }
 
 int