[LTP] [PATCH v5 3/7] lapi/stat.h: Simplify definition

Yang Xu xuyang2018.jy@fujitsu.com
Tue May 9 11:14:04 CEST 2023


Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 include/lapi/stat.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/lapi/stat.h b/include/lapi/stat.h
index 6ed4b6637..e247c2159 100644
--- a/include/lapi/stat.h
+++ b/include/lapi/stat.h
@@ -11,6 +11,8 @@
 #include <stdint.h>
 #include <unistd.h>
 #include "lapi/syscalls.h"
+#include <sys/stat.h>
+
 /*
  * Timestamp structure for the timestamps in struct statx.
  *
@@ -21,9 +23,7 @@
  *
  * __reserved is held in case we need a yet finer resolution.
  */
-#if defined(HAVE_STRUCT_STATX_TIMESTAMP)
-#include <sys/stat.h>
-#else
+#ifndef HAVE_STRUCT_STATX_TIMESTAMP
 struct statx_timestamp {
 	int64_t tv_sec;
 	uint32_t tv_nsec;
@@ -67,9 +67,7 @@ struct statx_timestamp {
  * will have values installed for compatibility purposes so that stat() and
  * co. can be emulated in userspace.
  */
-#if defined(HAVE_STRUCT_STATX)
-#include <sys/stat.h>
-#else
+#ifndef HAVE_STRUCT_STATX
 struct statx {
 	/* 0x00 */
 	uint32_t	stx_mask;
@@ -106,8 +104,7 @@ struct statx {
 };
 #endif
 
-#if !defined(HAVE_STATX)
-
+#ifndef HAVE_STATX
 /*
  * statx: wrapper function of statx
  *
-- 
2.39.1



More information about the ltp mailing list