Skip to contentSkip to conversation

BTRFS-PROG: prefix with ERROR the mkfs error messages

PATCH New Goffredo Baroncelli 2 participants 3 messages Nov 15, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BTRFS-PROG: prefix with ERROR the mkfs error messages

Prefix with "ERROR:" the error messages of mkfs

Add the ERROR prefix to the error messages of mkfs, to align it to the btrfs main utility style.

The patch also increase the buffer size of test_dev_for_mkfs() and test_num_disk_vs_raid() for the error message from 100 to 150 because the former become too small.

#1 lore raw

PATCH 1/1 Prefix with "ERROR:" the error messages of mkfs

Add the ERROR prefix to the error messages of mkfs, to align it to the btrfs main utility style.

The patch increase the buffer size of test_dev_for_mkfs() and test_num_disk_vs_raid() for the error message from 100 to 150 because the former become too small.

---
 cmds-replace.c |  2 +-
 mkfs.c         | 54 +++++++++++++++++++++++++++++-------------------------
 utils.c        | 10 +++++-----
 3 files changed, 35 insertions(+), 31 deletions(-)
cmds-replace.c +1 -1
index d9b0940..812c5d7 100644
@@ -142,7 +142,7 @@ static int cmd_start_replace(int argc, char **argv)
 	int do_not_background = 0;
 	int mixed = 0;
 	DIR *dirstream = NULL;
-	char estr[100]; /* check test_dev_for_mkfs() for error string size*/
+	char estr[150]; /* check test_dev_for_mkfs() for error string size*/
 
 	while ((c = getopt(argc, argv, "Brf")) != -1) {
 		switch (c) {
mkfs.c +29 -25

192 lines not on this page · raw message

utils.c +5 -5
index f499023..c9253e3 100644
@@ -1851,7 +1851,7 @@ out:
 int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 	u64 dev_cnt, int mixed, char *estr)
 {
-	size_t sz = 100;
+	size_t sz = 150;
 	u64 allowed = 0;
 
 	switch (dev_cnt) {
@@ -1869,13 +1869,13 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 	}
 
 	if (metadata_profile & ~allowed) {
-		snprintf(estr, sz, "unable to create FS with metadata "
+		snprintf(estr, sz, "ERROR: unable to create FS with metadata" 
 			"profile %llu (have %llu devices)\n",
 			metadata_profile, dev_cnt);
 		return 1;
 	}
 	if (data_profile & ~allowed) {
-		snprintf(estr, sz, "unable to create FS with data "
+		snprintf(estr, sz, "ERROR: unable to create FS with data "
 			"profile %llu (have %llu devices)\n",
 			metadata_profile, dev_cnt);
 		return 1;
@@ -1883,7 +1883,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 
 	if (!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP)) {
 		snprintf(estr, sz,
-			"dup for data is allowed only in mixed mode");
+			"ERROR: dup for data is allowed only in mixed mode");
 		return 1;
 	}
 	return 0;
@@ -1897,7 +1897,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 int test_dev_for_mkfs(char *file, int force_overwrite, char *estr)
 {
 	int ret, fd;
-	size_t sz = 100;
+	size_t sz = 150;
 	struct stat st;
 
 	ret = is_swap_device(file);
Signature · 1 line
1.8.4.3
#2 lore raw

Re: [PATCH] Prefix with "ERROR:" the error messages of mkfs

Quoted 6 lines · Goffredo Baroncelli

Add the ERROR prefix to the error messages of mkfs, to align it to the btrfs main utility style.

The patch increase the buffer size of test_dev_for_mkfs() and test_num_disk_vs_raid() for the error message from 100 to 150 because the former become too small.

This was discussed some time ago, that the error message should not be passed that way via caller-provided variable.

I'd tend to take this patch now because of the improved messages.