diff mbox series

[V2,03/23] metadump: Declare boolean variables with bool type

Message ID 20230606092806.1604491-4-chandan.babu@oracle.com (mailing list archive)
State Superseded, archived
Headers show
Series Metadump v2 | expand

Commit Message

Chandan Babu R June 6, 2023, 9:27 a.m. UTC
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
---
 db/metadump.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

Comments

Darrick J. Wong June 6, 2023, 3:17 p.m. UTC | #1
On Tue, Jun 06, 2023 at 02:57:46PM +0530, Chandan Babu R wrote:
> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  db/metadump.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/db/metadump.c b/db/metadump.c
> index 6bcfd5bb..8b33fbfb 100644
> --- a/db/metadump.c
> +++ b/db/metadump.c
> @@ -51,13 +51,13 @@ static int		cur_index;
>  
>  static xfs_ino_t	cur_ino;
>  
> -static int		show_progress = 0;
> -static int		stop_on_read_error = 0;
> +static bool		show_progress = false;
> +static bool		stop_on_read_error = false;
>  static int		max_extent_size = DEFAULT_MAX_EXT_SIZE;
> -static int		obfuscate = 1;
> -static int		zero_stale_data = 1;
> -static int		show_warnings = 0;
> -static int		progress_since_warning = 0;
> +static bool		obfuscate = true;
> +static bool		zero_stale_data = true;
> +static bool		show_warnings = false;
> +static bool		progress_since_warning = false;
>  static bool		stdout_metadump;
>  
>  void
> @@ -100,7 +100,7 @@ print_warning(const char *fmt, ...)
>  
>  	fprintf(stderr, "%s%s: %s\n", progress_since_warning ? "\n" : "",
>  			progname, buf);
> -	progress_since_warning = 0;
> +	progress_since_warning = false;
>  }
>  
>  static void
> @@ -121,7 +121,7 @@ print_progress(const char *fmt, ...)
>  	f = stdout_metadump ? stderr : stdout;
>  	fprintf(f, "\r%-59s", buf);
>  	fflush(f);
> -	progress_since_warning = 1;
> +	progress_since_warning = true;
>  }
>  
>  /*
> @@ -2979,9 +2979,9 @@ metadump_f(
>  	char		*p;
>  
>  	exitcode = 1;
> -	show_progress = 0;
> -	show_warnings = 0;
> -	stop_on_read_error = 0;
> +	show_progress = false;
> +	show_warnings = false;
> +	stop_on_read_error = false;
>  
>  	if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
>  		print_warning("bad superblock magic number %x, giving up",
> @@ -3002,13 +3002,13 @@ metadump_f(
>  	while ((c = getopt(argc, argv, "aegm:ow")) != EOF) {
>  		switch (c) {
>  			case 'a':
> -				zero_stale_data = 0;
> +				zero_stale_data = false;
>  				break;
>  			case 'e':
> -				stop_on_read_error = 1;
> +				stop_on_read_error = true;
>  				break;
>  			case 'g':
> -				show_progress = 1;
> +				show_progress = true;
>  				break;
>  			case 'm':
>  				max_extent_size = (int)strtol(optarg, &p, 0);
> @@ -3019,10 +3019,10 @@ metadump_f(
>  				}
>  				break;
>  			case 'o':
> -				obfuscate = 0;
> +				obfuscate = false;
>  				break;
>  			case 'w':
> -				show_warnings = 1;
> +				show_warnings = true;
>  				break;
>  			default:
>  				print_warning("bad option for metadump command");
> -- 
> 2.39.1
>
diff mbox series

Patch

diff --git a/db/metadump.c b/db/metadump.c
index 6bcfd5bb..8b33fbfb 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -51,13 +51,13 @@  static int		cur_index;
 
 static xfs_ino_t	cur_ino;
 
-static int		show_progress = 0;
-static int		stop_on_read_error = 0;
+static bool		show_progress = false;
+static bool		stop_on_read_error = false;
 static int		max_extent_size = DEFAULT_MAX_EXT_SIZE;
-static int		obfuscate = 1;
-static int		zero_stale_data = 1;
-static int		show_warnings = 0;
-static int		progress_since_warning = 0;
+static bool		obfuscate = true;
+static bool		zero_stale_data = true;
+static bool		show_warnings = false;
+static bool		progress_since_warning = false;
 static bool		stdout_metadump;
 
 void
@@ -100,7 +100,7 @@  print_warning(const char *fmt, ...)
 
 	fprintf(stderr, "%s%s: %s\n", progress_since_warning ? "\n" : "",
 			progname, buf);
-	progress_since_warning = 0;
+	progress_since_warning = false;
 }
 
 static void
@@ -121,7 +121,7 @@  print_progress(const char *fmt, ...)
 	f = stdout_metadump ? stderr : stdout;
 	fprintf(f, "\r%-59s", buf);
 	fflush(f);
-	progress_since_warning = 1;
+	progress_since_warning = true;
 }
 
 /*
@@ -2979,9 +2979,9 @@  metadump_f(
 	char		*p;
 
 	exitcode = 1;
-	show_progress = 0;
-	show_warnings = 0;
-	stop_on_read_error = 0;
+	show_progress = false;
+	show_warnings = false;
+	stop_on_read_error = false;
 
 	if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
 		print_warning("bad superblock magic number %x, giving up",
@@ -3002,13 +3002,13 @@  metadump_f(
 	while ((c = getopt(argc, argv, "aegm:ow")) != EOF) {
 		switch (c) {
 			case 'a':
-				zero_stale_data = 0;
+				zero_stale_data = false;
 				break;
 			case 'e':
-				stop_on_read_error = 1;
+				stop_on_read_error = true;
 				break;
 			case 'g':
-				show_progress = 1;
+				show_progress = true;
 				break;
 			case 'm':
 				max_extent_size = (int)strtol(optarg, &p, 0);
@@ -3019,10 +3019,10 @@  metadump_f(
 				}
 				break;
 			case 'o':
-				obfuscate = 0;
+				obfuscate = false;
 				break;
 			case 'w':
-				show_warnings = 1;
+				show_warnings = true;
 				break;
 			default:
 				print_warning("bad option for metadump command");