shithub: riscv

Download patch

ref: c5c19dfe4998fa40de5f58f61439fd5fd65c9056
parent: d6923e0f149eec4f9ba8c83fbb286b92ae7da25a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Feb 24 15:43:38 EST 2024

ext4srv: generate a uuid when doing mkfs; don't journal ext2

--- a/sys/src/cmd/ext4srv/part.c
+++ b/sys/src/cmd/ext4srv/part.c
@@ -268,10 +268,11 @@
 	struct ext4_mkfs_info info;
 	struct ext4_fs fs;
 	u32int blksz;
+	ulong rn;
+	int f, i;
 	Part *p;
 	char *s;
 	Dir *d;
-	int f;
 
 	d = nil;
 	p = nil;
@@ -313,7 +314,11 @@
 			snprint(info.label, sizeof(info.label), opts->label);
 			info.inode_size = opts->inodesz;
 			info.inodes = opts->ninode;
-			info.journal = true;
+			info.journal = opts->fstype > 2;
+			for(i = 0; i < 16; i += 4){
+				rn = truerand();
+				memcpy(info.uuid+i, &rn, 4);
+			}
 			if(ext4_mkfs(&fs, &p->bdev, &info, opts->fstype) < 0){
 				werrstr("mkfs: %r");
 				goto error;