Blame SOURCES/0123-fcntl-use-print_fields.h-macros.patch

760e82
From eba856eb0246ce2a2ba99d68611da1af7814080e Mon Sep 17 00:00:00 2001
760e82
From: "Dmitry V. Levin" <ldv@altlinux.org>
760e82
Date: Mon, 13 Jul 2020 08:00:00 +0000
760e82
Subject: [PATCH 123/138] fcntl: use print_fields.h macros
760e82
760e82
* fcntl.c: Include "print_fields.h".
760e82
(print_struct_flock64, print_f_owner_ex): Use PRINT_FIELD_* macros
760e82
from print_fields.h.
760e82
---
760e82
 fcntl.c | 19 +++++++++----------
760e82
 1 file changed, 9 insertions(+), 10 deletions(-)
760e82
760e82
diff --git a/fcntl.c b/fcntl.c
760e82
index 0b4221c..e84549e 100644
760e82
--- a/fcntl.c
760e82
+++ b/fcntl.c
760e82
@@ -11,6 +11,7 @@
760e82
 
760e82
 #include "defs.h"
760e82
 #include "flock.h"
760e82
+#include "print_fields.h"
760e82
 
760e82
 #include "xlat/f_owner_types.h"
760e82
 #include "xlat/f_seals.h"
760e82
@@ -22,14 +23,12 @@
760e82
 static void
760e82
 print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
760e82
 {
760e82
-	tprints("{l_type=");
760e82
-	printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
760e82
-	tprints(", l_whence=");
760e82
-	printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
760e82
-	tprintf(", l_start=%" PRId64 ", l_len=%" PRId64,
760e82
-		(int64_t) fl->l_start, (int64_t) fl->l_len);
760e82
+	PRINT_FIELD_XVAL("{", *fl, l_type, lockfcmds, "F_???");
760e82
+	PRINT_FIELD_XVAL(", ", *fl, l_whence, whence_codes, "SEEK_???");
760e82
+	PRINT_FIELD_D(", ", *fl, l_start);
760e82
+	PRINT_FIELD_D(", ", *fl, l_len);
760e82
 	if (getlk)
760e82
-		tprintf(", l_pid=%lu", (unsigned long) fl->l_pid);
760e82
+		PRINT_FIELD_D(", ", *fl, l_pid);
760e82
 	tprints("}");
760e82
 }
760e82
 
760e82
@@ -59,9 +58,9 @@ print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
760e82
 	if (umove_or_printaddr(tcp, addr, &owner))
760e82
 		return;
760e82
 
760e82
-	tprints("{type=");
760e82
-	printxval(f_owner_types, owner.type, "F_OWNER_???");
760e82
-	tprintf(", pid=%d}", owner.pid);
760e82
+	PRINT_FIELD_XVAL("{", owner, type, f_owner_types, "F_OWNER_???");
760e82
+	PRINT_FIELD_D(", ", owner, pid);
760e82
+	tprints("}");
760e82
 }
760e82
 
760e82
 static int
760e82
-- 
760e82
2.1.4
760e82