shithub: gefs

Download patch

ref: d48bbb88615522a678537ba0eeede9b1f4869388
parent: b9696638496c7d07503f0fa23f4a89c9000b6327
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Jan 17 10:11:35 EST 2024

truncate: length => end

--- a/dat.h
+++ b/dat.h
@@ -398,7 +398,7 @@
 			Dent	*dent;
 			vlong	qpath;
 			vlong	off;
-			vlong	length;
+			vlong	end;
 		};
 	};
 };
--- a/fs.c
+++ b/fs.c
@@ -1372,7 +1372,7 @@
 				(*ao)->mnt = f->mnt;
 				(*ao)->qpath = f->qpath;
 				(*ao)->off = d.length;
-				(*ao)->length = f->dent->length;
+				(*ao)->end = f->dent->length;
 				(*ao)->dent = de;
 			}
 			de->length = d.length;
@@ -1708,7 +1708,7 @@
 		(*ao)->mnt = f->mnt;
 		(*ao)->qpath = f->qpath;
 		(*ao)->off = 0;
-		(*ao)->length = f->dent->length;
+		(*ao)->end = f->dent->length;
 		(*ao)->dent = nil;
 	}
 	f->dent->gone = 1;
@@ -1797,7 +1797,7 @@
 		(*ao)->mnt = f->mnt;
 		(*ao)->qpath = f->qpath;
 		(*ao)->off = 0;
-		(*ao)->length = f->dent->length;
+		(*ao)->end = f->dent->length;
 		(*ao)->dent = f->dent;
 
 		f->dent->muid = f->uid;
@@ -2443,7 +2443,7 @@
 			if(am->dent != nil)
 				qlock(&am->dent->trunclk);
 			fs->snap.dirty = 1;
-			for(off = am->off; off < am->length; off += Blksz){
+			for(off = am->off; off < am->end; off += Blksz){
 				qlock(&fs->mutlk);
 				if(waserror()){
 					qunlock(&fs->mutlk);