Yet another place where we need to wrap code in
HAVE_DECL_SEEK_HOLE block.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/virfiletest.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index a93bee01a..d6a526c13 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -123,7 +123,11 @@ static int
makeSparseFile(const off_t offsets[],
const bool startData);
-#ifdef __linux__
+static bool
+holesSupported(void);
+
+#if HAVE_DECL_SEEK_HOLE
+
/* Create a sparse file. @offsets in KiB. */
static int
makeSparseFile(const off_t offsets[],
@@ -188,19 +192,8 @@ makeSparseFile(const off_t offsets[],
return -1;
}
-#else /* !__linux__ */
-static int
-makeSparseFile(const off_t offsets[] ATTRIBUTE_UNUSED,
- const bool startData ATTRIBUTE_UNUSED)
-{
- return -1;
-}
-
-#endif /* !__linux__ */
-
-
-#define EXTENT 4
+# define EXTENT 4
static bool
holesSupported(void)
{
@@ -245,6 +238,23 @@ holesSupported(void)
return ret;
}
+#else /* !HAVE_DECL_SEEK_HOLE */
+
+static int
+makeSparseFile(const off_t offsets[] ATTRIBUTE_UNUSED,
+ const bool startData ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+
+static bool
+holesSupported(void)
+{
+ return false;
+}
+
+#endif /* !HAVE_DECL_SEEK_HOLE */
struct testFileInData {
bool startData; /* whether the list of offsets starts with data section */
--
2.13.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, May 18, 2017 at 15:46:45 +0200, Michal Privoznik wrote: > Yet another place where we need to wrap code in > HAVE_DECL_SEEK_HOLE block. > > Signed-off-by: Michal Privoznik <mprivozn@redhat.com> > --- > tests/virfiletest.c | 36 +++++++++++++++++++++++------------- > 1 file changed, 23 insertions(+), 13 deletions(-) > > diff --git a/tests/virfiletest.c b/tests/virfiletest.c > index a93bee01a..d6a526c13 100644 > --- a/tests/virfiletest.c > +++ b/tests/virfiletest.c > @@ -123,7 +123,11 @@ static int > makeSparseFile(const off_t offsets[], > const bool startData); > > -#ifdef __linux__ > +static bool > +holesSupported(void); This is not necessary. > + > +#if HAVE_DECL_SEEK_HOLE > + > /* Create a sparse file. @offsets in KiB. */ > static int > makeSparseFile(const off_t offsets[], ACK -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, May 18, 2017 at 15:46:45 +0200, Michal Privoznik wrote: > Yet another place where we need to wrap code in > HAVE_DECL_SEEK_HOLE block. > > Signed-off-by: Michal Privoznik <mprivozn@redhat.com> > --- > tests/virfiletest.c | 36 +++++++++++++++++++++++------------- > 1 file changed, 23 insertions(+), 13 deletions(-) > > diff --git a/tests/virfiletest.c b/tests/virfiletest.c > index a93bee01a..d6a526c13 100644 > --- a/tests/virfiletest.c > +++ b/tests/virfiletest.c > @@ -123,7 +123,11 @@ static int > makeSparseFile(const off_t offsets[], > const bool startData); > > -#ifdef __linux__ > +static bool > +holesSupported(void); > + > +#if HAVE_DECL_SEEK_HOLE Also this stubbed out code is now dependant on HAVE_DECL_SEEK_HOLE, but the next patch includes file necessary for FALLOC_FL_PUNCH_HOLE only if __linux__ is defined. So you probably want HAVE_DECL_SEEK_HOLE && __linux__ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On 05/19/2017 12:36 PM, Peter Krempa wrote: > On Thu, May 18, 2017 at 15:46:45 +0200, Michal Privoznik wrote: >> Yet another place where we need to wrap code in >> HAVE_DECL_SEEK_HOLE block. >> >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> >> --- >> tests/virfiletest.c | 36 +++++++++++++++++++++++------------- >> 1 file changed, 23 insertions(+), 13 deletions(-) >> >> diff --git a/tests/virfiletest.c b/tests/virfiletest.c >> index a93bee01a..d6a526c13 100644 >> --- a/tests/virfiletest.c >> +++ b/tests/virfiletest.c >> @@ -123,7 +123,11 @@ static int >> makeSparseFile(const off_t offsets[], >> const bool startData); >> >> -#ifdef __linux__ >> +static bool >> +holesSupported(void); >> + >> +#if HAVE_DECL_SEEK_HOLE > > Also this stubbed out code is now dependant on HAVE_DECL_SEEK_HOLE, but > the next patch includes file necessary for FALLOC_FL_PUNCH_HOLE only if > __linux__ is defined. So you probably want HAVE_DECL_SEEK_HOLE && > __linux__ > Okay. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.