L4Re/departure

opener_context_resource.h

10:54182479d4bd
2021-02-01 Paul Boddie Made the opener, opener context and file pager resources, introducing the resource server functionality as a wrapper around server configurations. Introduced testing of the opener-related abstractions.
     1 #pragma once     2      3 #include "opener_context_object_interface.h"     4 #include "simple_pager.h"     5      6      7      8 /* Forward declaration. */     9     10 class OpenerResource;    11     12     13     14 /* Support for indicating files to be opened. */    15     16 class OpenerContextResource : public SimplePager, public OpenerContextObject    17 {    18 protected:    19     OpenerResource *_opener;    20     21 public:    22     explicit OpenerContextResource(OpenerResource *opener, Memory *memory=NULL);    23     24     /* Server details. */    25     26     int expected_items();    27     28     ipc_server_handler_type handler();    29     30     void *interface()    31     { return static_cast<OpenerContextObject *>(this); }    32     33     /* Data access methods. */    34     35     char *get_path();    36     37     /* Opener context interface methods. */    38     39     long open(int flags, size_t *size, l4_cap_idx_t *file);    40     41     /* Pager/dataspace methods. */    42     43     long map(unsigned long offset, l4_addr_t hot_spot, unsigned long flags,    44              l4_snd_fpage_t *region)    45     { return SimplePager::map(offset, hot_spot, flags, region); }    46     47     long info(unsigned long *size, unsigned long *flags)    48     { return SimplePager::info(size, flags); }    49 };    50     51 // vim: tabstop=4 expandtab shiftwidth=4