paul@144 | 1 | /* |
paul@144 | 2 | * A resource supporting the creation of user-specific opener resources. |
paul@144 | 3 | * |
paul@144 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@144 | 5 | * |
paul@144 | 6 | * This program is free software; you can redistribute it and/or |
paul@144 | 7 | * modify it under the terms of the GNU General Public License as |
paul@144 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@144 | 9 | * the License, or (at your option) any later version. |
paul@144 | 10 | * |
paul@144 | 11 | * This program is distributed in the hope that it will be useful, |
paul@144 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@144 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@144 | 14 | * GNU General Public License for more details. |
paul@144 | 15 | * |
paul@144 | 16 | * You should have received a copy of the GNU General Public License |
paul@144 | 17 | * along with this program; if not, write to the Free Software |
paul@144 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@144 | 19 | * Boston, MA 02110-1301, USA |
paul@144 | 20 | */ |
paul@144 | 21 | |
paul@144 | 22 | #pragma once |
paul@144 | 23 | |
paul@209 | 24 | #include <fsserver/file_object_registry.h> |
paul@150 | 25 | #include <fsserver/filesystem_object_interface.h> |
paul@144 | 26 | #include <fsserver/resource.h> |
paul@144 | 27 | |
paul@144 | 28 | |
paul@144 | 29 | |
paul@144 | 30 | /* Support for providing access to user-specific filesystems. */ |
paul@144 | 31 | |
paul@209 | 32 | class FilesystemResource : public Resource, public FileObjectRegistry, |
paul@150 | 33 | public FilesystemObject |
paul@144 | 34 | { |
paul@144 | 35 | public: |
paul@200 | 36 | explicit FilesystemResource(Pages *pages); |
paul@144 | 37 | |
paul@144 | 38 | /* Server details. */ |
paul@144 | 39 | |
paul@144 | 40 | int expected_items(); |
paul@144 | 41 | |
paul@144 | 42 | ipc_server_handler_type handler(); |
paul@144 | 43 | |
paul@144 | 44 | void *interface() |
paul@144 | 45 | { return static_cast<Filesystem *>(this); } |
paul@144 | 46 | |
paul@144 | 47 | /* Filesystem interface methods. */ |
paul@144 | 48 | |
paul@150 | 49 | virtual long open_for_user(ipc_varg_sys_uid_t uid, ipc_varg_sys_gid_t gid, |
paul@150 | 50 | ipc_varg_sys_mode_t umask, l4_cap_idx_t *opener) = 0; |
paul@150 | 51 | |
paul@150 | 52 | virtual long open_for_user(user_t user, l4_cap_idx_t *opener) = 0; |
paul@144 | 53 | }; |
paul@144 | 54 | |
paul@144 | 55 | // vim: tabstop=4 expandtab shiftwidth=4 |