L4Re/departure

Annotated libfsserver/include/fsserver/directory_resource.h

548:2dd97d71e627
19 months ago Paul Boddie Removed the indicated notifier from unsubscribe operations since it cannot be trivially compared to any subscribed notifier. Thus, only a single notifier can be used with any given file, pipe, directory or process endpoint.
paul@202 1
/*
paul@202 2
 * A resource offering support for directory operations.
paul@202 3
 *
paul@485 4
 * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
paul@202 5
 *
paul@202 6
 * This program is free software; you can redistribute it and/or
paul@202 7
 * modify it under the terms of the GNU General Public License as
paul@202 8
 * published by the Free Software Foundation; either version 2 of
paul@202 9
 * the License, or (at your option) any later version.
paul@202 10
 *
paul@202 11
 * This program is distributed in the hope that it will be useful,
paul@202 12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paul@202 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
paul@202 14
 * GNU General Public License for more details.
paul@202 15
 *
paul@202 16
 * You should have received a copy of the GNU General Public License
paul@202 17
 * along with this program; if not, write to the Free Software
paul@202 18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
paul@202 19
 * Boston, MA  02110-1301, USA
paul@202 20
 */
paul@202 21
paul@202 22
#pragma once
paul@202 23
paul@202 24
#include <fsserver/directory_object_interface.h>
paul@202 25
#include <fsserver/directory_provider.h>
paul@535 26
#include <resource/resource.h>
paul@202 27
paul@202 28
paul@202 29
paul@207 30
/* Support for providing access to directories. */
paul@202 31
paul@202 32
class DirectoryResource : public Resource, public DirectoryObject
paul@202 33
{
paul@202 34
protected:
paul@202 35
    DirectoryProvider *_provider;
paul@202 36
paul@207 37
    /* Notification endpoint for event subscription. */
paul@207 38
paul@485 39
    l4_cap_idx_t _notifier;
paul@207 40
paul@202 41
public:
paul@202 42
    fileid_t fileid;
paul@202 43
paul@222 44
    DirectoryResource(fileid_t fileid, DirectoryProvider *provider);
paul@202 45
paul@202 46
    virtual ~DirectoryResource();
paul@202 47
paul@202 48
    virtual void close();
paul@202 49
paul@202 50
    /* Server details. */
paul@202 51
paul@459 52
    ipc_server_default_config_type config();
paul@202 53
paul@202 54
    void *interface()
paul@202 55
    { return static_cast<DirectoryObject *>(this); }
paul@202 56
paul@202 57
    /* Directory reading methods. */
paul@202 58
paul@202 59
    virtual long opendir(offset_t *size, l4_cap_idx_t *cap,
paul@202 60
                         object_flags_t *object_flags);
paul@207 61
paul@207 62
    /* Notification methods. */
paul@207 63
paul@290 64
    virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags);
paul@290 65
paul@548 66
    virtual long unsubscribe();
paul@202 67
};
paul@202 68
paul@202 69
// vim: tabstop=4 expandtab shiftwidth=4