paul@93 | 1 | /* |
paul@93 | 2 | * A resource offering support for creating contexts and opening files. |
paul@93 | 3 | * |
paul@93 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@93 | 5 | * |
paul@93 | 6 | * This program is free software; you can redistribute it and/or |
paul@93 | 7 | * modify it under the terms of the GNU General Public License as |
paul@93 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@93 | 9 | * the License, or (at your option) any later version. |
paul@93 | 10 | * |
paul@93 | 11 | * This program is distributed in the hope that it will be useful, |
paul@93 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@93 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@93 | 14 | * GNU General Public License for more details. |
paul@93 | 15 | * |
paul@93 | 16 | * You should have received a copy of the GNU General Public License |
paul@93 | 17 | * along with this program; if not, write to the Free Software |
paul@93 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@93 | 19 | * Boston, MA 02110-1301, USA |
paul@93 | 20 | */ |
paul@93 | 21 | |
paul@9 | 22 | #pragma once |
paul@9 | 23 | |
paul@10 | 24 | #include <l4/sys/ipc.h> |
paul@10 | 25 | |
paul@94 | 26 | #include <fsserver/file_paging.h> |
paul@94 | 27 | #include <fsserver/opener_context_resource.h> |
paul@94 | 28 | #include <fsserver/opener_interface.h> |
paul@94 | 29 | #include <fsserver/pages.h> |
paul@94 | 30 | #include <fsserver/resource.h> |
paul@9 | 31 | |
paul@93 | 32 | |
paul@93 | 33 | |
paul@9 | 34 | /* Support for providing access to files. */ |
paul@9 | 35 | |
paul@81 | 36 | class OpenerResource : public Resource, public FilePaging, public Opener |
paul@9 | 37 | { |
paul@9 | 38 | public: |
paul@79 | 39 | explicit OpenerResource(Pages *pages); |
paul@10 | 40 | |
paul@10 | 41 | /* Server details. */ |
paul@10 | 42 | |
paul@10 | 43 | int expected_items(); |
paul@9 | 44 | |
paul@10 | 45 | ipc_server_handler_type handler(); |
paul@10 | 46 | |
paul@10 | 47 | void *interface() |
paul@10 | 48 | { return static_cast<Opener *>(this); } |
paul@10 | 49 | |
paul@10 | 50 | /* Direct access methods. */ |
paul@9 | 51 | |
paul@79 | 52 | Pager *open(const char *path, flags_t flags); |
paul@10 | 53 | |
paul@10 | 54 | /* Opener interface methods. */ |
paul@10 | 55 | |
paul@10 | 56 | long context(l4_cap_idx_t *context); |
paul@9 | 57 | }; |
paul@9 | 58 | |
paul@9 | 59 | // vim: tabstop=4 expandtab shiftwidth=4 |