Blame SOURCES/xfsprogs-4.12.0-xfs_db-improve-argument-naming-in-set_cur-and-set_io.patch

cbb4b9
From db23e0f431a77d228b5f68ef0a8587c25c689133 Mon Sep 17 00:00:00 2001
cbb4b9
From: Bill O'Donnell <billodo@redhat.com>
cbb4b9
Date: Thu, 29 Jun 2017 13:05:00 -0500
cbb4b9
Subject: [PATCH] xfs_db: improve argument naming in set_cur and set_iocur_type
cbb4b9
cbb4b9
In set_cur and set_iocur_type, the current naming for arguments
cbb4b9
type, block number, and length are t, d, and c, respectively.
cbb4b9
Replace these with more intuitive and descriptive names:
cbb4b9
type, blknum, and len. Fix type of blknum (xfs_daddr_t) to be
cbb4b9
consistent with that of libxfs_readbuf where it's used.
cbb4b9
Additionally remove extra blank line in io.c.
cbb4b9
cbb4b9
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
cbb4b9
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
cbb4b9
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
cbb4b9
---
cbb4b9
 db/io.c | 38 +++++++++++++++++++-------------------
cbb4b9
 db/io.h |  6 +++---
cbb4b9
 2 files changed, 22 insertions(+), 22 deletions(-)
cbb4b9
cbb4b9
Index: xfsprogs-rhel7.5/db/io.c
cbb4b9
===================================================================
cbb4b9
--- xfsprogs-rhel7.5.orig/db/io.c
cbb4b9
+++ xfsprogs-rhel7.5/db/io.c
cbb4b9
@@ -487,9 +487,9 @@ write_cur(void)
cbb4b9
 
cbb4b9
 void
cbb4b9
 set_cur(
cbb4b9
-	const typ_t	*t,
cbb4b9
-	__int64_t	d,
cbb4b9
-	int		c,
cbb4b9
+	const typ_t	*type,
cbb4b9
+	xfs_daddr_t	blknum,
cbb4b9
+	int		len,
cbb4b9
 	int             ring_flag,
cbb4b9
 	bbmap_t		*bbmap)
cbb4b9
 {
cbb4b9
@@ -497,14 +497,13 @@ set_cur(
cbb4b9
 	xfs_ino_t	dirino;
cbb4b9
 	xfs_ino_t	ino;
cbb4b9
 	__uint16_t	mode;
cbb4b9
-	const struct xfs_buf_ops *ops = t ? t->bops : NULL;
cbb4b9
+	const struct xfs_buf_ops *ops = type ? type->bops : NULL;
cbb4b9
 
cbb4b9
 	if (iocur_sp < 0) {
cbb4b9
 		dbprintf(_("set_cur no stack element to set\n"));
cbb4b9
 		return;
cbb4b9
 	}
cbb4b9
 
cbb4b9
-
cbb4b9
 	ino = iocur_top->ino;
cbb4b9
 	dirino = iocur_top->dirino;
cbb4b9
 	mode = iocur_top->mode;
cbb4b9
@@ -514,7 +513,7 @@ set_cur(
cbb4b9
 	if (bbmap) {
cbb4b9
 #ifdef DEBUG_BBMAP
cbb4b9
 		int i;
cbb4b9
-		printf(_("xfs_db got a bbmap for %lld\n"), (long long)d);
cbb4b9
+		printf(_("xfs_db got a bbmap for %lld\n"), (long long)blknum);
cbb4b9
 		printf(_("\tblock map"));
cbb4b9
 		for (i = 0; i < bbmap->nmaps; i++)
cbb4b9
 			printf(" %lld:%d", (long long)bbmap->b[i].bm_bn,
cbb4b9
@@ -528,7 +527,7 @@ set_cur(
cbb4b9
 		bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b,
cbb4b9
 					bbmap->nmaps, 0, ops);
cbb4b9
 	} else {
cbb4b9
-		bp = libxfs_readbuf(mp->m_ddev_targp, d, c, 0, ops);
cbb4b9
+		bp = libxfs_readbuf(mp->m_ddev_targp, blknum, len, 0, ops);
cbb4b9
 		iocur_top->bbmap = NULL;
cbb4b9
 	}
cbb4b9
 
cbb4b9
@@ -544,13 +543,13 @@ set_cur(
cbb4b9
 	if (!ops)
cbb4b9
 		bp->b_flags |= LIBXFS_B_UNCHECKED;
cbb4b9
 
cbb4b9
-	iocur_top->bb = d;
cbb4b9
-	iocur_top->blen = c;
cbb4b9
+	iocur_top->bb = blknum;
cbb4b9
+	iocur_top->blen = len;
cbb4b9
 	iocur_top->boff = 0;
cbb4b9
 	iocur_top->data = iocur_top->buf;
cbb4b9
-	iocur_top->len = BBTOB(c);
cbb4b9
-	iocur_top->off = d << BBSHIFT;
cbb4b9
-	iocur_top->typ = cur_typ = t;
cbb4b9
+	iocur_top->len = BBTOB(len);
cbb4b9
+	iocur_top->off = blknum << BBSHIFT;
cbb4b9
+	iocur_top->typ = cur_typ = type;
cbb4b9
 	iocur_top->ino = ino;
cbb4b9
 	iocur_top->dirino = dirino;
cbb4b9
 	iocur_top->mode = mode;
cbb4b9
@@ -564,23 +563,24 @@ set_cur(
cbb4b9
 
cbb4b9
 void
cbb4b9
 set_iocur_type(
cbb4b9
-	const typ_t	*t)
cbb4b9
+	const typ_t	*type)
cbb4b9
 {
cbb4b9
 	struct xfs_buf	*bp = iocur_top->bp;
cbb4b9
 
cbb4b9
 	/* adjust buffer size for types with fields & hence fsize() */
cbb4b9
-	if (t->fields) {
cbb4b9
+	if (type->fields) {
cbb4b9
 		int bb_count;	/* type's size in basic blocks */
cbb4b9
 
cbb4b9
-		bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0)));
cbb4b9
-		set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
cbb4b9
+		bb_count = BTOBB(byteize(fsize(type->fields,
cbb4b9
+					       iocur_top->data, 0, 0)));
cbb4b9
+		set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
cbb4b9
 	}
cbb4b9
-	iocur_top->typ = t;
cbb4b9
+	iocur_top->typ = type;
cbb4b9
 
cbb4b9
 	/* verify the buffer if the type has one. */
cbb4b9
 	if (!bp)
cbb4b9
 		return;
cbb4b9
-	if (!t->bops) {
cbb4b9
+	if (!type->bops) {
cbb4b9
 		bp->b_ops = NULL;
cbb4b9
 		bp->b_flags |= LIBXFS_B_UNCHECKED;
cbb4b9
 		return;
cbb4b9
@@ -588,7 +588,7 @@ set_iocur_type(
cbb4b9
 	if (!(bp->b_flags & LIBXFS_B_UPTODATE))
cbb4b9
 		return;
cbb4b9
 	bp->b_error = 0;
cbb4b9
-	bp->b_ops = t->bops;
cbb4b9
+	bp->b_ops = type->bops;
cbb4b9
 	bp->b_ops->verify_read(bp);
cbb4b9
 	bp->b_flags &= ~LIBXFS_B_UNCHECKED;
cbb4b9
 }
cbb4b9
Index: xfsprogs-rhel7.5/db/io.h
cbb4b9
===================================================================
cbb4b9
--- xfsprogs-rhel7.5.orig/db/io.h
cbb4b9
+++ xfsprogs-rhel7.5/db/io.h
cbb4b9
@@ -59,10 +59,10 @@ extern void	print_iocur(char *tag, iocur
cbb4b9
 extern void	push_cur(void);
cbb4b9
 extern int	read_buf(__int64_t daddr, int count, void *bufp);
cbb4b9
 extern void     write_cur(void);
cbb4b9
-extern void	set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
cbb4b9
-			bbmap_t *bbmap);
cbb4b9
+extern void	set_cur(const struct typ *type, xfs_daddr_t blknum,
cbb4b9
+			int len, int ring_add, bbmap_t *bbmap);
cbb4b9
 extern void     ring_add(void);
cbb4b9
-extern void	set_iocur_type(const struct typ *t);
cbb4b9
+extern void	set_iocur_type(const struct typ *type);
cbb4b9
 extern void	xfs_dummy_verify(struct xfs_buf *bp);
cbb4b9
 
cbb4b9
 /*