Message ID | 1393355728-12056-5-git-send-email-lczerner@redhat.com |
---|---|
State | Not Applicable, archived |
Headers | show |
On Tue, Feb 25, 2014 at 08:15:27PM +0100, Lukas Czerner wrote: > Define fallocate flags such as FALLOC_FL_PUNCH_HOLE and > FALLOC_FL_ZERO_RANGE locally if they do not exist. > > Signed-off-by: Lukas Czerner <lczerner@redhat.com> > --- > ltp/fsx.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/ltp/fsx.c b/ltp/fsx.c > index b3c30db..331257e 100644 > --- a/ltp/fsx.c > +++ b/ltp/fsx.c > @@ -35,8 +35,13 @@ > #endif > #ifdef FALLOCATE > #include <linux/falloc.h> > +#ifndef FALLOC_FL_PUNCH_HOLE > +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ > +#endif > +#ifndef FALLOC_FL_ZERO_RANGE > +#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes range */ > +#endif > #endif This pattern is appearing all over the place in xfstests now. I'd suggest that this should really be handled by autoconf, include/config.h and src/globals.h.... Cheers, Dave.
On Wed, Feb 26, 2014 at 07:39:22AM +1100, Dave Chinner wrote: > > index b3c30db..331257e 100644 > > --- a/ltp/fsx.c > > +++ b/ltp/fsx.c > > @@ -35,8 +35,13 @@ > > #endif > > #ifdef FALLOCATE > > #include <linux/falloc.h> > > +#ifndef FALLOC_FL_PUNCH_HOLE > > +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ > > +#endif > > +#ifndef FALLOC_FL_ZERO_RANGE > > +#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes range */ > > +#endif > > #endif > > This pattern is appearing all over the place in xfstests now. I'd > suggest that this should really be handled by autoconf, > include/config.h and src/globals.h.... Can we handle this nicely using autoconf, especially in the case of O_ flags that might be different for different architectures? Either way having a single header for the various flags that might not be present in the system headers sounds like a good plan. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Feb 25, 2014 at 01:56:16PM -0800, Christoph Hellwig wrote: > On Wed, Feb 26, 2014 at 07:39:22AM +1100, Dave Chinner wrote: > > > index b3c30db..331257e 100644 > > > --- a/ltp/fsx.c > > > +++ b/ltp/fsx.c > > > @@ -35,8 +35,13 @@ > > > #endif > > > #ifdef FALLOCATE > > > #include <linux/falloc.h> > > > +#ifndef FALLOC_FL_PUNCH_HOLE > > > +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ > > > +#endif > > > +#ifndef FALLOC_FL_ZERO_RANGE > > > +#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes range */ > > > +#endif > > > #endif > > > > This pattern is appearing all over the place in xfstests now. I'd > > suggest that this should really be handled by autoconf, > > include/config.h and src/globals.h.... > > Can we handle this nicely using autoconf, especially in the case of O_ > flags that might be different for different architectures? I think so, because config.h is generated from config.h.in and ends up looking like: #define HAVE_SOME_FUNCTION 1 src/globals.h is controlled directly by us, and ends up looking like: #ifdef HAVE_SOME_FUNCTION #include <header_for_some_function.h> #endif If we add all the defines that may be missing that same ifdef section, and make sure that all code includes globals.h, then all the code will have the "HAVE_SOME_FUNCTION" defines and the appropriate header files and definitions included. > Either way having a single header for the various flags that might not > be present in the system headers sounds like a good plan. *nod* Cheers, Dave.
diff --git a/ltp/fsx.c b/ltp/fsx.c index b3c30db..331257e 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -35,8 +35,13 @@ #endif #ifdef FALLOCATE #include <linux/falloc.h> +#ifndef FALLOC_FL_PUNCH_HOLE +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ +#endif +#ifndef FALLOC_FL_ZERO_RANGE +#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes range */ +#endif #endif - #ifndef MAP_FILE # define MAP_FILE 0 #endif
Define fallocate flags such as FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE locally if they do not exist. Signed-off-by: Lukas Czerner <lczerner@redhat.com> --- ltp/fsx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)