L4Re/departure

Annotated libfsserver/include/fsserver/opener_resource.h

236:b769dcb3f4b3
2022-01-27 Paul Boddie Added initial support for renaming filesystem objects.
paul@93 1
/*
paul@93 2
 * A resource offering support for creating contexts and opening files.
paul@93 3
 *
paul@236 4
 * Copyright (C) 2021, 2022 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@144 24
#include <fsserver/file_opening.h>
paul@94 25
#include <fsserver/opener_context_resource.h>
paul@94 26
#include <fsserver/opener_interface.h>
paul@94 27
#include <fsserver/resource.h>
paul@224 28
#include <fsserver/resource_registry.h>
paul@9 29
paul@93 30
paul@93 31
paul@9 32
/* Support for providing access to files. */
paul@9 33
paul@144 34
class OpenerResource : public Resource, public FileOpening, public Opener
paul@9 35
{
paul@144 36
protected:
paul@224 37
    ResourceRegistry *_registry;
paul@144 38
paul@211 39
    /* Notification methods. */
paul@211 40
paul@211 41
    virtual long notify_parent(const char *path);
paul@211 42
paul@9 43
public:
paul@224 44
    explicit OpenerResource(ResourceRegistry *registry);
paul@10 45
paul@156 46
    virtual ~OpenerResource();
paul@156 47
paul@10 48
    /* Server details. */
paul@10 49
paul@10 50
    int expected_items();
paul@9 51
paul@10 52
    ipc_server_handler_type handler();
paul@10 53
paul@10 54
    void *interface()
paul@10 55
    { return static_cast<Opener *>(this); }
paul@10 56
paul@10 57
    /* Direct access methods. */
paul@9 58
paul@171 59
    long open(const char *path, flags_t flags, offset_t *size,
paul@171 60
              l4_cap_idx_t *cap, object_flags_t *object_flags);
paul@10 61
paul@232 62
    long remove(const char *path);
paul@232 63
paul@236 64
    long rename(const char *source, const char *target);
paul@236 65
paul@10 66
    /* Opener interface methods. */
paul@10 67
paul@10 68
    long context(l4_cap_idx_t *context);
paul@9 69
};
paul@9 70
paul@9 71
// vim: tabstop=4 expandtab shiftwidth=4