L4Re/departure

Annotated libfsserver/include/fsserver/test_file_opener.h

224:4fb242f7d360
2021-10-18 Paul Boddie Renamed the registry classes to be more descriptive.
paul@93 1
/*
paul@93 2
 * An opener for a test file containing generated content.
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@94 24
#include <fsserver/opener_resource.h>
paul@9 25
paul@93 26
paul@93 27
paul@9 28
/* Support for providing access to files. */
paul@9 29
paul@10 30
class TestFileOpener : public OpenerResource
paul@9 31
{
paul@9 32
protected:
paul@9 33
    offset_t _file_size;
paul@9 34
paul@156 35
    /* Convenience methods determining different object types. */
paul@156 36
paul@156 37
    virtual bool accessing_directory(const char *path, flags_t flags, fileid_t fileid);
paul@156 38
paul@156 39
    virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid);
paul@156 40
paul@144 41
public:
paul@224 42
    explicit TestFileOpener(ResourceRegistry *registry, offset_t file_size=0);
paul@144 43
paul@156 44
    virtual ~TestFileOpener();
paul@156 45
paul@9 46
    /* Configurable methods. */
paul@9 47
paul@146 48
    virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid);
paul@9 49
paul@202 50
    virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid,
paul@202 51
                               Accessor **accessor);
paul@202 52
paul@202 53
    virtual long make_directory_accessor(const char *path, flags_t flags,
paul@202 54
                                         fileid_t fileid,
paul@202 55
                                         DirectoryAccessor **accessor);
paul@9 56
};
paul@9 57
paul@9 58
// vim: tabstop=4 expandtab shiftwidth=4