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