L4Re/departure

Annotated libfsserver/include/fsserver/ext2_file_opener.h

224:4fb242f7d360
2021-10-18 Paul Boddie Renamed the registry classes to be more descriptive.
paul@102 1
/*
paul@106 2
 * An opener for a file provided by an Ext2-compatible filesystem.
paul@102 3
 *
paul@102 4
 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
paul@102 5
 *
paul@102 6
 * This program is free software; you can redistribute it and/or
paul@102 7
 * modify it under the terms of the GNU General Public License as
paul@102 8
 * published by the Free Software Foundation; either version 2 of
paul@102 9
 * the License, or (at your option) any later version.
paul@102 10
 *
paul@102 11
 * This program is distributed in the hope that it will be useful,
paul@102 12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paul@102 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
paul@102 14
 * GNU General Public License for more details.
paul@102 15
 *
paul@102 16
 * You should have received a copy of the GNU General Public License
paul@102 17
 * along with this program; if not, write to the Free Software
paul@102 18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
paul@102 19
 * Boston, MA  02110-1301, USA
paul@102 20
 */
paul@102 21
paul@102 22
#pragma once
paul@102 23
paul@106 24
#include <ext2fs/ext2fs.h>
paul@106 25
paul@168 26
#include <fsclient/file.h>
paul@148 27
#include <fsserver/ext2_file_operations.h>
paul@106 28
#include <fsserver/opener_resource.h>
paul@144 29
#include <systypes/user.h>
paul@102 30
paul@102 31
paul@102 32
paul@102 33
/* Support for providing access to files. */
paul@102 34
paul@106 35
class Ext2FileOpener : public OpenerResource
paul@102 36
{
paul@102 37
protected:
paul@148 38
    Ext2FileOperations *_ops;
paul@145 39
    user_t _user;
paul@144 40
paul@156 41
    /* Convenience methods determining different object types. */
paul@156 42
paul@156 43
    virtual bool accessing_directory(const char *path, flags_t flags, fileid_t fileid);
paul@156 44
paul@156 45
    virtual bool accessing_file(const char *path, flags_t flags, fileid_t fileid);
paul@156 46
paul@144 47
public:
paul@224 48
    explicit Ext2FileOpener(ResourceRegistry *registry, Ext2FileOperations *ops, user_t user)
paul@209 49
    : OpenerResource(registry), _ops(ops), _user(user)
paul@144 50
    {
paul@144 51
    }
paul@102 52
paul@156 53
    virtual ~Ext2FileOpener();
paul@156 54
paul@202 55
    /* File opening methods. */
paul@102 56
paul@146 57
    virtual long get_fileid(const char *path, flags_t flags, fileid_t *fileid);
paul@102 58
paul@202 59
    virtual long make_accessor(const char *path, flags_t flags, fileid_t fileid,
paul@202 60
                               Accessor **accessor);
paul@168 61
paul@202 62
    virtual long make_directory_accessor(const char *path, flags_t flags,
paul@202 63
                                         fileid_t fileid,
paul@202 64
                                         DirectoryAccessor **accessor);
paul@102 65
};
paul@102 66
paul@102 67
// vim: tabstop=4 expandtab shiftwidth=4