[3/4] btrfs-progs: replace a confusing raw number with a macro
diff mbox

Message ID 1405564839-28702-3-git-send-email-guihc.fnst@cn.fujitsu.com
State Accepted
Headers show

Commit Message

Gui Hecheng July 17, 2014, 2:40 a.m. UTC
The raw number 36 for the uuid string length is somewhat confusing,
use a macro to define replace it.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
 cmds-scrub.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Sterba July 29, 2014, 12:16 p.m. UTC | #1
On Thu, Jul 17, 2014 at 10:40:38AM +0800, Gui Hecheng wrote:
> The raw number 36 for the uuid string length is somewhat confusing,
> use a macro to define replace it.

There's the BTRFS_UUID_UNPARSED_SIZE macro, please use it instead to
avoid duplicate definitions.
--
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
David Sterba July 29, 2014, 12:19 p.m. UTC | #2
On Tue, Jul 29, 2014 at 02:16:14PM +0200, David Sterba wrote:
> On Thu, Jul 17, 2014 at 10:40:38AM +0800, Gui Hecheng wrote:
> > The raw number 36 for the uuid string length is somewhat confusing,
> > use a macro to define replace it.
> 
> There's the BTRFS_UUID_UNPARSED_SIZE macro, please use it instead to
> avoid duplicate definitions.

Or I'll do that myself as it's a really a small change.
--
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
Gui Hecheng July 30, 2014, 1:17 a.m. UTC | #3
On Tue, 2014-07-29 at 14:19 +0200, David Sterba wrote:
> On Tue, Jul 29, 2014 at 02:16:14PM +0200, David Sterba wrote:
> > On Thu, Jul 17, 2014 at 10:40:38AM +0800, Gui Hecheng wrote:
> > > The raw number 36 for the uuid string length is somewhat confusing,
> > > use a macro to define replace it.
> > 
> > There's the BTRFS_UUID_UNPARSED_SIZE macro, please use it instead to
> > avoid duplicate definitions.
> 
> Or I'll do that myself as it's a really a small change.
Oh, yes, it is really kind of you to do so :)


--
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

Patch
diff mbox

diff --git a/cmds-scrub.c b/cmds-scrub.c
index a604b25..03eb9ba 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -48,6 +48,8 @@  static const char * const scrub_cmd_group_usage[] = {
 	NULL
 };
 
+#define UUID_LEN_STR 36
+
 #define SCRUB_DATA_FILE "/var/lib/btrfs/scrub.status"
 #define SCRUB_PROGRESS_SOCKET_PATH "/var/lib/btrfs/scrub.progress"
 #define SCRUB_FILE_VERSION_PREFIX "scrub status"
@@ -550,7 +552,7 @@  again:
 				;
 			if (i + j + 1 >= avail)
 				_SCRUB_INVALID;
-			if (j != 36)
+			if (j != UUID_LEN_STR)
 				_SCRUB_INVALID;
 			l[i + j] = '\0';
 			ret = uuid_parse(l + i, p[curr]->fsid);