linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Move all btrfs command to only one command
@ 2010-01-21 19:29 Goffredo Baroncelli
  2010-01-22  0:02 ` TARUISI Hiroaki
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Goffredo Baroncelli @ 2010-01-21 19:29 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Nicol, taruishi.hiroak

[-- Attachment #1: Type: text/plain, Size: 4091 bytes --]

Hi all

this RFC is about unify all btrfs command (btrfsctl, btrfs-show, btrfs-tune.. 
) in only one called "btrfs" (or whatever we want).

Today "btrfsctl" needs a "bit" of care because
  * the help is basically wrong [1]
  * the return codes are incoherent [2]
  * the syntax of the command are very ugly (a lot of people complained 
    about the subvolumes/snapshot creation, because they aren't very clear)
    [3]
  * the code is a mess (in the main there is a useless for(); there a lot
    of 'if' because sometime the last argument is the target of ioctl,
    sometime no..) [4]
  * The checks of the number of argument are incorrect [5]

I think that is better to rewrite from scratch a new command instead of 
patching the old one. So we don't care about the backward compatibility.

Other filesystem (hammer, tux3, zfs) have only one command for management 
purpose. Instead we have btrfsctl (which has a lot of different
function) and btrfs-show, btrfs-tune, btrfs-volume which have few functions.

There are patches which address [6] some of the previous issues, 
but these are not integrated (because the developers are busy on other 
issues). To me rewriting from scratch seems a fast path for solving these 
issues.

I made a prototype (see attached file) in bash of what "btrfs" should be. The 
major different from btrfsctl are:
- I talk about clone and not snapshot
- If a sub-volume is required (for example for the cloning), the program check 
that the argument is a root of the subvolume and not a subdirectory
- Creating a sub-volume requires only one argument 

Below some examples:

$ btrfs                         
Usage:                                              
        btrfs clone|-c <source> [<dest>/]<name>     
                Clone the subvolume <source> with the name <name> in the 
<dest>
                directory.                                                     
        btrfs delete|-d <subvolume>                                            
                Delete the subvolume <subvolume>.                              
        btrfs create|-C [<dest>/]<name>
                Create a subvolume in <dest> (or the current directory if not
                passed.
        btrfs defrag|-d <file>|<dir> [<file>|<dir>...]
                Defragment a file or a directory.
        btrfs fssync|-s <path>
                Force a fs sync on the filesystem <path>
        btrfs resize|-r [+/-]<newsize>[gkm]|max <filesystem>
                Resize the file system. If 'max' is passed, the filesystem
                will occupe all available space on the device.
        btrfs scan|-S [<device> [<device>..]
                Scan all device for or the passed device for a btrfs 
filesystem.
        btrfs show|-l <dev>|<label> [<dev>|<label>.. ]
                Show the btrfs devices
        btrfs balance|-b <path>
                Balance teh chunk across the device
        btrfs add|-A <dev> <path>
                Add a device to a filesystem
        btrfs rem|-R <dev> <path>
                Remove a device to a filesystem

        btrfs help|--help|-h
                Show the help.



Comment are welcome




[1] In the help the -r, -c options seem that don't need any further argument; 
The -D command seems that accpet only "." as 2nd parameter....

[2] If something goes wrong btrfsctl returns 1; if the ioctl return 0 the 
command still returns 1...

[3] See the email in the mailing list

[4] If I does
   btrfsctl -c -d -A -S a .
what result do you aspect ?

[5] If I pass more argument than the ones needed no error is showed. -D checks 
if there is only one argument, when it needs two argument...

[6] 
- 10/26/09 - little fixme in btrfsctl.c [PATCH] - From: 
David Nicol <davidnicol@gmail.com>
- 12/24/09 - [PATCH] btrfs-progs: check slash in deleting subvolumes. - From: 
TARUISI 
- 12/13/09 - [PATCH] Improve the btrfsctl help - From: 
Goffredo Baroncelli <kreijack@gmail.com>


-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

[-- Attachment #2: btrfs --]
[-- Type: application/x-shellscript, Size: 6413 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [RFC] Move all btrfs command to only one command
@ 2010-08-19 20:52 James Smith
  2010-08-20 12:03 ` Goffredo Baroncelli
  0 siblings, 1 reply; 26+ messages in thread
From: James Smith @ 2010-08-19 20:52 UTC (permalink / raw)
  To: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

This patch randomizes the error codes and also fixes up some typos including
capitalization in the output.

It would almost be nice to see a translation effort for the tool as well.

[-- Attachment #2: errcodes.diff --]
[-- Type: text/plain, Size: 15033 bytes --]

diff --git a/btrfs.c b/btrfs.c
index 4d263c4..3418837 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -44,52 +44,52 @@ static struct Command commands[] = {
 		avoid short commands different for the case only
 	*/
 	{ do_clone, 2,
-	  "subvolume snapshot", "<source> [<dest>/]<name>\n"
-		"Create a writable snapshot of the subvolume <source> with\n"
-		"the name <name> in the <dest> directory."
+	  "subvolume snapshot", "<Source> [<Dest>/]<Name>\n"
+		"Create a writable snapshot of the subvolume <Source> with\n"
+		"the name <Name> in the <Dest> directory."
 	},
 	{ do_delete_subvolume, 1,
-	  "subvolume delete", "<subvolume>\n"
-		"Delete the subvolume <subvolume>."
+	  "subvolume delete", "<Subvolume>\n"
+		"Delete the subvolume <Subvolume>."
 	},
 	{ do_create_subvol, 1,
-	  "subvolume create", "[<dest>/]<name>\n"
-		"Create a subvolume in <dest> (or the current directory if\n"
+	  "subvolume create", "[<Dest>/]<Name>\n"
+		"Create a subvolume in <Dest> (or the current directory if\n"
 		"not passed)."
 	},
 	{ do_defrag, -1,
-	  "filesystem defragment", "<file>|<dir> [<file>|<dir>...]\n"
+	  "filesystem defragment", "<File>|<Dir> [<File>|<Dir>...]\n"
 		"Defragment a file or a directory."
 	},
 	{ do_fssync, 1,
-	  "filesystem sync", "<path>\n"
-		"Force a sync on the filesystem <path>."
+	  "filesystem sync", "<Path>\n"
+		"Force a sync on the filesystem <Path>."
 	},
 	{ do_resize, 2,
-	  "filesystem resize", "[+/-]<newsize>[gkm]|max <filesystem>\n"
+	  "filesystem resize", "[+/-]<Newsize>[gkm]|max <Filesystem>\n"
 		"Resize the file system. If 'max' is passed, the filesystem\n"
-		"will occupe all available space on the device."
+		"will occupy all available space on the device."
 	},
 	{ do_show_filesystem, 999,
-	  "filesystem show", "[<uuid>|<label>]\n"
-		"Show the info of a btrfs filesystem. If no <uuid> or <label>\n"
-		"is passed, info of all the btrfs filesystem are shown."
+	  "filesystem show", "[<UUID>|<Label>]\n"
+		"Show all info about specific BTRFS filesystems. If no <UUID> or <Label>\n"
+		"is passed, information from all the BTRFS filesystems are shown."
 	},
 	{ do_balance, 1,
-	  "filesystem balance", "<path>\n"
+	  "filesystem balance", "<Path>\n"
 		"Balance the chunks across the device."
 	},
 	{ do_scan,
-	  999, "device scan", "[<device> [<device>..]\n"
-		"Scan all device for or the passed device for a btrfs\n"
+	  999, "device scan", "[<Device> [<Device>..]\n"
+		"Scan all devices or the passed device for a BTRFS\n"
 		"filesystem."
 	},	
 	{ do_add_volume, -1,
-	  "device add", "<dev> [<dev>..] <path>\n"
+	  "device add", "<Device> [<Device>..] <Path>\n"
 		"Add a device to a filesystem."
 	},
 	{ do_remove_volume, -1,
-	  "device delete", "<dev> [<dev>..] <path>\n"
+	  "device delete", "<Device> [<Device>..] <Path>\n"
 		"Remove a device from a filesystem."
 	},
 	/* coming soon
@@ -134,12 +134,13 @@ static void help(char *np)
 {
 	struct Command *cp;
 
-	printf("Usage:\n");
+	printf("VFS-2593 %s\n", BTRFS_BUILD_VERSION);
+	printf("\nNo matter where you go, there you are.\n");
+	printf("\nUsage:\n");
 	for( cp = commands; cp->verb; cp++ )
 		print_help(np, cp);
 
-	printf("\n\t%s help|--help|-h\n\t\tShow the help.\n",np);
-	printf("\n%s\n", BTRFS_BUILD_VERSION);
+	printf("\n\t%s help|--help|-h\n\t\tShow help.\n",np);
 }
 
 static int split_command(char *cmd, char ***commands)
@@ -195,7 +196,7 @@ static int check_ambiguity(struct Command *cmd, char **argv){
 		}
 		if(match){
 			int j;
-			fprintf(stderr, "ERROR: in command '");
+			fprintf(stderr, "ERR-A.11: in command '");
 			for( j = 0 ; j <= i ; j++ )
 				fprintf(stderr, "%s%s",j?" ":"", argv[j+1]);
 			fprintf(stderr, "', '%s' is ambiguous\n",argv[j]);
@@ -291,7 +292,7 @@ static int parse_args(int argc, char **argv,
 	}
 
 	if(!matchcmd){
-		fprintf( stderr, "ERROR: unknow command '%s'\n",argv[1]);
+		fprintf( stderr, "ERR-B.12: unknown command '%s'\n",argv[1]);
 		help(prgname);
 		return -1;
 	}
@@ -301,12 +302,12 @@ static int parse_args(int argc, char **argv,
 
 	/* check the number of argument */
 	if (matchcmd->nargs < 0 && matchcmd->nargs < -*nargs_ ){
-		fprintf(stderr, "ERROR: '%s' requires minimum %d arg(s)\n",
+		fprintf(stderr, "ERR-C.13: '%s' requires minimum %d arg(s)\n",
 			matchcmd->verb, -matchcmd->nargs);
 			return -2;
 	}
 	if(matchcmd->nargs >= 0 && matchcmd->nargs != *nargs_ && matchcmd->nargs != 999 ){
-		fprintf(stderr, "ERROR: '%s' requires %d arg(s)\n",
+		fprintf(stderr, "ERR-D.14: '%s' requires %d arg(s)\n",
 			matchcmd->verb, matchcmd->nargs);
 			return -2;
 	}
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index e112902..9475ac6 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -128,17 +128,17 @@ int do_clone(int argc, char **argv)
 
 	res = test_issubvolume(subvol);
 	if(res<0){
-		fprintf(stderr, "ERROR: error accessing '%s'\n", subvol);
+		fprintf(stderr, "ERR-A1: Error accessing '%s'\n", subvol);
 		return 12;
 	}
 	if(!res){
-		fprintf(stderr, "ERROR: '%s' is not a subvolume\n", subvol);
+		fprintf(stderr, "ERR-A2: '%s' is not a subvolume\n", subvol);
 		return 13;
 	}
 
 	res = test_isdir(dst);
 	if(res == 0 ){
-		fprintf(stderr, "ERROR: '%s' exists and it is not a directory\n", dst);
+		fprintf(stderr, "ERR-A3: '%s' exists and it is not a directory\n", dst);
 		return 12;
 	}
 
@@ -155,28 +155,28 @@ int do_clone(int argc, char **argv)
 
 	if( !strcmp(newname,".") || !strcmp(newname,"..") ||
 	     strchr(newname, '/') ){
-		fprintf(stderr, "ERROR: uncorrect snapshot name ('%s')\n",
+		fprintf(stderr, "ERR-B1: Uncorrect snapshot name ('%s')\n",
 			newname);
 		return 14;
 	}
 
 	len = strlen(newname);
 	if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
-		fprintf(stderr, "ERROR: snapshot name too long ('%s)\n",
+		fprintf(stderr, "ERR-B2: Snapshot name too long ('%s)\n",
 			newname);
 		return 14;
 	}
 
 	fddst = open_file_or_dir(dstdir);
 	if (fddst < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", dstdir);
+		fprintf(stderr, "ERR-B3: Can't access to '%s'\n", dstdir);
 		return 12;
 	}
 
 	fd = open_file_or_dir(subvol);
 	if (fd < 0) {
 		close(fddst);
-		fprintf(stderr, "ERROR: can't access to '%s'\n", dstdir);
+		fprintf(stderr, "ERR-B4: Can't access to '%s'\n", dstdir);
 		return 12;
 	}
 
@@ -190,7 +190,7 @@ int do_clone(int argc, char **argv)
 	close(fddst);
 
 	if(res < 0 ){
-		fprintf( stderr, "ERROR: cannot snapshot '%s'\n",subvol);
+		fprintf( stderr, "ERR-B5: Cannot snapshot '%s'\n",subvol);
 		return 11;
 	}
 
@@ -207,11 +207,11 @@ int do_delete_subvolume(int argc, char **argv)
 
 	res = test_issubvolume(path);
 	if(res<0){
-		fprintf(stderr, "ERROR: error accessing '%s'\n", path);
+		fprintf(stderr, "ERR-C1: Error accessing '%s'\n", path);
 		return 12;
 	}
 	if(!res){
-		fprintf(stderr, "ERROR: '%s' is not a subvolume\n", path);
+		fprintf(stderr, "ERR-C2: '%s' is not a subvolume\n", path);
 		return 13;
 	}
 
@@ -224,14 +224,14 @@ int do_delete_subvolume(int argc, char **argv)
 
 	if( !strcmp(vname,".") || !strcmp(vname,"..") ||
 	     strchr(vname, '/') ){
-		fprintf(stderr, "ERROR: uncorrect subvolume name ('%s')\n",
+		fprintf(stderr, "ERR-C3: Incorrect subvolume name ('%s')\n",
 			vname);
 		return 14;
 	}
 
 	len = strlen(vname);
 	if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
-		fprintf(stderr, "ERROR: snapshot name too long ('%s)\n",
+		fprintf(stderr, "ERR-C4: Snapshot name too long ('%s)\n",
 			vname);
 		return 14;
 	}
@@ -239,7 +239,7 @@ int do_delete_subvolume(int argc, char **argv)
 	fd = open_file_or_dir(dname);
 	if (fd < 0) {
 		close(fd);
-		fprintf(stderr, "ERROR: can't access to '%s'\n", dname);
+		fprintf(stderr, "ERR-C5: Can't access to '%s'\n", dname);
 		return 12;
 	}
 
@@ -250,7 +250,7 @@ int do_delete_subvolume(int argc, char **argv)
 	close(fd);
 
 	if(res < 0 ){
-		fprintf( stderr, "ERROR: cannot delete '%s/%s'\n",dname, vname);
+		fprintf( stderr, "ERR-C6: Cannot delete '%s/%s'\n",dname, vname);
 		return 11;
 	}
 
@@ -268,7 +268,7 @@ int do_create_subvol(int argc, char **argv)
 
 	res = test_isdir(dst);
 	if(res >= 0 ){
-		fprintf(stderr, "ERROR: '%s' exists\n", dst);
+		fprintf(stderr, "ERR-D1: '%s' exists\n", dst);
 		return 12;
 	}
 
@@ -279,21 +279,21 @@ int do_create_subvol(int argc, char **argv)
 
 	if( !strcmp(newname,".") || !strcmp(newname,"..") ||
 	     strchr(newname, '/') ){
-		fprintf(stderr, "ERROR: uncorrect subvolume name ('%s')\n",
+		fprintf(stderr, "ERR-D2: Incorrect subvolume name ('%s')\n",
 			newname);
 		return 14;
 	}
 	
 	len = strlen(newname);
 	if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
-		fprintf(stderr, "ERROR: subvolume name too long ('%s)\n",
+		fprintf(stderr, "ERR-D3: Subvolume name too long ('%s)\n",
 			newname);
 		return 14;
 	}
 
 	fddst = open_file_or_dir(dstdir);
 	if (fddst < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", dstdir);
+		fprintf(stderr, "ERR-D4: Can't access to '%s'\n", dstdir);
 		return 12;
 	}
 
@@ -304,7 +304,7 @@ int do_create_subvol(int argc, char **argv)
 	close(fddst);
 
 	if(res < 0 ){
-		fprintf( stderr, "ERROR: cannot create subvolume\n");
+		fprintf( stderr, "ERR-D5: Cannot create subvolume\n");
 		return 11;
 	}
 
@@ -319,7 +319,7 @@ int do_fssync(int argc, char **argv)
 
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+		fprintf(stderr, "ERR-D6: Can't access to '%s'\n", path);
 		return 12;
 	}
 
@@ -327,7 +327,7 @@ int do_fssync(int argc, char **argv)
 	res = ioctl(fd, BTRFS_IOC_SYNC);
 	close(fd);
 	if( res < 0 ){
-		fprintf(stderr, "ERROR: unable to fs-syncing '%s'\n", path);
+		fprintf(stderr, "ERR-D7: Unable to drop-sync '%s'\n", path);
 		return 16;
 	}
 
@@ -343,7 +343,7 @@ int do_scan(int nargs, char **argv)
 		printf("Scanning for Btrfs filesystems\n");
 		ret = btrfs_scan_one_dir("/dev", 1);
 		if (ret){
-			fprintf(stderr, "ERROR: error %d while scanning\n", ret);
+			fprintf(stderr, "ERR-E1: Error %d while scanning\n", ret);
 			return 18;
 		}
 		return 0;
@@ -351,7 +351,7 @@ int do_scan(int nargs, char **argv)
 
 	fd = open("/dev/btrfs-control", O_RDWR);
 	if (fd < 0) {
-		perror("failed to open /dev/btrfs-control");
+		perror("ERR-E2: Failed to open /dev/btrfs-control");
 		return 10;
 	}
 
@@ -371,7 +371,7 @@ int do_scan(int nargs, char **argv)
 
 		if( ret < 0 ){
 			close(fd);
-			fprintf(stderr, "ERROR: unable to scan the device '%s'\n", argv[i]);
+			fprintf(stderr, "ERR-E3: Unable to scan the device '%s'\n", argv[i]);
 			return 11;
 		}
 	}
@@ -391,7 +391,7 @@ int do_defrag(int argc, char **argv)
 		char	*path = argv[i];
 		fd = open_file_or_dir(path);
 		if (fd < 0) {
-			fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+			fprintf(stderr, "ERR-F1: Can't access to '%s'\n", path);
 			ret++;
 			continue;
 		}
@@ -400,7 +400,7 @@ int do_defrag(int argc, char **argv)
 		res = ioctl(fd, BTRFS_IOC_DEFRAG);
 		close(fd);
 		if( res < 0 ){
-			fprintf(stderr, "ERROR: unable to defrag '%s'\n", argv[i]);
+			fprintf(stderr, "ERR-F2: Unable to defragment '%s'\n", argv[i]);
 			ret++;
 			continue;
 		}
@@ -423,22 +423,22 @@ int do_resize(int argc, char **argv)
 	
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+		fprintf(stderr, "ERR-G1: Can't access to '%s'\n", path);
 		return 12;
 	}
 	len = strlen(amount);
 	if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
-		fprintf(stderr, "ERROR: size value too long ('%s)\n",
+		fprintf(stderr, "ERR-G2: Size value too long ('%s)\n",
 			amount);
 		return 14;
 	}
 
-	printf("Resize '%s' of '%s'\n", path, amount);
+	printf("Resizing '%s' of '%s'\n", path, amount);
 	strcpy(args.name, amount);
 	res = ioctl(fd, BTRFS_IOC_RESIZE, &args);
 	close(fd);
 	if( res < 0 ){
-		fprintf(stderr, "ERROR: unable to resize '%s'\n", path);
+		fprintf(stderr, "ERR-G3: Unable to resize '%s'\n", path);
 		return 30;
 	}
 	return 0;
@@ -497,7 +497,7 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices)
 		devs_found++;
 	}
 	if (devs_found < total) {
-		printf("\t*** Some devices missing\n");
+		printf("\t *** Some devices missing\n");
 	}
 	printf("\n");
 }
@@ -512,7 +512,7 @@ int do_show_filesystem(int argc, char **argv)
 
 	ret = btrfs_scan_one_dir("/dev", 0);
 	if (ret){
-		fprintf(stderr, "ERROR: error %d while scanning\n", ret);
+		fprintf(stderr, "ERR-H1: Error %d while scanning\n", ret);
 		return 18;
 	}
 
@@ -537,7 +537,7 @@ int do_add_volume(int nargs, char **args)
 
 	fdmnt = open_file_or_dir(mntpnt);
 	if (fdmnt < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", mntpnt);
+		fprintf(stderr, "ERR-I1: Can't access to '%s'\n", mntpnt);
 		return 12;
 	}
 
@@ -549,20 +549,20 @@ int do_add_volume(int nargs, char **args)
 
 		devfd = open(args[i], O_RDWR);
 		if (!devfd) {
-			fprintf(stderr, "ERROR: Unable to open device '%s'\n", args[i]);
+			fprintf(stderr, "ERR-I2: Unable to open device '%s'\n", args[i]);
 			close(devfd);
 			ret++;
 			continue;
 		}
 		ret = fstat(devfd, &st);
 		if (ret) {
-			fprintf(stderr, "ERROR: Unable to stat '%s'\n", args[i]);
+			fprintf(stderr, "ERR-I3: Unable to stat '%s'\n", args[i]);
 			close(devfd);
 			ret++;
 			continue;
 		}
 		if (!S_ISBLK(st.st_mode)) {
-			fprintf(stderr, "ERROR: '%s' is not a block device\n", args[i]);
+			fprintf(stderr, "ERR-I4: '%s' is not a block device\n", args[i]);
 			close(devfd);
 			ret++;
 			continue;
@@ -570,7 +570,7 @@ int do_add_volume(int nargs, char **args)
 
 		res = btrfs_prepare_device(devfd, args[i], 1, &dev_block_count);
 		if (ret) {
-			fprintf(stderr, "ERROR: Unable to init '%s'\n", args[i]);
+			fprintf(stderr, "ERR-I5: Unable to init '%s'\n", args[i]);
 			close(devfd);
 			ret++;
 			continue;
@@ -580,7 +580,7 @@ int do_add_volume(int nargs, char **args)
 		strcpy(ioctl_args.name, args[i]);
 		res = ioctl(fdmnt, BTRFS_IOC_ADD_DEV, &ioctl_args);
 		if(res<0){
-			fprintf(stderr, "ERROR: error adding the device '%s'\n", args[i]);
+			fprintf(stderr, "ERR-I6: Error adding the device '%s'\n", args[i]);
 			ret++;
 		}
 
@@ -602,14 +602,14 @@ int do_balance(int argc, char **argv)
 
 	fdmnt = open_file_or_dir(path);
 	if (fdmnt < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+		fprintf(stderr, "ERR-J1: Can't access to '%s'\n", path);
 		return 12;
 	}
 
 	ret = ioctl(fdmnt, BTRFS_IOC_BALANCE);
 	close(fdmnt);
 	if(ret<0){
-		fprintf(stderr, "ERROR: balancing '%s'\n", path);
+		fprintf(stderr, "ERR-J2: Balancing '%s'\n", path);
 
 		return 19;
 	}
@@ -623,7 +623,7 @@ int do_remove_volume(int nargs, char **args)
 
 	fdmnt = open_file_or_dir(mntpnt);
 	if (fdmnt < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", mntpnt);
+		fprintf(stderr, "ERR-K1: Can't access to '%s'\n", mntpnt);
 		return 12;
 	}
 
@@ -634,7 +634,7 @@ int do_remove_volume(int nargs, char **args)
 		strcpy(arg.name, args[i]);
 		res = ioctl(fdmnt, BTRFS_IOC_RM_DEV, &arg);
 		if(res<0){
-			fprintf(stderr, "ERROR: error removing the device '%s'\n", args[i]);
+			fprintf(stderr, "ERR-K2: Error removing the device '%s'\n", args[i]);
 			ret++;
 		}
 	}

^ permalink raw reply related	[flat|nested] 26+ messages in thread
* Re: [RFC] Move all btrfs command to only one command
@ 2010-08-20 12:12 Goffredo Baroncelli
  0 siblings, 0 replies; 26+ messages in thread
From: Goffredo Baroncelli @ 2010-08-20 12:12 UTC (permalink / raw)
  To: linux-btrfs

On Friday, 20 August, 2010, Goffredo Baroncelli wrote:
> On Thursday, 19 August, 2010, James Smith wrote:
> > This patch randomizes the error codes and also fixes up some typos 
> including
> > capitalization in the output.

I think that you should also update the btrfs man page in order to reflect 
your changing:
- the capitalization of the command arguments
- the list of error codes for every commands

Regards
G.Baroncelli


> > It would almost be nice to see a translation effort for the tool as well.
> > 
> 
> Hi James,
> 
> I don't comment the changing the capitalization. Regarding the other 
changes:
> 
> [...]
>  {
>  	struct Command *cp;
>  
> -	printf("Usage:\n");
> +	printf("VFS-2593 %s\n", BTRFS_BUILD_VERSION);
>                 ^^^^^^^^
> 
> What means VFS-2593 ?
> 
> +	printf("\nNo matter where you go, there you are.\n");
> 
> Is it really useful this kind of comment ?
> 
> 
> [...]
> 
> +			fprintf(stderr, "ERR-A.11: in command '");
> 
> I am not against this kind of error codes, but I prefer
> 
> +			fprintf(stderr, "Error 'ERR-A.11' in command '");
> 
> And a file.txt which details the error codes (otherwise these errors are 
not 
> very useful).
> 
> Why some error codes contain a dot (see ERR-C.13) and others not (like ERR-
> A3) ?
> 
> 
> Reagrds
> G.Baroncelli
> 
> -- 
> gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) 
> <kreijackATinwind.it>
> Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-08-27  3:38 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 19:29 [RFC] Move all btrfs command to only one command Goffredo Baroncelli
2010-01-22  0:02 ` TARUISI Hiroaki
2010-01-22  0:11 ` Michael Niederle
2010-01-22  9:33   ` Xavier Nicollet
2010-01-22  8:23 ` Adrian von Bidder
2010-01-24 17:35 ` [RFC] Move all btrfs command to only one command: btrfs.c Goffredo Baroncelli
2010-01-24 18:34   ` Piavlo
2010-02-11 16:33   ` Chris Mason
2010-02-11 18:15     ` Goffredo Baroncelli
2010-02-11 21:20     ` rk
2010-02-11 21:29       ` Goffredo Baroncelli
  -- strict thread matches above, loose matches on Subject: below --
2010-08-19 20:52 [RFC] Move all btrfs command to only one command James Smith
2010-08-20 12:03 ` Goffredo Baroncelli
2010-08-20 12:43   ` Jon Nelson
2010-08-20 14:42     ` Benjamin Griese
2010-08-20 18:56       ` Goffredo Baroncelli
2010-08-20 18:27   ` Josh Berry
2010-08-20 18:34     ` Andreas Philipp
2010-08-20 18:49       ` Josh Berry
2010-08-20 19:00         ` Andreas Philipp
2010-08-20 20:28           ` Josh Berry
2010-08-21  4:51             ` James Smith
2010-08-21  9:37               ` Goffredo Baroncelli
     [not found]                 ` <AANLkTikJd8bDU1Eq22u0+yQ8eBCUn3OXHoE5E7uy+SG=@mail.gmail.com>
     [not found]                   ` <AANLkTi=VpZv26jntJ8mwmxtjnQ5LDOn_MSm6VtEhJ1CB@mail.gmail.com>
2010-08-27  3:38                     ` James Smith
2010-08-20 19:03         ` Goffredo Baroncelli
2010-08-20 12:12 Goffredo Baroncelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).