paul@102 | 1 | /* |
paul@106 | 2 | * An opener for a file provided by an Ext2-compatible filesystem. |
paul@102 | 3 | * |
paul@102 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@102 | 5 | * |
paul@102 | 6 | * This program is free software; you can redistribute it and/or |
paul@102 | 7 | * modify it under the terms of the GNU General Public License as |
paul@102 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@102 | 9 | * the License, or (at your option) any later version. |
paul@102 | 10 | * |
paul@102 | 11 | * This program is distributed in the hope that it will be useful, |
paul@102 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@102 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@102 | 14 | * GNU General Public License for more details. |
paul@102 | 15 | * |
paul@102 | 16 | * You should have received a copy of the GNU General Public License |
paul@102 | 17 | * along with this program; if not, write to the Free Software |
paul@102 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@102 | 19 | * Boston, MA 02110-1301, USA |
paul@102 | 20 | */ |
paul@102 | 21 | |
paul@102 | 22 | #pragma once |
paul@102 | 23 | |
paul@106 | 24 | #include <ext2fs/ext2fs.h> |
paul@106 | 25 | |
paul@148 | 26 | #include <fsserver/ext2_file_operations.h> |
paul@106 | 27 | #include <fsserver/opener_resource.h> |
paul@144 | 28 | #include <systypes/user.h> |
paul@102 | 29 | |
paul@102 | 30 | |
paul@102 | 31 | |
paul@102 | 32 | /* Support for providing access to files. */ |
paul@102 | 33 | |
paul@106 | 34 | class Ext2FileOpener : public OpenerResource |
paul@102 | 35 | { |
paul@102 | 36 | protected: |
paul@148 | 37 | Ext2FileOperations *_ops; |
paul@145 | 38 | user_t _user; |
paul@144 | 39 | |
paul@144 | 40 | public: |
paul@148 | 41 | explicit Ext2FileOpener(FilePaging *paging, Ext2FileOperations *ops, user_t user) |
paul@148 | 42 | : OpenerResource(paging), _ops(ops), _user(user) |
paul@144 | 43 | { |
paul@144 | 44 | } |
paul@102 | 45 | |
paul@102 | 46 | /* Configurable methods. */ |
paul@102 | 47 | |
paul@146 | 48 | virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid); |
paul@102 | 49 | |
paul@143 | 50 | virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, Accessor **accessor); |
paul@102 | 51 | }; |
paul@102 | 52 | |
paul@102 | 53 | // vim: tabstop=4 expandtab shiftwidth=4 |