This commit does exactly the same as what cgroup.h does for cgroup
support.
Since blktrace is Linux specific feature and api compiled only on
Linux and Android, these two could be defined in blktrace.h rather
than in os/os.h which is basically intended to be something generic
whose implementation vary depending on supported platforms.
The reason for adding a new header blktrace.h instead of using
blktrace_api.h is because blktrace_api.h seems to have been added
for blktrace.c to include which gets compiled only on Linux where
blktrace apis are basically guaranteed to exist (unless really old
kernels), whereas these prototypes or inline functions are needed
by all platforms.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
#include "flist.h"
#include "fio.h"
#include "flist.h"
#include "fio.h"
#include "blktrace_api.h"
#include "oslib/linux-dev-lookup.h"
#include "blktrace_api.h"
#include "oslib/linux-dev-lookup.h"
--- /dev/null
+#ifndef FIO_BLKTRACE_H
+#define FIO_BLKTRACE_H
+
+#ifdef FIO_HAVE_BLKTRACE
+
+int is_blktrace(const char *, int *);
+int load_blktrace(struct thread_data *, const char *, int);
+
+#else
+
+static inline int is_blktrace(const char *fname, int *need_swap)
+{
+ return 0;
+}
+
+static inline int load_blktrace(struct thread_data *td, const char *fname,
+ int need_swap)
+{
+ return 1;
+}
+
+#endif
+#endif
*/
extern void reset_all_stats(struct thread_data *);
*/
extern void reset_all_stats(struct thread_data *);
-/*
- * blktrace support
- */
-#ifdef FIO_HAVE_BLKTRACE
-extern int is_blktrace(const char *, int *);
-extern int load_blktrace(struct thread_data *, const char *, int);
-#endif
-
extern int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret,
enum fio_ddir ddir, uint64_t *bytes_issued, int from_verify,
struct timeval *comp_time);
extern int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret,
enum fio_ddir ddir, uint64_t *bytes_issued, int from_verify,
struct timeval *comp_time);
#include "trim.h"
#include "filelock.h"
#include "smalloc.h"
#include "trim.h"
#include "filelock.h"
#include "smalloc.h"
static int iolog_flush(struct io_log *log);
static int iolog_flush(struct io_log *log);
-#ifndef FIO_HAVE_BLKTRACE
-static inline int is_blktrace(const char *fname, int *need_swap)
-{
- return 0;
-}
-struct thread_data;
-static inline int load_blktrace(struct thread_data *td, const char *fname,
- int need_swap)
-{
- return 1;
-}
-#endif
-
#define FIO_DEF_CL_SIZE 128
static inline int os_cache_line_size(void)
#define FIO_DEF_CL_SIZE 128
static inline int os_cache_line_size(void)