paul@9 | 1 | #include "test_file_accessor.h" |
paul@9 | 2 | #include "test_file_opener.h" |
paul@9 | 3 | |
paul@9 | 4 | #include <stdlib.h> |
paul@9 | 5 | |
paul@9 | 6 | /* Support for providing access to files. */ |
paul@9 | 7 | |
paul@79 | 8 | TestFileOpener::TestFileOpener(Pages *pages, offset_t file_size) |
paul@79 | 9 | : OpenerResource(pages), _file_size(file_size) |
paul@9 | 10 | { |
paul@9 | 11 | } |
paul@9 | 12 | |
paul@9 | 13 | /* Return a file identifier for the given 'path'. */ |
paul@9 | 14 | |
paul@9 | 15 | fileid_t TestFileOpener::get_fileid(const char *path) |
paul@9 | 16 | { |
paul@9 | 17 | /* NOTE: Just convert the path to a number. */ |
paul@9 | 18 | |
paul@9 | 19 | return atol(path); |
paul@9 | 20 | } |
paul@9 | 21 | |
paul@9 | 22 | /* Return a new accessor for 'fileid'. */ |
paul@9 | 23 | |
paul@9 | 24 | Accessor *TestFileOpener::make_accessor(fileid_t fileid) |
paul@9 | 25 | { |
paul@9 | 26 | return new TestFileAccessor(fileid, _file_size); |
paul@9 | 27 | } |
paul@9 | 28 | |
paul@9 | 29 | // vim: tabstop=4 expandtab shiftwidth=4 |