ref: 752a118f8532b340c29af4bf4852db3ae2f829be
parent: 3eb582075a1ef1e22549eaae7ed5a729eee9ca12
author: 9ferno <[email protected]>
date: Fri Dec 2 15:19:15 EST 2022
fill the first block with metadata first
--- a/blk.c
+++ b/blk.c
@@ -123,9 +123,9 @@
------------------
1. 0 255 0
2. 255 0 1
-3. >= 0
-4. < 1
-
+3. == 1 so that new will be 0
+4. > 0
+5. < 1
*/
u8
recentmetadata(void *buf, void **cur, void **new)
@@ -137,15 +137,17 @@
ms = buf;
if(ms[0].verd == 0 && ms[1].verd == 255)
- goto Use0;
+ goto Cur0;
else if(ms[0].verd == 255 && ms[1].verd == 0)
- goto Use1;
- else if(ms[0].verd >= ms[1].verd)
- goto Use0;
+ goto Cur1;
+ else if(ms[0].verd == ms[1].verd)
+ goto Cur1; /* so the new contents go in the first block */
+ else if(ms[0].verd > ms[1].verd)
+ goto Cur0;
else
- goto Use1;
+ goto Cur1;
-Use0:
+Cur0:
if(new != nil)
*new = ms+1;
if(cur != nil)
@@ -152,7 +154,7 @@
*cur = ms;
return 0;
-Use1:
+Cur1:
if(new != nil)
*new = ms;
if(cur != nil)