Wire up _weak posix_fadvise()
authorJens Axboe <axboe@kernel.dk>
Thu, 29 Nov 2012 20:27:20 +0000 (21:27 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Nov 2012 20:27:20 +0000 (21:27 +0100)
The commit adding Android support included a botched
variant of posix_fadvise().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
helpers.c
helpers.h
os/os.h

index 5be45ccf5f3954b3c87494132d7f0cdf94825814..1b4e1d0a2c9ccabe9c3e6483223f2abae54b5c7d 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -50,3 +50,10 @@ int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
        return -1;
 }
 #endif
+
+#ifndef FIO_HAVE_FADVISE
+int _weak posix_fadvise(int fd, off_t offset, off_t len, int advice)
+{
+       return 0;
+}
+#endif
index ed2086d147cee112fd4681ef45b8d63681c3247a..191096bde600b07c1ed352b69cd4d72cf193a337 100644 (file)
--- a/helpers.h
+++ b/helpers.h
@@ -15,5 +15,6 @@ extern int _weak inet_aton(const char *cp, struct in_addr *inp);
 extern int _weak clock_gettime(clockid_t clk_id, struct timespec *ts);
 extern int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
                                        unsigned int flags);
+extern int _weak posix_fadvise(int fd, off_t offset, off_t len, int advice);
 
 #endif /* FIO_HELPERS_H_ */
diff --git a/os/os.h b/os/os.h
index dd704647932a0ad7f9b1cf22a3860e8ee758b62d..2e4764e18f4ab6c021c3171827bd7323b52ef8bf 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -68,22 +68,11 @@ typedef struct aiocb os_aiocb_t;
 #define OS_MSG_DONTWAIT        MSG_DONTWAIT
 #endif
 
-#ifndef FIO_HAVE_FADVISE
-static inline int posix_fadvise(int fd, int off, int len, int advice)
-{
-       (void)fd;
-       (void)off;
-       (void)len;
-       (void)advice;
-       return 0;
-}
-
 #ifndef POSIX_FADV_DONTNEED
 #define POSIX_FADV_DONTNEED    (0)
 #define POSIX_FADV_SEQUENTIAL  (0)
 #define POSIX_FADV_RANDOM      (0)
 #endif
-#endif /* FIO_HAVE_FADVISE */
 
 #ifndef FIO_HAVE_CPU_AFFINITY
 #define fio_setaffinity(pid, mask)     (0)