L4Re/departure

Annotated libfsserver/include/fsserver/file_object_registry.h

221:5800bd1b5ca5
2021-10-17 Paul Boddie Moved resource instantiation to provider methods.
paul@93 1
/*
paul@200 2
 * A registry of filesystem objects.
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@202 24
#include <fsserver/directory_provider.h>
paul@144 25
#include <fsserver/file_opening.h>
paul@200 26
#include <fsserver/file_provider.h>
paul@202 27
#include <fsserver/file_registry.h>
paul@94 28
#include <fsserver/pager.h>
paul@144 29
#include <fsserver/pages.h>
paul@9 30
paul@9 31
paul@9 32
paul@200 33
/* A registry of filesystem objects. */
paul@9 34
paul@209 35
class FileObjectRegistry : public FileRegistry
paul@9 36
{
paul@9 37
protected:
paul@79 38
    Pages *_pages;
paul@9 39
paul@144 40
    map_flags_t get_flags(flags_t flags);
paul@144 41
paul@220 42
    /* Provider initialisation methods. */
paul@220 43
paul@220 44
    long make_directory_provider(FileOpening *opening, const char *path,
paul@220 45
                                 flags_t flags, fileid_t fileid,
paul@220 46
                                 Provider **provider);
paul@202 47
paul@220 48
    long make_file_provider(FileOpening *opening, const char *path,
paul@220 49
                            flags_t flags, fileid_t fileid,
paul@220 50
                            Provider **provider);
paul@220 51
paul@220 52
    long make_provider(FileOpening *opening, const char *path,
paul@220 53
                       flags_t flags, fileid_t fileid,
paul@220 54
                       Provider **provider);
paul@193 55
paul@79 56
public:
paul@209 57
    explicit FileObjectRegistry(Pages *pages);
paul@79 58
paul@208 59
    /* Resource discovery methods. */
paul@208 60
paul@220 61
    long find_provider(fileid_t fileid, Provider **provider);
paul@208 62
paul@202 63
    /* Resource initialisation methods. */
paul@144 64
paul@218 65
    long get_resource(FileOpening *opening, const char *path, flags_t flags,
paul@218 66
                      offset_t *size, object_flags_t *object_flags,
paul@218 67
                      Resource **resource);
paul@9 68
};
paul@9 69
paul@9 70
// vim: tabstop=4 expandtab shiftwidth=4