diff mbox series

[V1.1] xfsprogs: xfs_fsr: Limit the scope of cmp()

Message ID 20210126044222.2676922-1-chandanrlinux@gmail.com (mailing list archive)
State Accepted
Headers show
Series [V1.1] xfsprogs: xfs_fsr: Limit the scope of cmp() | expand

Commit Message

Chandan Babu R Jan. 26, 2021, 4:42 a.m. UTC
cmp() function is being referred to from within fsr/xfs_fsr.c. Hence
this commit limits its scope to the current file.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
 fsr/xfs_fsr.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Comments

Eric Sandeen Feb. 2, 2021, 8:21 p.m. UTC | #1
On 1/25/21 10:42 PM, Chandan Babu R wrote:
> cmp() function is being referred to from within fsr/xfs_fsr.c. Hence
> this commit limits its scope to the current file.
> 
> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>

Thanks,

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
diff mbox series

Patch

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 635e4c70..b885395e 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -81,7 +81,6 @@  char * gettmpname(char *fname);
 char * getparent(char *fname);
 int fsrprintf(const char *fmt, ...);
 int read_fd_bmap(int, struct xfs_bstat *, int *);
-int cmp(const void *, const void *);
 static void tmp_init(char *mnt);
 static char * tmp_next(char *mnt);
 static void tmp_close(char *mnt);
@@ -577,6 +576,16 @@  fsrall_cleanup(int timeout)
 	}
 }
 
+/*
+ * To compare bstat structs for qsort.
+ */
+static int
+cmp(const void *s1, const void *s2)
+{
+	return( ((struct xfs_bulkstat *)s2)->bs_extents -
+	        ((struct xfs_bulkstat *)s1)->bs_extents);
+}
+
 /*
  * fsrfs -- reorganize a file system
  */
@@ -696,16 +705,6 @@  out0:
 	return 0;
 }
 
-/*
- * To compare bstat structs for qsort.
- */
-int
-cmp(const void *s1, const void *s2)
-{
-	return( ((struct xfs_bulkstat *)s2)->bs_extents -
-	        ((struct xfs_bulkstat *)s1)->bs_extents);
-}
-
 /*
  * reorganize by directory hierarchy.
  * Stay in dev (a restriction based on structure of this program -- either