All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message
@ 2015-11-09  9:59 Zhao Lei
  2015-11-09  9:59 ` [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Zhao Lei
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Zhao Lei @ 2015-11-09  9:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Zhao Lei

Switch to common warning()/error() for cmds-device.c.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-device.c | 57 +++++++++++++++++++++++----------------------------------
 1 file changed, 23 insertions(+), 34 deletions(-)

diff --git a/cmds-device.c b/cmds-device.c
index 2ed32a2..e23ea61 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -102,7 +102,7 @@ static int cmd_device_add(int argc, char **argv)
 
 		devfd = open(argv[i], O_RDWR);
 		if (devfd < 0) {
-			fprintf(stderr, "ERROR: Unable to open device '%s'\n", argv[i]);
+			error("Unable to open device '%s'", argv[i]);
 			ret++;
 			continue;
 		}
@@ -117,9 +117,8 @@ static int cmd_device_add(int argc, char **argv)
 
 		path = canonicalize_path(argv[i]);
 		if (!path) {
-			fprintf(stderr,
-				"ERROR: Could not canonicalize pathname '%s': %s\n",
-				argv[i], strerror(errno));
+			error("Could not canonicalize pathname '%s': %s",
+			      argv[i], strerror(errno));
 			ret++;
 			goto error_out;
 		}
@@ -129,8 +128,8 @@ static int cmd_device_add(int argc, char **argv)
 		res = ioctl(fdmnt, BTRFS_IOC_ADD_DEV, &ioctl_args);
 		e = errno;
 		if (res < 0) {
-			fprintf(stderr, "ERROR: error adding the device '%s' - %s\n",
-				path, strerror(e));
+			error("error adding the device '%s' - %s",
+			      path, strerror(e));
 			ret++;
 		}
 		free(path);
@@ -162,8 +161,7 @@ static int _cmd_device_remove(int argc, char **argv,
 		int	res;
 
 		if (is_block_device(argv[i]) != 1) {
-			fprintf(stderr,
-				"ERROR: %s is not a block device\n", argv[i]);
+			error("%s is not a block device", argv[i]);
 			ret++;
 			continue;
 		}
@@ -178,9 +176,8 @@ static int _cmd_device_remove(int argc, char **argv,
 				msg = btrfs_err_str(res);
 			else
 				msg = strerror(e);
-			fprintf(stderr,
-				"ERROR: error removing the device '%s' - %s\n",
-				argv[i], msg);
+			error("error removing the device '%s' - %s",
+			      argv[i], msg);
 			ret++;
 		}
 	}
@@ -251,11 +248,9 @@ static int cmd_device_scan(int argc, char **argv)
 	if (all || argc == 1) {
 		printf("Scanning for Btrfs filesystems\n");
 		ret = btrfs_scan_lblkid();
-		if (ret)
-			fprintf(stderr, "ERROR: error %d while scanning\n", ret);
+		error_on(ret, "error %d while scanning", ret);
 		ret = btrfs_register_all_devices();
-		if (ret)
-			fprintf(stderr, "ERROR: error %d while registering\n", ret);
+		error_on(ret, "error %d while registering", ret);
 		goto out;
 	}
 
@@ -263,16 +258,14 @@ static int cmd_device_scan(int argc, char **argv)
 		char *path;
 
 		if (is_block_device(argv[i]) != 1) {
-			fprintf(stderr,
-				"ERROR: %s is not a block device\n", argv[i]);
+			error("%s is not a block device", argv[i]);
 			ret = 1;
 			goto out;
 		}
 		path = canonicalize_path(argv[i]);
 		if (!path) {
-			fprintf(stderr,
-				"ERROR: Could not canonicalize path '%s': %s\n",
-				argv[i], strerror(errno));
+			error("Could not canonicalize path '%s': %s",
+			      argv[i], strerror(errno));
 			ret = 1;
 			goto out;
 		}
@@ -313,16 +306,14 @@ static int cmd_device_ready(int argc, char **argv)
 
 	path = canonicalize_path(argv[argc - 1]);
 	if (!path) {
-		fprintf(stderr,
-			"ERROR: Could not canonicalize pathname '%s': %s\n",
-			argv[argc - 1], strerror(errno));
+		error("Could not canonicalize pathname '%s': %s",
+		      argv[argc - 1], strerror(errno));
 		ret = 1;
 		goto out;
 	}
 
 	if (is_block_device(path) != 1) {
-		fprintf(stderr,
-			"ERROR: %s is not a block device\n", path);
+		error("%s is not a block device", path);
 		ret = 1;
 		goto out;
 	}
@@ -331,9 +322,8 @@ static int cmd_device_ready(int argc, char **argv)
 	strncpy_null(args.name, path);
 	ret = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
 	if (ret < 0) {
-		fprintf(stderr, "ERROR: unable to determine if the device '%s'"
-			" is ready for mounting - %s\n", path,
-			strerror(errno));
+		error("unable to determine if the device '%s' is ready for mounting - %s",
+		      path, strerror(errno));
 		ret = 1;
 	}
 
@@ -388,13 +378,13 @@ static int cmd_device_stats(int argc, char **argv)
 
 	ret = get_fs_info(dev_path, &fi_args, &di_args);
 	if (ret) {
-		fprintf(stderr, "ERROR: getting dev info for devstats failed: "
-				"%s\n", strerror(-ret));
+		error("getting dev info for devstats failed: %s",
+		      strerror(-ret));
 		err = 1;
 		goto out;
 	}
 	if (!fi_args.num_devices) {
-		fprintf(stderr, "ERROR: no devices found\n");
+		error("no devices found");
 		err = 1;
 		goto out;
 	}
@@ -412,9 +402,8 @@ static int cmd_device_stats(int argc, char **argv)
 		args.flags = flags;
 
 		if (ioctl(fdmnt, BTRFS_IOC_GET_DEV_STATS, &args) < 0) {
-			fprintf(stderr,
-				"ERROR: ioctl(BTRFS_IOC_GET_DEV_STATS) on %s failed: %s\n",
-				path, strerror(errno));
+			error("ioctl(BTRFS_IOC_GET_DEV_STATS) on %s failed: %s",
+			      path, strerror(errno));
 			err = 1;
 		} else {
 			char *canonical_path;
-- 
1.8.5.1


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

* [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage
  2015-11-09  9:59 [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Zhao Lei
@ 2015-11-09  9:59 ` Zhao Lei
  2015-11-13 16:49   ` David Sterba
  2015-11-09  9:59 ` [PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage Zhao Lei
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Zhao Lei @ 2015-11-09  9:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Zhao Lei

1: Remove more_than_one variant, use iterator's value instead
2: Remove "out" mark, use break instead.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-device.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/cmds-device.c b/cmds-device.c
index e23ea61..739405b 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -487,7 +487,6 @@ static int cmd_device_usage(int argc, char **argv)
 {
 	unsigned unit_mode;
 	int ret = 0;
-	int more_than_one = 0;
 	int i;
 
 	unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
@@ -499,23 +498,22 @@ static int cmd_device_usage(int argc, char **argv)
 		int fd;
 		DIR *dirstream = NULL;
 
-		if (more_than_one)
+		if (i > 1)
 			printf("\n");
 
 		fd = btrfs_open_dir(argv[i], &dirstream, 1);
 		if (fd < 0) {
 			ret = 1;
-			goto out;
+			break;
 		}
 
 		ret = _cmd_device_usage(fd, argv[i], unit_mode);
 		close_file_or_dir(fd, dirstream);
 
 		if (ret)
-			goto out;
-		more_than_one = 1;
+			break;
 	}
-out:
+
 	return !!ret;
 }
 
-- 
1.8.5.1


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

* [PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage
  2015-11-09  9:59 [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Zhao Lei
  2015-11-09  9:59 ` [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Zhao Lei
@ 2015-11-09  9:59 ` Zhao Lei
  2015-11-09 10:33 ` [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Anand Jain
  2015-11-13 16:48 ` David Sterba
  3 siblings, 0 replies; 8+ messages in thread
From: Zhao Lei @ 2015-11-09  9:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Zhao Lei

Argument of char *path in _cmd_device_usage() is not necessary,
remove it.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmds-device.c b/cmds-device.c
index 739405b..190bed6 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -454,7 +454,7 @@ static const char * const cmd_device_usage_usage[] = {
 	NULL
 };
 
-static int _cmd_device_usage(int fd, char *path, unsigned unit_mode)
+static int _cmd_device_usage(int fd, unsigned unit_mode)
 {
 	int i;
 	int ret = 0;
@@ -507,7 +507,7 @@ static int cmd_device_usage(int argc, char **argv)
 			break;
 		}
 
-		ret = _cmd_device_usage(fd, argv[i], unit_mode);
+		ret = _cmd_device_usage(fd, unit_mode);
 		close_file_or_dir(fd, dirstream);
 
 		if (ret)
-- 
1.8.5.1


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

* Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message
  2015-11-09  9:59 [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Zhao Lei
  2015-11-09  9:59 ` [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Zhao Lei
  2015-11-09  9:59 ` [PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage Zhao Lei
@ 2015-11-09 10:33 ` Anand Jain
  2015-11-11  3:44   ` Zhao Lei
  2015-11-13 16:48 ` David Sterba
  3 siblings, 1 reply; 8+ messages in thread
From: Anand Jain @ 2015-11-09 10:33 UTC (permalink / raw)
  To: Zhao Lei; +Cc: linux-btrfs, dsterba

Hi Zhao,

Hope you could do this/apply on top of patch set

    "Introduce device delete by devid"

I vaguely remember that patchset as well did some cleanups
in this part of the code.

Thanks, Anand


On 11/09/2015 05:59 PM, Zhao Lei wrote:
> Switch to common warning()/error() for cmds-device.c.
>
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>   cmds-device.c | 57 +++++++++++++++++++++++----------------------------------
>   1 file changed, 23 insertions(+), 34 deletions(-)
>
> diff --git a/cmds-device.c b/cmds-device.c
> index 2ed32a2..e23ea61 100644
> --- a/cmds-device.c
> +++ b/cmds-device.c
> @@ -102,7 +102,7 @@ static int cmd_device_add(int argc, char **argv)
>
>   		devfd = open(argv[i], O_RDWR);
>   		if (devfd < 0) {
> -			fprintf(stderr, "ERROR: Unable to open device '%s'\n", argv[i]);
> +			error("Unable to open device '%s'", argv[i]);
>   			ret++;
>   			continue;
>   		}
> @@ -117,9 +117,8 @@ static int cmd_device_add(int argc, char **argv)
>
>   		path = canonicalize_path(argv[i]);
>   		if (!path) {
> -			fprintf(stderr,
> -				"ERROR: Could not canonicalize pathname '%s': %s\n",
> -				argv[i], strerror(errno));
> +			error("Could not canonicalize pathname '%s': %s",
> +			      argv[i], strerror(errno));
>   			ret++;
>   			goto error_out;
>   		}
> @@ -129,8 +128,8 @@ static int cmd_device_add(int argc, char **argv)
>   		res = ioctl(fdmnt, BTRFS_IOC_ADD_DEV, &ioctl_args);
>   		e = errno;
>   		if (res < 0) {
> -			fprintf(stderr, "ERROR: error adding the device '%s' - %s\n",
> -				path, strerror(e));
> +			error("error adding the device '%s' - %s",
> +			      path, strerror(e));
>   			ret++;
>   		}
>   		free(path);
> @@ -162,8 +161,7 @@ static int _cmd_device_remove(int argc, char **argv,
>   		int	res;
>
>   		if (is_block_device(argv[i]) != 1) {
> -			fprintf(stderr,
> -				"ERROR: %s is not a block device\n", argv[i]);
> +			error("%s is not a block device", argv[i]);
>   			ret++;
>   			continue;
>   		}
> @@ -178,9 +176,8 @@ static int _cmd_device_remove(int argc, char **argv,
>   				msg = btrfs_err_str(res);
>   			else
>   				msg = strerror(e);
> -			fprintf(stderr,
> -				"ERROR: error removing the device '%s' - %s\n",
> -				argv[i], msg);
> +			error("error removing the device '%s' - %s",
> +			      argv[i], msg);
>   			ret++;
>   		}
>   	}
> @@ -251,11 +248,9 @@ static int cmd_device_scan(int argc, char **argv)
>   	if (all || argc == 1) {
>   		printf("Scanning for Btrfs filesystems\n");
>   		ret = btrfs_scan_lblkid();
> -		if (ret)
> -			fprintf(stderr, "ERROR: error %d while scanning\n", ret);
> +		error_on(ret, "error %d while scanning", ret);
>   		ret = btrfs_register_all_devices();
> -		if (ret)
> -			fprintf(stderr, "ERROR: error %d while registering\n", ret);
> +		error_on(ret, "error %d while registering", ret);
>   		goto out;
>   	}
>
> @@ -263,16 +258,14 @@ static int cmd_device_scan(int argc, char **argv)
>   		char *path;
>
>   		if (is_block_device(argv[i]) != 1) {
> -			fprintf(stderr,
> -				"ERROR: %s is not a block device\n", argv[i]);
> +			error("%s is not a block device", argv[i]);
>   			ret = 1;
>   			goto out;
>   		}
>   		path = canonicalize_path(argv[i]);
>   		if (!path) {
> -			fprintf(stderr,
> -				"ERROR: Could not canonicalize path '%s': %s\n",
> -				argv[i], strerror(errno));
> +			error("Could not canonicalize path '%s': %s",
> +			      argv[i], strerror(errno));
>   			ret = 1;
>   			goto out;
>   		}
> @@ -313,16 +306,14 @@ static int cmd_device_ready(int argc, char **argv)
>
>   	path = canonicalize_path(argv[argc - 1]);
>   	if (!path) {
> -		fprintf(stderr,
> -			"ERROR: Could not canonicalize pathname '%s': %s\n",
> -			argv[argc - 1], strerror(errno));
> +		error("Could not canonicalize pathname '%s': %s",
> +		      argv[argc - 1], strerror(errno));
>   		ret = 1;
>   		goto out;
>   	}
>
>   	if (is_block_device(path) != 1) {
> -		fprintf(stderr,
> -			"ERROR: %s is not a block device\n", path);
> +		error("%s is not a block device", path);
>   		ret = 1;
>   		goto out;
>   	}
> @@ -331,9 +322,8 @@ static int cmd_device_ready(int argc, char **argv)
>   	strncpy_null(args.name, path);
>   	ret = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
>   	if (ret < 0) {
> -		fprintf(stderr, "ERROR: unable to determine if the device '%s'"
> -			" is ready for mounting - %s\n", path,
> -			strerror(errno));
> +		error("unable to determine if the device '%s' is ready for mounting - %s",
> +		      path, strerror(errno));
>   		ret = 1;
>   	}
>
> @@ -388,13 +378,13 @@ static int cmd_device_stats(int argc, char **argv)
>
>   	ret = get_fs_info(dev_path, &fi_args, &di_args);
>   	if (ret) {
> -		fprintf(stderr, "ERROR: getting dev info for devstats failed: "
> -				"%s\n", strerror(-ret));
> +		error("getting dev info for devstats failed: %s",
> +		      strerror(-ret));
>   		err = 1;
>   		goto out;
>   	}
>   	if (!fi_args.num_devices) {
> -		fprintf(stderr, "ERROR: no devices found\n");
> +		error("no devices found");
>   		err = 1;
>   		goto out;
>   	}
> @@ -412,9 +402,8 @@ static int cmd_device_stats(int argc, char **argv)
>   		args.flags = flags;
>
>   		if (ioctl(fdmnt, BTRFS_IOC_GET_DEV_STATS, &args) < 0) {
> -			fprintf(stderr,
> -				"ERROR: ioctl(BTRFS_IOC_GET_DEV_STATS) on %s failed: %s\n",
> -				path, strerror(errno));
> +			error("ioctl(BTRFS_IOC_GET_DEV_STATS) on %s failed: %s",
> +			      path, strerror(errno));
>   			err = 1;
>   		} else {
>   			char *canonical_path;
>

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

* RE: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message
  2015-11-09 10:33 ` [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Anand Jain
@ 2015-11-11  3:44   ` Zhao Lei
  2015-11-13 16:50     ` David Sterba
  0 siblings, 1 reply; 8+ messages in thread
From: Zhao Lei @ 2015-11-11  3:44 UTC (permalink / raw)
  To: 'Anand Jain'; +Cc: linux-btrfs, dsterba

Hi, Anand Jain

> -----Original Message-----
> From: Anand Jain [mailto:anand.jain@oracle.com]
> Sent: Monday, November 09, 2015 6:34 PM
> To: Zhao Lei <zhaolei@cn.fujitsu.com>
> Cc: linux-btrfs@vger.kernel.org; dsterba@suse.cz
> Subject: Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error
> message
> 
> Hi Zhao,
> 
> Hope you could do this/apply on top of patch set
> 
>     "Introduce device delete by devid"
> 
> I vaguely remember that patchset as well did some cleanups in this part of the
> code.
> 
Thanks for notice.

I'll rebase it after patchset of "Introduce device delete by devid" get applied
into devel branch.

Thanks
Zhaolei

> Thanks, Anand
> 
> 
> On 11/09/2015 05:59 PM, Zhao Lei wrote:
> > Switch to common warning()/error() for cmds-device.c.
> >
> > Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> > ---
> >   cmds-device.c | 57 +++++++++++++++++++++++----------------------------------
> >   1 file changed, 23 insertions(+), 34 deletions(-)
> >
> > diff --git a/cmds-device.c b/cmds-device.c index 2ed32a2..e23ea61
> > 100644
> > --- a/cmds-device.c
> > +++ b/cmds-device.c
> > @@ -102,7 +102,7 @@ static int cmd_device_add(int argc, char **argv)
> >
> >   		devfd = open(argv[i], O_RDWR);
> >   		if (devfd < 0) {
> > -			fprintf(stderr, "ERROR: Unable to open device '%s'\n", argv[i]);
> > +			error("Unable to open device '%s'", argv[i]);
> >   			ret++;
> >   			continue;
> >   		}
> > @@ -117,9 +117,8 @@ static int cmd_device_add(int argc, char **argv)
> >
> >   		path = canonicalize_path(argv[i]);
> >   		if (!path) {
> > -			fprintf(stderr,
> > -				"ERROR: Could not canonicalize pathname '%s': %s\n",
> > -				argv[i], strerror(errno));
> > +			error("Could not canonicalize pathname '%s': %s",
> > +			      argv[i], strerror(errno));
> >   			ret++;
> >   			goto error_out;
> >   		}
> > @@ -129,8 +128,8 @@ static int cmd_device_add(int argc, char **argv)
> >   		res = ioctl(fdmnt, BTRFS_IOC_ADD_DEV, &ioctl_args);
> >   		e = errno;
> >   		if (res < 0) {
> > -			fprintf(stderr, "ERROR: error adding the device '%s' - %s\n",
> > -				path, strerror(e));
> > +			error("error adding the device '%s' - %s",
> > +			      path, strerror(e));
> >   			ret++;
> >   		}
> >   		free(path);
> > @@ -162,8 +161,7 @@ static int _cmd_device_remove(int argc, char
> **argv,
> >   		int	res;
> >
> >   		if (is_block_device(argv[i]) != 1) {
> > -			fprintf(stderr,
> > -				"ERROR: %s is not a block device\n", argv[i]);
> > +			error("%s is not a block device", argv[i]);
> >   			ret++;
> >   			continue;
> >   		}
> > @@ -178,9 +176,8 @@ static int _cmd_device_remove(int argc, char
> **argv,
> >   				msg = btrfs_err_str(res);
> >   			else
> >   				msg = strerror(e);
> > -			fprintf(stderr,
> > -				"ERROR: error removing the device '%s' - %s\n",
> > -				argv[i], msg);
> > +			error("error removing the device '%s' - %s",
> > +			      argv[i], msg);
> >   			ret++;
> >   		}
> >   	}
> > @@ -251,11 +248,9 @@ static int cmd_device_scan(int argc, char **argv)
> >   	if (all || argc == 1) {
> >   		printf("Scanning for Btrfs filesystems\n");
> >   		ret = btrfs_scan_lblkid();
> > -		if (ret)
> > -			fprintf(stderr, "ERROR: error %d while scanning\n", ret);
> > +		error_on(ret, "error %d while scanning", ret);
> >   		ret = btrfs_register_all_devices();
> > -		if (ret)
> > -			fprintf(stderr, "ERROR: error %d while registering\n", ret);
> > +		error_on(ret, "error %d while registering", ret);
> >   		goto out;
> >   	}
> >
> > @@ -263,16 +258,14 @@ static int cmd_device_scan(int argc, char **argv)
> >   		char *path;
> >
> >   		if (is_block_device(argv[i]) != 1) {
> > -			fprintf(stderr,
> > -				"ERROR: %s is not a block device\n", argv[i]);
> > +			error("%s is not a block device", argv[i]);
> >   			ret = 1;
> >   			goto out;
> >   		}
> >   		path = canonicalize_path(argv[i]);
> >   		if (!path) {
> > -			fprintf(stderr,
> > -				"ERROR: Could not canonicalize path '%s': %s\n",
> > -				argv[i], strerror(errno));
> > +			error("Could not canonicalize path '%s': %s",
> > +			      argv[i], strerror(errno));
> >   			ret = 1;
> >   			goto out;
> >   		}
> > @@ -313,16 +306,14 @@ static int cmd_device_ready(int argc, char
> > **argv)
> >
> >   	path = canonicalize_path(argv[argc - 1]);
> >   	if (!path) {
> > -		fprintf(stderr,
> > -			"ERROR: Could not canonicalize pathname '%s': %s\n",
> > -			argv[argc - 1], strerror(errno));
> > +		error("Could not canonicalize pathname '%s': %s",
> > +		      argv[argc - 1], strerror(errno));
> >   		ret = 1;
> >   		goto out;
> >   	}
> >
> >   	if (is_block_device(path) != 1) {
> > -		fprintf(stderr,
> > -			"ERROR: %s is not a block device\n", path);
> > +		error("%s is not a block device", path);
> >   		ret = 1;
> >   		goto out;
> >   	}
> > @@ -331,9 +322,8 @@ static int cmd_device_ready(int argc, char **argv)
> >   	strncpy_null(args.name, path);
> >   	ret = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
> >   	if (ret < 0) {
> > -		fprintf(stderr, "ERROR: unable to determine if the device '%s'"
> > -			" is ready for mounting - %s\n", path,
> > -			strerror(errno));
> > +		error("unable to determine if the device '%s' is ready for mounting
> - %s",
> > +		      path, strerror(errno));
> >   		ret = 1;
> >   	}
> >
> > @@ -388,13 +378,13 @@ static int cmd_device_stats(int argc, char
> > **argv)
> >
> >   	ret = get_fs_info(dev_path, &fi_args, &di_args);
> >   	if (ret) {
> > -		fprintf(stderr, "ERROR: getting dev info for devstats failed: "
> > -				"%s\n", strerror(-ret));
> > +		error("getting dev info for devstats failed: %s",
> > +		      strerror(-ret));
> >   		err = 1;
> >   		goto out;
> >   	}
> >   	if (!fi_args.num_devices) {
> > -		fprintf(stderr, "ERROR: no devices found\n");
> > +		error("no devices found");
> >   		err = 1;
> >   		goto out;
> >   	}
> > @@ -412,9 +402,8 @@ static int cmd_device_stats(int argc, char **argv)
> >   		args.flags = flags;
> >
> >   		if (ioctl(fdmnt, BTRFS_IOC_GET_DEV_STATS, &args) < 0) {
> > -			fprintf(stderr,
> > -				"ERROR: ioctl(BTRFS_IOC_GET_DEV_STATS) on %s
> failed: %s\n",
> > -				path, strerror(errno));
> > +			error("ioctl(BTRFS_IOC_GET_DEV_STATS) on %s failed: %s",
> > +			      path, strerror(errno));
> >   			err = 1;
> >   		} else {
> >   			char *canonical_path;
> >


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

* Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message
  2015-11-09  9:59 [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Zhao Lei
                   ` (2 preceding siblings ...)
  2015-11-09 10:33 ` [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Anand Jain
@ 2015-11-13 16:48 ` David Sterba
  3 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2015-11-13 16:48 UTC (permalink / raw)
  To: Zhao Lei; +Cc: linux-btrfs

On Mon, Nov 09, 2015 at 05:59:37PM +0800, Zhao Lei wrote:
> Switch to common warning()/error() for cmds-device.c.
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>

Applied, thanks. I did some tweaks so the messages look consistent and
adjusted indentation of some lines, dunno why it's aligned to " instead
of one tab.

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

* Re: [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage
  2015-11-09  9:59 ` [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Zhao Lei
@ 2015-11-13 16:49   ` David Sterba
  0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2015-11-13 16:49 UTC (permalink / raw)
  To: Zhao Lei; +Cc: linux-btrfs

On Mon, Nov 09, 2015 at 05:59:38PM +0800, Zhao Lei wrote:
> 1: Remove more_than_one variant, use iterator's value instead
> 2: Remove "out" mark, use break instead.
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>

Applied, thanks.

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

* Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message
  2015-11-11  3:44   ` Zhao Lei
@ 2015-11-13 16:50     ` David Sterba
  0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2015-11-13 16:50 UTC (permalink / raw)
  To: Zhao Lei; +Cc: 'Anand Jain', linux-btrfs, dsterba

On Wed, Nov 11, 2015 at 11:44:54AM +0800, Zhao Lei wrote:
> > Subject: Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error
> > message
> > Hope you could do this/apply on top of patch set
> > 
> >     "Introduce device delete by devid"
> > 
> > I vaguely remember that patchset as well did some cleanups in this part of the
> > code.
> > 
> Thanks for notice.
> 
> I'll rebase it after patchset of "Introduce device delete by devid" get applied
> into devel branch.

Noted.

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

end of thread, other threads:[~2015-11-13 16:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09  9:59 [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Zhao Lei
2015-11-09  9:59 ` [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Zhao Lei
2015-11-13 16:49   ` David Sterba
2015-11-09  9:59 ` [PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage Zhao Lei
2015-11-09 10:33 ` [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message Anand Jain
2015-11-11  3:44   ` Zhao Lei
2015-11-13 16:50     ` David Sterba
2015-11-13 16:48 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.