diff mbox series

xfs_io: rework includes for statx structures

Message ID cec15436-c098-c59f-2663-a6a189e46a0c@redhat.com (mailing list archive)
State Accepted
Headers show
Series xfs_io: rework includes for statx structures | expand

Commit Message

Eric Sandeen April 30, 2019, 8:02 p.m. UTC
Only include the kernel's linux/stat.h headers if we haven't
already picked up statx bits from glibc, to avoid redefinition.

Suggested-by: Darrick J. Wong <darrick.wong@oracle.com>
Tested-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Darrick J. Wong April 30, 2019, 8:15 p.m. UTC | #1
On Tue, Apr 30, 2019 at 03:02:56PM -0500, Eric Sandeen wrote:
> Only include the kernel's linux/stat.h headers if we haven't
> already picked up statx bits from glibc, to avoid redefinition.
> 
> Suggested-by: Darrick J. Wong <darrick.wong@oracle.com>
> Tested-by: Bill O'Donnell <billodo@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

We'll never have problems again!! :D

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

(I built it on Ubuntu 18.04 LTS if anyone cares)

--D

> ---
> 
> diff --git a/io/stat.c b/io/stat.c
> index 517be66..37c0b2e 100644
> --- a/io/stat.c
> +++ b/io/stat.c
> @@ -6,9 +6,6 @@
>   * Portions of statx support written by David Howells (dhowells@redhat.com)
>   */
>  
> -/* Try to pick up statx definitions from the system headers. */
> -#include <linux/stat.h>
> -
>  #include "command.h"
>  #include "input.h"
>  #include "init.h"
> diff --git a/io/statx.h b/io/statx.h
> index 4f40eaa..c6625ac 100644
> --- a/io/statx.h
> +++ b/io/statx.h
> @@ -33,7 +33,14 @@
>  # endif
>  #endif
>  
> +
> +#ifndef STATX_TYPE
> +/* Pick up kernel definitions if glibc didn't already provide them */
> +#include <linux/stat.h>
> +#endif
> +
>  #ifndef STATX_TYPE
> +/* Local definitions if glibc & kernel headers didn't already provide them */
>  
>  /*
>   * Timestamp structure for the timestamps in struct statx.
>
Bill O'Donnell April 30, 2019, 9 p.m. UTC | #2
On Tue, Apr 30, 2019 at 03:02:56PM -0500, Eric Sandeen wrote:
> Only include the kernel's linux/stat.h headers if we haven't
> already picked up statx bits from glibc, to avoid redefinition.
> 
> Suggested-by: Darrick J. Wong <darrick.wong@oracle.com>
> Tested-by: Bill O'Donnell <billodo@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/io/stat.c b/io/stat.c
> index 517be66..37c0b2e 100644
> --- a/io/stat.c
> +++ b/io/stat.c
> @@ -6,9 +6,6 @@
>   * Portions of statx support written by David Howells (dhowells@redhat.com)
>   */
>  
> -/* Try to pick up statx definitions from the system headers. */
> -#include <linux/stat.h>
> -
>  #include "command.h"
>  #include "input.h"
>  #include "init.h"
> diff --git a/io/statx.h b/io/statx.h
> index 4f40eaa..c6625ac 100644
> --- a/io/statx.h
> +++ b/io/statx.h
> @@ -33,7 +33,14 @@
>  # endif
>  #endif
>  
> +
> +#ifndef STATX_TYPE
> +/* Pick up kernel definitions if glibc didn't already provide them */
> +#include <linux/stat.h>
> +#endif
> +
>  #ifndef STATX_TYPE
> +/* Local definitions if glibc & kernel headers didn't already provide them */
>  
>  /*
>   * Timestamp structure for the timestamps in struct statx.
>
diff mbox series

Patch

diff --git a/io/stat.c b/io/stat.c
index 517be66..37c0b2e 100644
--- a/io/stat.c
+++ b/io/stat.c
@@ -6,9 +6,6 @@ 
  * Portions of statx support written by David Howells (dhowells@redhat.com)
  */
 
-/* Try to pick up statx definitions from the system headers. */
-#include <linux/stat.h>
-
 #include "command.h"
 #include "input.h"
 #include "init.h"
diff --git a/io/statx.h b/io/statx.h
index 4f40eaa..c6625ac 100644
--- a/io/statx.h
+++ b/io/statx.h
@@ -33,7 +33,14 @@ 
 # endif
 #endif
 
+
+#ifndef STATX_TYPE
+/* Pick up kernel definitions if glibc didn't already provide them */
+#include <linux/stat.h>
+#endif
+
 #ifndef STATX_TYPE
+/* Local definitions if glibc & kernel headers didn't already provide them */
 
 /*
  * Timestamp structure for the timestamps in struct statx.