[rtems commit] Fix format warnings due to ino_t changes

Sebastian Huber sebh at rtems.org
Thu Jan 10 08:12:11 UTC 2019


Module:    rtems
Branch:    master
Commit:    7bde91bd5fd20e2c0c91193728c793e0675bdc03
Changeset: http://git.rtems.org/rtems/commit/?id=7bde91bd5fd20e2c0c91193728c793e0675bdc03

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jan 10 09:05:49 2019 +0100

Fix format warnings due to ino_t changes

---

 cpukit/include/rtems/inttypes.h       | 7 +++++--
 cpukit/libfs/src/rfs/rtems-rfs-dir.c  | 3 ++-
 cpukit/libmisc/shell/main_rm.c        | 6 ++++--
 cpukit/libmisc/shell/print-ls.c       | 6 ++++--
 testsuites/psxtests/psxreaddir/test.c | 2 +-
 5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h
index 4e6e98f..5af23b2 100644
--- a/cpukit/include/rtems/inttypes.h
+++ b/cpukit/include/rtems/inttypes.h
@@ -127,8 +127,11 @@ extern "C" {
 /* rtems_signal_set is a typedef to uint32_t */
 #define PRIxrtems_signal_set PRIx32
 
-/* newlib's ino_t is a typedef to "unsigned long" */
-#define PRIxino_t "lx"
+/* newlib's ino_t is a typedef to __uint64_t */
+#define PRIuino_t PRIu64
+
+/* newlib's ino_t is a typedef to __uint64_t */
+#define PRIxino_t PRIx64
 
 /* ioctl_command_t */
 #define PRIdioctl_command_t "ld"
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-dir.c b/cpukit/libfs/src/rfs/rtems-rfs-dir.c
index a49ab84..c9a2772 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-dir.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-dir.c
@@ -622,7 +622,8 @@ rtems_rfs_dir_read (rtems_rfs_file_system*  fs,
       dirent->d_namlen = elength;
 
       if (rtems_rfs_trace (RTEMS_RFS_TRACE_DIR_READ))
-        printf ("rtems-rfs: dir-read: found off:%" PRIooff_t " ino:%ld name=%s\n",
+        printf ("rtems-rfs: dir-read: found off:%" PRIooff_t
+                " ino:%" PRIuino_t " name=%s\n",
                 dirent->d_off, dirent->d_ino, dirent->d_name);
       break;
     }
diff --git a/cpukit/libmisc/shell/main_rm.c b/cpukit/libmisc/shell/main_rm.c
index c8dabe7..ab712d5 100644
--- a/cpukit/libmisc/shell/main_rm.c
+++ b/cpukit/libmisc/shell/main_rm.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD: src/bin/rm/rm.c,v 1.58 2006/10/31 02:22:36 delphij Exp $");
 #endif
 
 #include <rtems.h>
+#include <rtems/inttypes.h>
 #include <rtems/shell.h>
 #include <rtems/shellconfig.h>
 #define __need_getopt_newlib
@@ -493,8 +494,9 @@ rm_overwrite_rm(rtems_shell_rm_globals* globals, char *file, struct stat *sbp)
 	if (!S_ISREG(sbp->st_mode))
 		return (1);
 	if (sbp->st_nlink > 1 && !fflag) {
-		warnx("%s (inode %lu): not overwritten due to multiple links",
-		    file, sbp->st_ino);
+		warnx("%s (inode %" PRIuino_t
+		    "): not overwritten due to multiple links", file,
+		    sbp->st_ino);
 		return (0);
 	}
 	if ((fd = open(file, O_WRONLY, 0)) == -1)
diff --git a/cpukit/libmisc/shell/print-ls.c b/cpukit/libmisc/shell/print-ls.c
index 75876b7..15702b4 100644
--- a/cpukit/libmisc/shell/print-ls.c
+++ b/cpukit/libmisc/shell/print-ls.c
@@ -50,6 +50,7 @@ __RCSID("$NetBSD: print.c,v 1.40 2004/11/17 17:00:00 mycroft Exp $");
 #include <inttypes.h>
 
 #include <rtems.h>
+#include <rtems/inttypes.h>
 #include <rtems/libio.h>
 
 #include <sys/param.h>
@@ -135,7 +136,8 @@ printlong(rtems_shell_ls_globals* globals, DISPLAY *dp)
 			continue;
 		sp = p->fts_statp;
 		if (f_inode)
-			(void)printf("%*lu ", dp->s_inode, sp->st_ino);
+			(void)printf("%*" PRIuino_t " ", dp->s_inode,
+			    sp->st_ino);
 		if (f_size && !f_humanize) {
 			(void)printf("%*llu ", dp->s_block,
 			    (unsigned long long)howmany(sp->st_blocks, blocksize));
@@ -385,7 +387,7 @@ printaname(rtems_shell_ls_globals* globals,
 	sp = p->fts_statp;
 	chcnt = 0;
 	if (f_inode)
-		chcnt += printf("%*lu ", inodefield, sp->st_ino);
+		chcnt += printf("%*" PRIuino_t " ", inodefield, sp->st_ino);
 	if (f_size) {
 #if RTEMS_REMOVED
 		if (f_humanize) {
diff --git a/testsuites/psxtests/psxreaddir/test.c b/testsuites/psxtests/psxreaddir/test.c
index e32bac4..25d7844 100644
--- a/testsuites/psxtests/psxreaddir/test.c
+++ b/testsuites/psxtests/psxreaddir/test.c
@@ -80,7 +80,7 @@ void printdir( DIR *directory )
   d = readdir(directory);
 
   while (d) {
-    printf( "%-20s %8ld %8" PRIdoff_t " %6d   0x%04x\n",
+    printf( "%-20s %8" PRIuino_t " %8" PRIdoff_t " %6d   0x%04x\n",
        d->d_name, d->d_ino, d->d_off, d->d_reclen, d->d_type );
     d = readdir(directory);
 



More information about the vc mailing list