1.1 --- a/libfsserver/include/fsserver/file_paging.h Sat Sep 11 19:44:57 2021 +0200
1.2 +++ b/libfsserver/include/fsserver/file_paging.h Sun Sep 12 01:14:30 2021 +0200
1.3 @@ -1,5 +1,5 @@
1.4 /*
1.5 - * A registry of objects supporting paging for files.
1.6 + * A registry of filesystem objects.
1.7 *
1.8 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 @@ -24,9 +24,9 @@
1.11 #include <map>
1.12 #include <mutex>
1.13
1.14 -#include <fsserver/file_notifier_registry.h>
1.15 +#include <fsserver/accountable.h>
1.16 #include <fsserver/file_opening.h>
1.17 -#include <fsserver/page_mapper.h>
1.18 +#include <fsserver/file_provider.h>
1.19 #include <fsserver/pager.h>
1.20 #include <fsserver/pages.h>
1.21
1.22 @@ -34,37 +34,36 @@
1.23
1.24 /* Mapping type from file identifiers to page mappers. */
1.25
1.26 -typedef std::map<fileid_t, PageMapper *> FileMapping;
1.27 -typedef std::pair<fileid_t, PageMapper *> FileMappingEntry;
1.28 +typedef std::map<fileid_t, Accountable *> FileMapping;
1.29 +typedef std::pair<fileid_t, Accountable *> FileMappingEntry;
1.30
1.31
1.32
1.33 -/* A registry of mappers for accessors. */
1.34 +/* A registry of filesystem objects. */
1.35
1.36 class FilePaging
1.37 {
1.38 protected:
1.39 Pages *_pages;
1.40 - FileNotifierRegistry *_notifiers;
1.41 - FileMapping _mappers;
1.42 + FileMapping _providers;
1.43 std::mutex _lock;
1.44
1.45 - /* Mapper registry access. */
1.46 + /* Filesystem object access. */
1.47
1.48 - PageMapper *get(fileid_t fileid);
1.49 + Accountable *get(fileid_t fileid);
1.50
1.51 - void remove(fileid_t fileid, PageMapper *mapper);
1.52 + void remove(fileid_t fileid, Accountable *obj);
1.53
1.54 - void set(fileid_t fileid, PageMapper *mapper);
1.55 + void set(fileid_t fileid, Accountable *obj);
1.56
1.57 /* Pager initialisation methods. */
1.58
1.59 map_flags_t get_flags(flags_t flags);
1.60
1.61 - long get_mapper(FileOpening *opening, const char *path, flags_t flags, fileid_t fileid, PageMapper **mapper);
1.62 + long get_provider(FileOpening *opening, const char *path, flags_t flags, fileid_t fileid, FileProvider **file_provider);
1.63
1.64 public:
1.65 - explicit FilePaging(Pages *pages, FileNotifierRegistry *notifiers);
1.66 + explicit FilePaging(Pages *pages);
1.67
1.68 /* Pager initialisation methods. */
1.69
1.70 @@ -72,9 +71,7 @@
1.71
1.72 /* Methods for the pager. */
1.73
1.74 - void detach_pager(fileid_t fileid, PageMapper *mapper);
1.75 -
1.76 - FileNotification *notifier(fileid_t fileid);
1.77 + void detach_pager(fileid_t fileid, Accountable *mapper);
1.78 };
1.79
1.80 // vim: tabstop=4 expandtab shiftwidth=4