1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/files/test_file_opener.cc Sun Mar 14 17:17:09 2021 +0100
1.3 @@ -0,0 +1,30 @@
1.4 +#include "test_file_accessor.h"
1.5 +#include "test_file_opener.h"
1.6 +
1.7 +#include <stdlib.h>
1.8 +
1.9 +/* Support for providing access to files. */
1.10 +
1.11 +TestFileOpener::TestFileOpener(Accessing *accessing, Paging *paging, Pages *pages,
1.12 + offset_t file_size)
1.13 +: OpenerResource(accessing, paging, pages), _file_size(file_size)
1.14 +{
1.15 +}
1.16 +
1.17 +/* Return a file identifier for the given 'path'. */
1.18 +
1.19 +fileid_t TestFileOpener::get_fileid(const char *path)
1.20 +{
1.21 + /* NOTE: Just convert the path to a number. */
1.22 +
1.23 + return atol(path);
1.24 +}
1.25 +
1.26 +/* Return a new accessor for 'fileid'. */
1.27 +
1.28 +Accessor *TestFileOpener::make_accessor(fileid_t fileid)
1.29 +{
1.30 + return new TestFileAccessor(fileid, _file_size);
1.31 +}
1.32 +
1.33 +// vim: tabstop=4 expandtab shiftwidth=4