paul@196 | 1 | /* |
paul@196 | 2 | * A resource offering support for directory operations. |
paul@196 | 3 | * |
paul@196 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@196 | 5 | * |
paul@196 | 6 | * This program is free software; you can redistribute it and/or |
paul@196 | 7 | * modify it under the terms of the GNU General Public License as |
paul@196 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@196 | 9 | * the License, or (at your option) any later version. |
paul@196 | 10 | * |
paul@196 | 11 | * This program is distributed in the hope that it will be useful, |
paul@196 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@196 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@196 | 14 | * GNU General Public License for more details. |
paul@196 | 15 | * |
paul@196 | 16 | * You should have received a copy of the GNU General Public License |
paul@196 | 17 | * along with this program; if not, write to the Free Software |
paul@196 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@196 | 19 | * Boston, MA 02110-1301, USA |
paul@196 | 20 | */ |
paul@196 | 21 | |
paul@196 | 22 | #pragma once |
paul@196 | 23 | |
paul@196 | 24 | #include <fsserver/directory_object_interface.h> |
paul@196 | 25 | #include <fsserver/resource.h> |
paul@196 | 26 | |
paul@196 | 27 | |
paul@196 | 28 | |
paul@196 | 29 | /* Support for providing access to directories. |
paul@196 | 30 | NOTE: Notification methods to be added when DirectoryObject is extended. */ |
paul@196 | 31 | |
paul@196 | 32 | class DirectoryResource : public Resource, public DirectoryObject |
paul@196 | 33 | { |
paul@196 | 34 | protected: |
paul@196 | 35 | /* Methods requiring customisation. */ |
paul@196 | 36 | |
paul@196 | 37 | virtual long _opendir(flags_t flags, offset_t *size, l4_cap_idx_t *cap, |
paul@196 | 38 | object_flags_t *object_flags) = 0; |
paul@196 | 39 | |
paul@196 | 40 | public: |
paul@196 | 41 | virtual ~DirectoryResource(); |
paul@196 | 42 | |
paul@196 | 43 | /* Server details. */ |
paul@196 | 44 | |
paul@196 | 45 | int expected_items(); |
paul@196 | 46 | |
paul@196 | 47 | ipc_server_handler_type handler(); |
paul@196 | 48 | |
paul@196 | 49 | void *interface() |
paul@196 | 50 | { return static_cast<DirectoryObject *>(this); } |
paul@196 | 51 | |
paul@196 | 52 | /* Directory reading methods. */ |
paul@196 | 53 | |
paul@196 | 54 | virtual long opendir(flags_t flags, offset_t *size, l4_cap_idx_t *cap, |
paul@196 | 55 | object_flags_t *object_flags); |
paul@196 | 56 | }; |
paul@196 | 57 | |
paul@196 | 58 | // vim: tabstop=4 expandtab shiftwidth=4 |