paul@144 | 1 | /* |
paul@144 | 2 | * Generic support for opening files. |
paul@144 | 3 | * |
paul@236 | 4 | * Copyright (C) 2021, 2022 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@144 | 24 | #include <fsserver/accessor.h> |
paul@202 | 25 | #include <fsserver/directory_accessor.h> |
paul@144 | 26 | |
paul@144 | 27 | |
paul@144 | 28 | |
paul@144 | 29 | /* An interface offering file opening support. */ |
paul@144 | 30 | |
paul@144 | 31 | class FileOpening |
paul@144 | 32 | { |
paul@144 | 33 | public: |
paul@218 | 34 | virtual bool accessing_directory(const char *path, flags_t flags, fileid_t fileid) = 0; |
paul@218 | 35 | |
paul@218 | 36 | virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid) = 0; |
paul@218 | 37 | |
paul@146 | 38 | virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid) = 0; |
paul@144 | 39 | |
paul@236 | 40 | virtual long get_parent(const char *path, fileid_t *fileid); |
paul@236 | 41 | |
paul@202 | 42 | virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid, |
paul@202 | 43 | Accessor **accessor) = 0; |
paul@202 | 44 | |
paul@202 | 45 | virtual long make_directory_accessor(const char *path, flags_t flags, |
paul@202 | 46 | fileid_t fileid, |
paul@202 | 47 | DirectoryAccessor **accessor) = 0; |
paul@232 | 48 | |
paul@232 | 49 | virtual long remove_object(const char *path, fileid_t fileid) = 0; |
paul@232 | 50 | |
paul@236 | 51 | virtual long rename_object(const char *source, fileid_t source_fileid, |
paul@236 | 52 | const char *target) = 0; |
paul@236 | 53 | |
paul@232 | 54 | virtual long unlink_object(const char *path, fileid_t fileid) = 0; |
paul@144 | 55 | }; |
paul@144 | 56 | |
paul@144 | 57 | // vim: tabstop=4 expandtab shiftwidth=4 |