diff --git a/block-cache/io_engine.h b/block-cache/io_engine.h index 1704251..0e13957 100644 --- a/block-cache/io_engine.h +++ b/block-cache/io_engine.h @@ -10,13 +10,17 @@ #include #include +#include +#ifndef PAGE_SIZE +#define PAGE_SIZE sysconf(_SC_PAGE_SIZE) +#endif + //---------------------------------------------------------------- namespace bcache { using sector_t = uint64_t; unsigned const SECTOR_SHIFT = 9; - unsigned const PAGE_SIZE = 4096; // Virtual base class to aid unit testing class io_engine { diff --git a/unit-tests/io_engine_t.cc b/unit-tests/io_engine_t.cc index 2790eb6..d9a25e3 100644 --- a/unit-tests/io_engine_t.cc +++ b/unit-tests/io_engine_t.cc @@ -23,6 +23,10 @@ #include +#include +#ifndef PAGE_SIZE +#define PAGE_SIZE sysconf(_SC_PAGE_SIZE) +#endif using namespace boost; using namespace std; @@ -33,7 +37,6 @@ using namespace testing; namespace { unsigned const MAX_IO = 64; - unsigned const PAGE_SIZE = 4096; class IOEngineTests : public Test { public: