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@78 | 8 | TestFileOpener::TestFileOpener(Paging *paging, Pages *pages, |
paul@10 | 9 | offset_t file_size) |
paul@78 | 10 | : OpenerResource(paging, pages), _file_size(file_size) |
paul@9 | 11 | { |
paul@9 | 12 | } |
paul@9 | 13 | |
paul@9 | 14 | /* Return a file identifier for the given 'path'. */ |
paul@9 | 15 | |
paul@9 | 16 | fileid_t TestFileOpener::get_fileid(const char *path) |
paul@9 | 17 | { |
paul@9 | 18 | /* NOTE: Just convert the path to a number. */ |
paul@9 | 19 | |
paul@9 | 20 | return atol(path); |
paul@9 | 21 | } |
paul@9 | 22 | |
paul@9 | 23 | /* Return a new accessor for 'fileid'. */ |
paul@9 | 24 | |
paul@9 | 25 | Accessor *TestFileOpener::make_accessor(fileid_t fileid) |
paul@9 | 26 | { |
paul@9 | 27 | return new TestFileAccessor(fileid, _file_size); |
paul@9 | 28 | } |
paul@9 | 29 | |
paul@9 | 30 | // vim: tabstop=4 expandtab shiftwidth=4 |