[rtems commit] rtems/inttypes.h: Add blksize_t and blkcnt_t

Joel Sherrill joel at rtems.org
Mon Apr 24 22:21:55 UTC 2017


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

Author:    Joel Sherrill <joel at rtems.org>
Date:      Sat Apr 22 14:15:22 2017 -0500

rtems/inttypes.h: Add blksize_t and blkcnt_t

---

 cpukit/configure.ac                   | 14 ++++++++++++++
 cpukit/include/rtems/inttypes.h       | 22 ++++++++++++++++++++++
 testsuites/psxtests/include/pmacros.h | 30 +-----------------------------
 3 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index ab01db8..67237e9 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -243,6 +243,8 @@ AC_CHECK_SIZEOF([mode_t])
 AC_CHECK_SIZEOF([off_t])
 AC_CHECK_SIZEOF([time_t])
 AC_CHECK_SIZEOF([size_t])
+AC_CHECK_SIZEOF([blksize_t])
+AC_CHECK_SIZEOF([blkcnt_t])
 
 ## Provide sizeof(mode_t) information via cpuopts.h
 RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__],
@@ -262,6 +264,18 @@ RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__],
   [${ac_cv_sizeof_time_t}],
   [sizeof(time_t)])
 
+## Provide sizeof(blksize_t) information via cpuopts.h
+RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKSIZE_T__],
+  [true],
+  [${ac_cv_sizeof_blksize_t}],
+  [sizeof(blksize_t)])
+
+## Provide sizeof(blkcnt_t) information via cpuopts.h
+RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKCNT_T__],
+  [true],
+  [${ac_cv_sizeof_blkcnt_t}],
+  [sizeof(blkcnt_t)])
+
 ## Then we propagate a private copy of the value into cpuopts.h
 ## so it is always available to the RTEMS header files.
 
diff --git a/cpukit/include/rtems/inttypes.h b/cpukit/include/rtems/inttypes.h
index ef02ccf..023353f 100644
--- a/cpukit/include/rtems/inttypes.h
+++ b/cpukit/include/rtems/inttypes.h
@@ -70,6 +70,28 @@ extern "C" {
 #error "PRIdtime_t: unsupported size of time_t"
 #endif
 
+/** Helper macro to print "blksize_t" in decimal */
+#if __RTEMS_SIZEOF_BLKSIZE_T__ == 8
+#define PRIxblksize_t PRIx64
+#elif __RTEMS_SIZEOF_BLKSIZE_T__ == 4
+#define PRIxblksize_t PRIx32
+#else
+/* Warn and fall back to "long" */
+#warning "unsupported size of blksize_t"
+#define PRIxblksize_t "lx"
+#endif
+
+/** Helper macro to print "blkcnt_t" in decimal */
+#if __RTEMS_SIZEOF_BLKCNT_T__ == 8
+#define PRIxblkcnt_t PRIx64
+#elif __RTEMS_SIZEOF_BLKCNT_T__ == 4
+#define PRIxblkcnt_t PRIx32
+#else
+/* Warn and fall back to "long" */
+#warning "unsupported size of blkcnt_t"
+#define PRIxblkcnt_t "lx"
+#endif
+
 /*
  * Various inttypes.h-stype macros to assist printing
  * certain system types on different targets.
diff --git a/testsuites/psxtests/include/pmacros.h b/testsuites/psxtests/include/pmacros.h
index 77cf3fb..be1b8b7 100644
--- a/testsuites/psxtests/include/pmacros.h
+++ b/testsuites/psxtests/include/pmacros.h
@@ -1,5 +1,5 @@
 /*
- *  COPYRIGHT (c) 1989-2009.
+ *  COPYRIGHT (c) 1989-2009, 2017.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -91,34 +91,6 @@
 
 #define empty_line() puts( "" )
 
-#if SIZEOF_OFF_T == 8
-#define PRIdoff_t PRIo64
-#elif SIZEOF_OFF_T == 4
-#define PRIdoff_t PRIo32
-#else
-#error "unsupported size of off_t"
-#endif
-
-#if SIZEOF_BLKSIZE_T == 8
-#define PRIxblksize_t PRIx64
-#elif SIZEOF_BLKSIZE_T == 4
-#define PRIxblksize_t PRIx32
-#else
-/* Warn and fall back to "long" */
-#warning "unsupported size of blksize_t"
-#define PRIxblksize_t "lx"
-#endif
-
-#if SIZEOF_BLKSIZE_T == 8
-#define PRIxblkcnt_t PRIx64
-#elif SIZEOF_BLKSIZE_T == 4
-#define PRIxblkcnt_t PRIx32
-#else
-/* Warn and fall back to "long" */
-#warning "unsupported size of blkcnt_t"
-#define PRIxblkcnt_t "lx"
-#endif
-
 #endif
 
 /* end of file */




More information about the vc mailing list