1.1 --- a/libfsserver/include/fsserver/block_file_opener.h Mon Sep 27 01:16:49 2021 +0200 1.2 +++ b/libfsserver/include/fsserver/block_file_opener.h Mon Sep 27 01:30:05 2021 +0200 1.3 @@ -30,8 +30,8 @@ 1.4 class BlockFileOpener : public HostFileOpener 1.5 { 1.6 public: 1.7 - explicit BlockFileOpener(FilePaging *paging) 1.8 - : HostFileOpener(paging) 1.9 + explicit BlockFileOpener(FileObjectRegistry *registry) 1.10 + : HostFileOpener(registry) 1.11 { 1.12 } 1.13
2.1 --- a/libfsserver/include/fsserver/ext2_file_opener.h Mon Sep 27 01:16:49 2021 +0200 2.2 +++ b/libfsserver/include/fsserver/ext2_file_opener.h Mon Sep 27 01:30:05 2021 +0200 2.3 @@ -45,8 +45,8 @@ 2.4 virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid); 2.5 2.6 public: 2.7 - explicit Ext2FileOpener(FilePaging *paging, Ext2FileOperations *ops, user_t user) 2.8 - : OpenerResource(paging), _ops(ops), _user(user) 2.9 + explicit Ext2FileOpener(FileObjectRegistry *registry, Ext2FileOperations *ops, user_t user) 2.10 + : OpenerResource(registry), _ops(ops), _user(user) 2.11 { 2.12 } 2.13
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/libfsserver/include/fsserver/file_object_registry.h Mon Sep 27 01:30:05 2021 +0200 3.3 @@ -0,0 +1,69 @@ 3.4 +/* 3.5 + * A registry of filesystem objects. 3.6 + * 3.7 + * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 3.8 + * 3.9 + * This program is free software; you can redistribute it and/or 3.10 + * modify it under the terms of the GNU General Public License as 3.11 + * published by the Free Software Foundation; either version 2 of 3.12 + * the License, or (at your option) any later version. 3.13 + * 3.14 + * This program is distributed in the hope that it will be useful, 3.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 3.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 3.17 + * GNU General Public License for more details. 3.18 + * 3.19 + * You should have received a copy of the GNU General Public License 3.20 + * along with this program; if not, write to the Free Software 3.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 3.22 + * Boston, MA 02110-1301, USA 3.23 + */ 3.24 + 3.25 +#pragma once 3.26 + 3.27 +#include <fsserver/directory_provider.h> 3.28 +#include <fsserver/file_opening.h> 3.29 +#include <fsserver/file_provider.h> 3.30 +#include <fsserver/file_registry.h> 3.31 +#include <fsserver/pager.h> 3.32 +#include <fsserver/pages.h> 3.33 + 3.34 + 3.35 + 3.36 +/* A registry of filesystem objects. */ 3.37 + 3.38 +class FileObjectRegistry : public FileRegistry 3.39 +{ 3.40 +protected: 3.41 + Pages *_pages; 3.42 + 3.43 + /* Resource initialisation methods. */ 3.44 + 3.45 + map_flags_t get_flags(flags_t flags); 3.46 + 3.47 + long get_directory_provider(FileOpening *opening, const char *path, 3.48 + flags_t flags, fileid_t fileid, 3.49 + DirectoryProvider **directory_provider); 3.50 + 3.51 + long get_file_provider(FileOpening *opening, const char *path, 3.52 + flags_t flags, fileid_t fileid, 3.53 + FileProvider **file_provider); 3.54 + 3.55 +public: 3.56 + explicit FileObjectRegistry(Pages *pages); 3.57 + 3.58 + /* Resource discovery methods. */ 3.59 + 3.60 + long find_directory_provider(fileid_t fileid, 3.61 + DirectoryProvider **directory_provider); 3.62 + 3.63 + /* Resource initialisation methods. */ 3.64 + 3.65 + long get_directory(FileOpening *opening, const char *path, flags_t flags, 3.66 + fileid_t fileid, Resource **resource); 3.67 + 3.68 + long get_pager(FileOpening *opening, const char *path, flags_t flags, 3.69 + fileid_t fileid, Pager **pager); 3.70 +}; 3.71 + 3.72 +// vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/libfsserver/include/fsserver/file_paging.h Mon Sep 27 01:16:49 2021 +0200 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,69 +0,0 @@ 4.4 -/* 4.5 - * A registry of filesystem objects. 4.6 - * 4.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 4.8 - * 4.9 - * This program is free software; you can redistribute it and/or 4.10 - * modify it under the terms of the GNU General Public License as 4.11 - * published by the Free Software Foundation; either version 2 of 4.12 - * the License, or (at your option) any later version. 4.13 - * 4.14 - * This program is distributed in the hope that it will be useful, 4.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 4.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 4.17 - * GNU General Public License for more details. 4.18 - * 4.19 - * You should have received a copy of the GNU General Public License 4.20 - * along with this program; if not, write to the Free Software 4.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 4.22 - * Boston, MA 02110-1301, USA 4.23 - */ 4.24 - 4.25 -#pragma once 4.26 - 4.27 -#include <fsserver/directory_provider.h> 4.28 -#include <fsserver/file_opening.h> 4.29 -#include <fsserver/file_provider.h> 4.30 -#include <fsserver/file_registry.h> 4.31 -#include <fsserver/pager.h> 4.32 -#include <fsserver/pages.h> 4.33 - 4.34 - 4.35 - 4.36 -/* A registry of filesystem objects. */ 4.37 - 4.38 -class FilePaging : public FileRegistry 4.39 -{ 4.40 -protected: 4.41 - Pages *_pages; 4.42 - 4.43 - /* Resource initialisation methods. */ 4.44 - 4.45 - map_flags_t get_flags(flags_t flags); 4.46 - 4.47 - long get_directory_provider(FileOpening *opening, const char *path, 4.48 - flags_t flags, fileid_t fileid, 4.49 - DirectoryProvider **directory_provider); 4.50 - 4.51 - long get_file_provider(FileOpening *opening, const char *path, 4.52 - flags_t flags, fileid_t fileid, 4.53 - FileProvider **file_provider); 4.54 - 4.55 -public: 4.56 - explicit FilePaging(Pages *pages); 4.57 - 4.58 - /* Resource discovery methods. */ 4.59 - 4.60 - long find_directory_provider(fileid_t fileid, 4.61 - DirectoryProvider **directory_provider); 4.62 - 4.63 - /* Resource initialisation methods. */ 4.64 - 4.65 - long get_directory(FileOpening *opening, const char *path, flags_t flags, 4.66 - fileid_t fileid, Resource **resource); 4.67 - 4.68 - long get_pager(FileOpening *opening, const char *path, flags_t flags, 4.69 - fileid_t fileid, Pager **pager); 4.70 -}; 4.71 - 4.72 -// vim: tabstop=4 expandtab shiftwidth=4
5.1 --- a/libfsserver/include/fsserver/filesystem_resource.h Mon Sep 27 01:16:49 2021 +0200 5.2 +++ b/libfsserver/include/fsserver/filesystem_resource.h Mon Sep 27 01:30:05 2021 +0200 5.3 @@ -21,7 +21,7 @@ 5.4 5.5 #pragma once 5.6 5.7 -#include <fsserver/file_paging.h> 5.8 +#include <fsserver/file_object_registry.h> 5.9 #include <fsserver/filesystem_object_interface.h> 5.10 #include <fsserver/resource.h> 5.11 5.12 @@ -29,7 +29,7 @@ 5.13 5.14 /* Support for providing access to user-specific filesystems. */ 5.15 5.16 -class FilesystemResource : public Resource, public FilePaging, 5.17 +class FilesystemResource : public Resource, public FileObjectRegistry, 5.18 public FilesystemObject 5.19 { 5.20 public:
6.1 --- a/libfsserver/include/fsserver/host_file_opener.h Mon Sep 27 01:16:49 2021 +0200 6.2 +++ b/libfsserver/include/fsserver/host_file_opener.h Mon Sep 27 01:30:05 2021 +0200 6.3 @@ -55,8 +55,8 @@ 6.4 virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid); 6.5 6.6 public: 6.7 - explicit HostFileOpener(FilePaging *paging) 6.8 - : OpenerResource(paging) 6.9 + explicit HostFileOpener(FileObjectRegistry *registry) 6.10 + : OpenerResource(registry) 6.11 { 6.12 } 6.13
7.1 --- a/libfsserver/include/fsserver/opener_resource.h Mon Sep 27 01:16:49 2021 +0200 7.2 +++ b/libfsserver/include/fsserver/opener_resource.h Mon Sep 27 01:30:05 2021 +0200 7.3 @@ -21,8 +21,8 @@ 7.4 7.5 #pragma once 7.6 7.7 +#include <fsserver/file_object_registry.h> 7.8 #include <fsserver/file_opening.h> 7.9 -#include <fsserver/file_paging.h> 7.10 #include <fsserver/opener_context_resource.h> 7.11 #include <fsserver/opener_interface.h> 7.12 #include <fsserver/resource.h> 7.13 @@ -34,7 +34,7 @@ 7.14 class OpenerResource : public Resource, public FileOpening, public Opener 7.15 { 7.16 protected: 7.17 - FilePaging *_paging; 7.18 + FileObjectRegistry *_registry; 7.19 7.20 /* Convenience methods determining different object types. */ 7.21 7.22 @@ -53,7 +53,7 @@ 7.23 object_flags_t *object_flags); 7.24 7.25 public: 7.26 - explicit OpenerResource(FilePaging *paging); 7.27 + explicit OpenerResource(FileObjectRegistry *registry); 7.28 7.29 virtual ~OpenerResource(); 7.30
8.1 --- a/libfsserver/include/fsserver/test_file_opener.h Mon Sep 27 01:16:49 2021 +0200 8.2 +++ b/libfsserver/include/fsserver/test_file_opener.h Mon Sep 27 01:30:05 2021 +0200 8.3 @@ -39,7 +39,7 @@ 8.4 virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid); 8.5 8.6 public: 8.7 - explicit TestFileOpener(FilePaging *paging, offset_t file_size=0); 8.8 + explicit TestFileOpener(FileObjectRegistry *registry, offset_t file_size=0); 8.9 8.10 virtual ~TestFileOpener(); 8.11
9.1 --- a/libfsserver/lib/Makefile Mon Sep 27 01:16:49 2021 +0200 9.2 +++ b/libfsserver/lib/Makefile Mon Sep 27 01:30:05 2021 +0200 9.3 @@ -57,8 +57,8 @@ 9.4 files/ext2_file_operations.cc \ 9.5 files/ext2_filesystem.cc \ 9.6 files/file_notification.cc \ 9.7 + files/file_object_registry.cc \ 9.8 files/file_pager.cc \ 9.9 - files/file_paging.cc \ 9.10 files/file_provider.cc \ 9.11 files/file_registry.cc \ 9.12 files/filesystem_resource.cc \
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/libfsserver/lib/files/file_object_registry.cc Mon Sep 27 01:30:05 2021 +0200 10.3 @@ -0,0 +1,189 @@ 10.4 +/* 10.5 + * File registry and opening functionality. 10.6 + * 10.7 + * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 10.8 + * 10.9 + * This program is free software; you can redistribute it and/or 10.10 + * modify it under the terms of the GNU General Public License as 10.11 + * published by the Free Software Foundation; either version 2 of 10.12 + * the License, or (at your option) any later version. 10.13 + * 10.14 + * This program is distributed in the hope that it will be useful, 10.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10.17 + * GNU General Public License for more details. 10.18 + * 10.19 + * You should have received a copy of the GNU General Public License 10.20 + * along with this program; if not, write to the Free Software 10.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 10.22 + * Boston, MA 02110-1301, USA 10.23 + */ 10.24 + 10.25 +#include "directory_resource.h" 10.26 +#include "file_object_registry.h" 10.27 +#include "file_pager.h" 10.28 + 10.29 +#include <systypes/fcntl.h> 10.30 + 10.31 + 10.32 + 10.33 +/* The file object registry provides a memory page collection to the page 10.34 + mappers it creates. */ 10.35 + 10.36 +FileObjectRegistry::FileObjectRegistry(Pages *pages) 10.37 +: _pages(pages) 10.38 +{ 10.39 +} 10.40 + 10.41 + 10.42 + 10.43 +/* Convert opening flags to map-compatible paging flags. */ 10.44 + 10.45 +map_flags_t FileObjectRegistry::get_flags(flags_t flags) 10.46 +{ 10.47 + return flags & (O_WRONLY | O_RDWR) ? L4RE_DS_MAP_FLAG_RW : L4RE_DS_MAP_FLAG_RO; 10.48 +} 10.49 + 10.50 + 10.51 + 10.52 +/* Obtain any active provider for 'fileid'. */ 10.53 + 10.54 +long FileObjectRegistry::find_directory_provider(fileid_t fileid, 10.55 + DirectoryProvider **directory_provider) 10.56 +{ 10.57 + /* Obtain any registered provider. */ 10.58 + 10.59 + Accountable *provider = get(fileid); 10.60 + 10.61 + if (provider != NULL) 10.62 + { 10.63 + *directory_provider = dynamic_cast<DirectoryProvider *>(provider); 10.64 + 10.65 + if ((*directory_provider) != NULL) 10.66 + return L4_EOK; 10.67 + else 10.68 + return -L4_EIO; 10.69 + } 10.70 + 10.71 + return -L4_ENOENT; 10.72 +} 10.73 + 10.74 +/* Obtain a provider for the 'fileid' or register a new one. */ 10.75 + 10.76 +long FileObjectRegistry::get_directory_provider(FileOpening *opening, 10.77 + const char *path, flags_t flags, 10.78 + fileid_t fileid, 10.79 + DirectoryProvider **directory_provider) 10.80 +{ 10.81 + long err = find_directory_provider(fileid, directory_provider); 10.82 + 10.83 + if (err != -L4_ENOENT) 10.84 + return err; 10.85 + 10.86 + /* Make an accessor and a provider to encapsulate it. */ 10.87 + 10.88 + DirectoryAccessor *accessor; 10.89 + err = opening->make_directory_accessor(path, flags, fileid, &accessor); 10.90 + 10.91 + if (err) 10.92 + return err; 10.93 + 10.94 + *directory_provider = new DirectoryProvider(accessor); 10.95 + 10.96 + /* Register the provider. */ 10.97 + 10.98 + set(fileid, *directory_provider); 10.99 + return L4_EOK; 10.100 +} 10.101 + 10.102 +/* Obtain a provider for the 'fileid' or register a new one. */ 10.103 + 10.104 +long FileObjectRegistry::get_file_provider(FileOpening *opening, 10.105 + const char *path, flags_t flags, 10.106 + fileid_t fileid, 10.107 + FileProvider **file_provider) 10.108 +{ 10.109 + /* Obtain any registered provider. */ 10.110 + 10.111 + Accountable *provider = get(fileid); 10.112 + 10.113 + if (provider != NULL) 10.114 + { 10.115 + *file_provider = dynamic_cast<FileProvider *>(provider); 10.116 + 10.117 + if ((*file_provider) != NULL) 10.118 + return L4_EOK; 10.119 + else 10.120 + return -L4_EIO; 10.121 + } 10.122 + 10.123 + /* Make an accessor, page mapper, and a provider to encapsulate them. */ 10.124 + 10.125 + Accessor *accessor; 10.126 + long err = opening->make_accessor(path, flags, fileid, &accessor); 10.127 + 10.128 + if (err) 10.129 + return err; 10.130 + 10.131 + PageMapper *mapper = new PageMapper(accessor, _pages); 10.132 + *file_provider = new FileProvider(mapper); 10.133 + 10.134 + /* Register the provider. */ 10.135 + 10.136 + set(fileid, *file_provider); 10.137 + return L4_EOK; 10.138 +} 10.139 + 10.140 + 10.141 + 10.142 +/* Return a directory resource initialised with a provider. */ 10.143 + 10.144 +long FileObjectRegistry::get_directory(FileOpening *opening, const char *path, 10.145 + flags_t flags, fileid_t fileid, 10.146 + Resource **resource) 10.147 +{ 10.148 + std::lock_guard<std::mutex> guard(_lock); 10.149 + 10.150 + /* Obtain any existing provider registered for the object, or make a new 10.151 + provider. */ 10.152 + 10.153 + DirectoryProvider *provider; 10.154 + long err = get_directory_provider(opening, path, flags, fileid, &provider); 10.155 + 10.156 + if (err) 10.157 + return err; 10.158 + 10.159 + /* Initialise the resource with the provider and a reference to this object 10.160 + for detaching from the provider. */ 10.161 + 10.162 + provider->attach(); 10.163 + *resource = new DirectoryResource(fileid, provider, this); 10.164 + return L4_EOK; 10.165 +} 10.166 + 10.167 +/* Return a pager initialised with a provider, page mapper and accessor. */ 10.168 + 10.169 +long FileObjectRegistry::get_pager(FileOpening *opening, const char *path, 10.170 + flags_t flags, fileid_t fileid, 10.171 + Pager **pager) 10.172 +{ 10.173 + std::lock_guard<std::mutex> guard(_lock); 10.174 + 10.175 + /* Obtain any existing provider registered for the file, or make a new 10.176 + provider. */ 10.177 + 10.178 + FileProvider *provider; 10.179 + long err = get_file_provider(opening, path, flags, fileid, &provider); 10.180 + 10.181 + if (err) 10.182 + return err; 10.183 + 10.184 + /* Initialise the pager with the provider and a reference to this object for 10.185 + detaching from the provider. */ 10.186 + 10.187 + provider->attach(); 10.188 + *pager = new FilePager(fileid, provider, get_flags(flags), this); 10.189 + return L4_EOK; 10.190 +} 10.191 + 10.192 +// vim: tabstop=4 expandtab shiftwidth=4
11.1 --- a/libfsserver/lib/files/file_paging.cc Mon Sep 27 01:16:49 2021 +0200 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,186 +0,0 @@ 11.4 -/* 11.5 - * File registry and opening functionality. 11.6 - * 11.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 11.8 - * 11.9 - * This program is free software; you can redistribute it and/or 11.10 - * modify it under the terms of the GNU General Public License as 11.11 - * published by the Free Software Foundation; either version 2 of 11.12 - * the License, or (at your option) any later version. 11.13 - * 11.14 - * This program is distributed in the hope that it will be useful, 11.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11.17 - * GNU General Public License for more details. 11.18 - * 11.19 - * You should have received a copy of the GNU General Public License 11.20 - * along with this program; if not, write to the Free Software 11.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 11.22 - * Boston, MA 02110-1301, USA 11.23 - */ 11.24 - 11.25 -#include "directory_resource.h" 11.26 -#include "file_pager.h" 11.27 -#include "file_paging.h" 11.28 - 11.29 -#include <systypes/fcntl.h> 11.30 - 11.31 - 11.32 - 11.33 -/* The file paging coordinator provides a memory page collection to the page 11.34 - mappers it creates. */ 11.35 - 11.36 -FilePaging::FilePaging(Pages *pages) 11.37 -: _pages(pages) 11.38 -{ 11.39 -} 11.40 - 11.41 - 11.42 - 11.43 -/* Convert opening flags to map-compatible paging flags. */ 11.44 - 11.45 -map_flags_t FilePaging::get_flags(flags_t flags) 11.46 -{ 11.47 - return flags & (O_WRONLY | O_RDWR) ? L4RE_DS_MAP_FLAG_RW : L4RE_DS_MAP_FLAG_RO; 11.48 -} 11.49 - 11.50 - 11.51 - 11.52 -/* Obtain any active provider for 'fileid'. */ 11.53 - 11.54 -long FilePaging::find_directory_provider(fileid_t fileid, 11.55 - DirectoryProvider **directory_provider) 11.56 -{ 11.57 - /* Obtain any registered provider. */ 11.58 - 11.59 - Accountable *provider = get(fileid); 11.60 - 11.61 - if (provider != NULL) 11.62 - { 11.63 - *directory_provider = dynamic_cast<DirectoryProvider *>(provider); 11.64 - 11.65 - if ((*directory_provider) != NULL) 11.66 - return L4_EOK; 11.67 - else 11.68 - return -L4_EIO; 11.69 - } 11.70 - 11.71 - return -L4_ENOENT; 11.72 -} 11.73 - 11.74 -/* Obtain a provider for the 'fileid' or register a new one. */ 11.75 - 11.76 -long FilePaging::get_directory_provider(FileOpening *opening, const char *path, 11.77 - flags_t flags, fileid_t fileid, 11.78 - DirectoryProvider **directory_provider) 11.79 -{ 11.80 - long err = find_directory_provider(fileid, directory_provider); 11.81 - 11.82 - if (err != -L4_ENOENT) 11.83 - return err; 11.84 - 11.85 - /* Make an accessor and a provider to encapsulate it. */ 11.86 - 11.87 - DirectoryAccessor *accessor; 11.88 - err = opening->make_directory_accessor(path, flags, fileid, &accessor); 11.89 - 11.90 - if (err) 11.91 - return err; 11.92 - 11.93 - *directory_provider = new DirectoryProvider(accessor); 11.94 - 11.95 - /* Register the provider. */ 11.96 - 11.97 - set(fileid, *directory_provider); 11.98 - return L4_EOK; 11.99 -} 11.100 - 11.101 -/* Obtain a provider for the 'fileid' or register a new one. */ 11.102 - 11.103 -long FilePaging::get_file_provider(FileOpening *opening, const char *path, 11.104 - flags_t flags, fileid_t fileid, 11.105 - FileProvider **file_provider) 11.106 -{ 11.107 - /* Obtain any registered provider. */ 11.108 - 11.109 - Accountable *provider = get(fileid); 11.110 - 11.111 - if (provider != NULL) 11.112 - { 11.113 - *file_provider = dynamic_cast<FileProvider *>(provider); 11.114 - 11.115 - if ((*file_provider) != NULL) 11.116 - return L4_EOK; 11.117 - else 11.118 - return -L4_EIO; 11.119 - } 11.120 - 11.121 - /* Make an accessor, page mapper, and a provider to encapsulate them. */ 11.122 - 11.123 - Accessor *accessor; 11.124 - long err = opening->make_accessor(path, flags, fileid, &accessor); 11.125 - 11.126 - if (err) 11.127 - return err; 11.128 - 11.129 - PageMapper *mapper = new PageMapper(accessor, _pages); 11.130 - *file_provider = new FileProvider(mapper); 11.131 - 11.132 - /* Register the provider. */ 11.133 - 11.134 - set(fileid, *file_provider); 11.135 - return L4_EOK; 11.136 -} 11.137 - 11.138 - 11.139 - 11.140 -/* Return a directory resource initialised with a provider. */ 11.141 - 11.142 -long FilePaging::get_directory(FileOpening *opening, const char *path, 11.143 - flags_t flags, fileid_t fileid, 11.144 - Resource **resource) 11.145 -{ 11.146 - std::lock_guard<std::mutex> guard(_lock); 11.147 - 11.148 - /* Obtain any existing provider registered for the object, or make a new 11.149 - provider. */ 11.150 - 11.151 - DirectoryProvider *provider; 11.152 - long err = get_directory_provider(opening, path, flags, fileid, &provider); 11.153 - 11.154 - if (err) 11.155 - return err; 11.156 - 11.157 - /* Initialise the resource with the provider and a reference to this object 11.158 - for detaching from the provider. */ 11.159 - 11.160 - provider->attach(); 11.161 - *resource = new DirectoryResource(fileid, provider, this); 11.162 - return L4_EOK; 11.163 -} 11.164 - 11.165 -/* Return a pager initialised with a provider, page mapper and accessor. */ 11.166 - 11.167 -long FilePaging::get_pager(FileOpening *opening, const char *path, 11.168 - flags_t flags, fileid_t fileid, Pager **pager) 11.169 -{ 11.170 - std::lock_guard<std::mutex> guard(_lock); 11.171 - 11.172 - /* Obtain any existing provider registered for the file, or make a new 11.173 - provider. */ 11.174 - 11.175 - FileProvider *provider; 11.176 - long err = get_file_provider(opening, path, flags, fileid, &provider); 11.177 - 11.178 - if (err) 11.179 - return err; 11.180 - 11.181 - /* Initialise the pager with the provider and a reference to this object for 11.182 - detaching from the provider. */ 11.183 - 11.184 - provider->attach(); 11.185 - *pager = new FilePager(fileid, provider, get_flags(flags), this); 11.186 - return L4_EOK; 11.187 -} 11.188 - 11.189 -// vim: tabstop=4 expandtab shiftwidth=4
12.1 --- a/libfsserver/lib/files/filesystem_resource.cc Mon Sep 27 01:16:49 2021 +0200 12.2 +++ b/libfsserver/lib/files/filesystem_resource.cc Mon Sep 27 01:30:05 2021 +0200 12.3 @@ -25,7 +25,7 @@ 12.4 /* Support for providing access to user-specific filesystems. */ 12.5 12.6 FilesystemResource::FilesystemResource(Pages *pages) 12.7 -: FilePaging(pages) 12.8 +: FileObjectRegistry(pages) 12.9 { 12.10 } 12.11
13.1 --- a/libfsserver/lib/files/opener_resource.cc Mon Sep 27 01:16:49 2021 +0200 13.2 +++ b/libfsserver/lib/files/opener_resource.cc Mon Sep 27 01:30:05 2021 +0200 13.3 @@ -25,8 +25,8 @@ 13.4 13.5 /* Support for providing access to files. */ 13.6 13.7 -OpenerResource::OpenerResource(FilePaging *paging) 13.8 -: _paging(paging) 13.9 +OpenerResource::OpenerResource(FileObjectRegistry *registry) 13.10 +: _registry(registry) 13.11 { 13.12 } 13.13 13.14 @@ -79,7 +79,7 @@ 13.15 object_flags_t *object_flags) 13.16 { 13.17 Resource *directory; 13.18 - long err = _paging->get_directory(this, path, flags, fileid, &directory); 13.19 + long err = _registry->get_directory(this, path, flags, fileid, &directory); 13.20 13.21 if (err) 13.22 return err; 13.23 @@ -99,7 +99,7 @@ 13.24 object_flags_t *object_flags) 13.25 { 13.26 Pager *pager; 13.27 - long err = _paging->get_pager(this, path, flags, fileid, &pager); 13.28 + long err = _registry->get_pager(this, path, flags, fileid, &pager); 13.29 13.30 if (err) 13.31 return err;
14.1 --- a/libfsserver/lib/files/test_file_opener.cc Mon Sep 27 01:16:49 2021 +0200 14.2 +++ b/libfsserver/lib/files/test_file_opener.cc Mon Sep 27 01:30:05 2021 +0200 14.3 @@ -26,8 +26,8 @@ 14.4 14.5 /* Support for providing access to files. */ 14.6 14.7 -TestFileOpener::TestFileOpener(FilePaging *paging, offset_t file_size) 14.8 -: OpenerResource(paging), _file_size(file_size) 14.9 +TestFileOpener::TestFileOpener(FileObjectRegistry *registry, offset_t file_size) 14.10 +: OpenerResource(registry), _file_size(file_size) 14.11 { 14.12 } 14.13
15.1 --- a/servers/block_file_server.cc Mon Sep 27 01:16:49 2021 +0200 15.2 +++ b/servers/block_file_server.cc Mon Sep 27 01:30:05 2021 +0200 15.3 @@ -66,8 +66,8 @@ 15.4 MemoryIncremental mem(memory_pages); 15.5 PageQueueShared queue; 15.6 Pages pages(&mem, &queue); 15.7 - FilePaging paging(&pages); 15.8 - BlockFileOpener opener(&paging); 15.9 + FileObjectRegistry registry(&pages); 15.10 + BlockFileOpener opener(®istry); 15.11 15.12 /* Register a server associating it with the given object. */ 15.13
16.1 --- a/servers/client_file_server.cc Mon Sep 27 01:16:49 2021 +0200 16.2 +++ b/servers/client_file_server.cc Mon Sep 27 01:30:05 2021 +0200 16.3 @@ -67,8 +67,8 @@ 16.4 MemoryIncremental mem(memory_pages); 16.5 PageQueueShared queue; 16.6 Pages pages(&mem, &queue); 16.7 - FilePaging paging(&pages); 16.8 - ClientFileOpener opener(&paging); 16.9 + FileObjectRegistry registry(&pages); 16.10 + ClientFileOpener opener(®istry); 16.11 16.12 /* Register a server associating it with the given object. */ 16.13
17.1 --- a/servers/ext2_file_server.cc Mon Sep 27 01:16:49 2021 +0200 17.2 +++ b/servers/ext2_file_server.cc Mon Sep 27 01:30:05 2021 +0200 17.3 @@ -94,7 +94,6 @@ 17.4 MemoryIncremental mem(memory_pages); 17.5 PageQueueShared queue; 17.6 Pages pages(&mem, &queue); 17.7 - FilePaging paging(&pages); 17.8 Ext2Filesystem filesystem(&pages, fs); 17.9 17.10 /* Register a server associating it with the given object. */
18.1 --- a/servers/host_file_server.cc Mon Sep 27 01:16:49 2021 +0200 18.2 +++ b/servers/host_file_server.cc Mon Sep 27 01:30:05 2021 +0200 18.3 @@ -66,8 +66,8 @@ 18.4 MemoryIncremental mem(memory_pages); 18.5 PageQueueShared queue; 18.6 Pages pages(&mem, &queue); 18.7 - FilePaging paging(&pages); 18.8 - HostFileOpener opener(&paging); 18.9 + FileObjectRegistry registry(&pages); 18.10 + HostFileOpener opener(®istry); 18.11 18.12 /* Register a server associating it with the given object. */ 18.13
19.1 --- a/servers/test_file_server.cc Mon Sep 27 01:16:49 2021 +0200 19.2 +++ b/servers/test_file_server.cc Mon Sep 27 01:30:05 2021 +0200 19.3 @@ -65,8 +65,8 @@ 19.4 MemoryIncremental mem(memory_pages, page(REGION_PAGES)); 19.5 PageQueueShared queue; 19.6 Pages pages(&mem, &queue); 19.7 - FilePaging paging(&pages); 19.8 - TestFileOpener opener(&paging, page(FILE_PAGES)); 19.9 + FileObjectRegistry registry(&pages); 19.10 + TestFileOpener opener(®istry, page(FILE_PAGES)); 19.11 19.12 /* Register a server associating it with the given object. */ 19.13