git » libjio » commit 94dce8c

Improve portability #warning messages

author Alberto Bertogli
2009-06-30 03:45:47 UTC
committer Alberto Bertogli
2009-06-30 03:45:47 UTC
parent 488f7b53b49a1253b3eef12b7482efe2b55f450e

Improve portability #warning messages

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

libjio/compat.c +10 -3
libjio/compat.h +1 -0

diff --git a/libjio/compat.c b/libjio/compat.c
index 6ca8cd3..3ad4463 100644
--- a/libjio/compat.c
+++ b/libjio/compat.c
@@ -42,7 +42,7 @@ int sync_range_wait(int fd, off_t offset, size_t nbytes)
 
 #else
 
-#warning "No sync_file_range()"
+#warning "Using fdatasync() instead of sync_file_range()"
 const int have_sync_range = 0;
 
 int sync_range_submit(int fd, off_t offset, size_t nbytes)
@@ -63,12 +63,19 @@ int sync_range_wait(int fd, off_t offset, size_t nbytes)
 #endif
 
 
+/* When posix_fadvise() is not available, we just show a message since there
+ * is no alternative implementation */
+#ifdef LACK_POSIX_FADVISE
+#warning "Not using posix_fadvise()"
+#endif
+
+
 /*
  * Support for platforms where clock_gettime() is not available.
  */
 
 #ifdef LACK_CLOCK_GETTIME
-#warning "No clock_gettime() available, falling back to gettimeofday()"
+#warning "Using gettimeofday() instead of clock_gettime()"
 
 #include <sys/time.h>		/* gettimeofday() */
 
@@ -87,7 +94,7 @@ int clock_gettime(int clk_id, struct timespec *tp)
 #endif /* defined LACK_CLOCK_GETTIME */
 
 #ifdef LACK_FDATASYNC
-#warning "Assuming no fdatasync(), falling back to fsync()"
+#warning "Using fsync() instead of fdatasync()"
 
 #include <unistd.h>		/* fsync() */
 
diff --git a/libjio/compat.h b/libjio/compat.h
index 3cd7326..cceeb29 100644
--- a/libjio/compat.h
+++ b/libjio/compat.h
@@ -23,6 +23,7 @@ int sync_range_wait(int fd, off_t offset, size_t nbytes);
  * nice, but it's simple, it works and should be reliable. */
 #include <fcntl.h>
 #ifndef POSIX_FADV_WILLNEED
+#define LACK_POSIX_FADVISE 1
 #define posix_fadvise(fd, offset, len, advise)
 #endif