code: mafs

Download patch

ref: 6e15fbc3392817e4db26bfc655fd7dbe758a5b81
parent: 0a2bc153ff335f97546a6e4ea7d0c6de74f40776
author: 9ferno <gophone2015@gmail.com>
date: Fri Dec 2 15:42:04 EST 2022

cleanup

--- a/block.c
+++ b/block.c
@@ -3,7 +3,11 @@
 #include "dat.h"
 #include "fns.h"
 
-/* write out a single formatted block based on the tag */
+/*
+	write out a single formatted block based on the tag
+	TODO
+		add a flag -r to show the recent block of metada
+ */
 
 int debug = 0;
 char *devfile = nil;
--- a/find.c
+++ b/find.c
@@ -79,7 +79,6 @@
 		exits(nil);
 	}
 
-print("findblkno %llud\n", findblkno);
 	if(devfile == nil)
 		sysfatal("no disk file");
 
--- a/updatefrees.c
+++ b/updatefrees.c
@@ -86,8 +86,8 @@
 
 	devread(Bdfrees, buf, Metadataunits);
 	// showblock(1, buf);
+	recentmetadata(buf, &d, nil);
 
-	d = (Dentry*)buf;
 	if(d->size != nfreesize)
 		print("changed size: %llud to %d\n", d->size, nfreesize);
 	d->size = nfreesize;
@@ -102,7 +102,7 @@
 		f = (Data*)freesdata;
 		f->tag = Tdata;
 		f->len = 1;
-		memcpy(f->buf, frees, Blocksize -sizeof(Datahdr) -sizeof(u64 /* trailing path */));
+		memcpy(f->buf, frees, Blocksize -Ddataidssize);
 		freesdata[Dpathidx] = Qpfrees;
 
 		devwrite(Bdfrees, buf, Metadataunits);