diff mbox series

[v6,3/6] lapi/stat.h: Simplify definition

Message ID 1684134680-6190-3-git-send-email-xuyang2018.jy@fujitsu.com
State Accepted
Headers show
Series [v6,1/6] include/lapi: Move AT_* related macros to fcntl header | expand

Commit Message

Yang Xu \(Fujitsu\) May 15, 2023, 7:11 a.m. UTC
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 include/lapi/stat.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Xiao Yang May 18, 2023, 6:24 a.m. UTC | #1
Hi Xu

LGTM.
Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>

Best Regards,
Xiao Yang

On 2023/5/15 15:11, Yang Xu wrote:
> 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
>    *
diff mbox series

Patch

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
  *