1 /* 2 * A registry of filesystem objects. 3 * 4 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #include <fsserver/directory_provider.h> 25 #include <fsserver/file_opening.h> 26 #include <fsserver/file_provider.h> 27 #include <fsserver/file_registry.h> 28 #include <fsserver/pager.h> 29 #include <fsserver/pages.h> 30 31 32 33 /* A registry of filesystem objects. */ 34 35 class FilePaging : public FileRegistry 36 { 37 protected: 38 Pages *_pages; 39 40 /* Resource initialisation methods. */ 41 42 map_flags_t get_flags(flags_t flags); 43 44 long get_directory_provider(FileOpening *opening, const char *path, 45 flags_t flags, fileid_t fileid, 46 DirectoryProvider **directory_provider); 47 48 long get_file_provider(FileOpening *opening, const char *path, 49 flags_t flags, fileid_t fileid, 50 FileProvider **file_provider); 51 52 public: 53 explicit FilePaging(Pages *pages); 54 55 /* Resource discovery methods. */ 56 57 long find_directory_provider(fileid_t fileid, 58 DirectoryProvider **directory_provider); 59 60 /* Resource initialisation methods. */ 61 62 long get_directory(FileOpening *opening, const char *path, flags_t flags, 63 fileid_t fileid, Resource **resource); 64 65 long get_pager(FileOpening *opening, const char *path, flags_t flags, 66 fileid_t fileid, Pager **pager); 67 }; 68 69 // vim: tabstop=4 expandtab shiftwidth=4