]> granicus.if.org Git - strace/commitdiff
ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 8 Jan 2015 02:59:04 +0000 (02:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 8 Jan 2015 03:17:28 +0000 (03:17 +0000)
* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
template.
[POWERPC64] (printstat_powerpc32): Use do_printstat32.

file.c

diff --git a/file.c b/file.c
index 5999a5659a81bf06c97c2887533a409e2da7b4e0..20a481d46ca7044886c083183f1a77593bd077ee 100644 (file)
--- a/file.c
+++ b/file.c
@@ -129,6 +129,8 @@ struct stat_sparc64 {
 
 /* several stats */
 
+#include "printstat.h"
+
 #if defined(SPARC) || defined(SPARC64)
 typedef struct {
        int     tv_sec;
@@ -270,6 +272,13 @@ struct stat_powerpc32 {
        unsigned int    __unused5;
 };
 
+# define DO_PRINTSTAT do_printstat32
+# define STRUCT_STAT struct stat_powerpc32
+# undef HAVE_STRUCT_STAT_ST_FLAGS
+# undef HAVE_STRUCT_STAT_ST_FSTYPE
+# undef HAVE_STRUCT_STAT_ST_GEN
+# include "printstat.h"
+
 static void
 printstat_powerpc32(struct tcb *tcp, long addr)
 {
@@ -280,40 +289,10 @@ printstat_powerpc32(struct tcb *tcp, long addr)
                return;
        }
 
-       if (!abbrev(tcp)) {
-               tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
-                       major(statbuf.st_dev), minor(statbuf.st_dev),
-                       statbuf.st_ino,
-                       sprintmode(statbuf.st_mode));
-               tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
-                       statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
-               tprintf("st_blksize=%u, ", statbuf.st_blksize);
-               tprintf("st_blocks=%u, ", statbuf.st_blocks);
-       }
-       else
-               tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
-       switch (statbuf.st_mode & S_IFMT) {
-       case S_IFCHR: case S_IFBLK:
-               tprintf("st_rdev=makedev(%lu, %lu), ",
-                       (unsigned long) major(statbuf.st_rdev),
-                       (unsigned long) minor(statbuf.st_rdev));
-               break;
-       default:
-               tprintf("st_size=%u, ", statbuf.st_size);
-               break;
-       }
-       if (!abbrev(tcp)) {
-               tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
-               tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
-               tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
-       }
-       else
-               tprints("...}");
+       do_printstat32(tcp, &statbuf);
 }
 #endif /* POWERPC64 */
 
-#include "printstat.h"
-
 static void
 printstat(struct tcb *tcp, long addr)
 {