L4Re/departure

Change of libfsserver/lib/files/opener_resource.cc

156:d29545453b6a
libfsserver/lib/files/opener_resource.cc
     1.1 --- a/libfsserver/lib/files/opener_resource.cc	Sun Aug 01 22:48:12 2021 +0200
     1.2 +++ b/libfsserver/lib/files/opener_resource.cc	Mon Aug 02 19:39:10 2021 +0200
     1.3 @@ -30,6 +30,10 @@
     1.4  {
     1.5  }
     1.6  
     1.7 +OpenerResource::~OpenerResource()
     1.8 +{
     1.9 +}
    1.10 +
    1.11  int OpenerResource::expected_items()
    1.12  {
    1.13      return Opener_expected_items;
    1.14 @@ -46,7 +50,39 @@
    1.15  
    1.16  long OpenerResource::open(const char *path, flags_t flags, Pager **pager)
    1.17  {
    1.18 -    return _paging->get_pager(this, path, flags, pager);
    1.19 +    /* Obtain an identifier for the file, even for new files. */
    1.20 +
    1.21 +    fileid_t fileid;
    1.22 +    long err = get_fileid(path, flags, &fileid);
    1.23 +
    1.24 +    if (err)
    1.25 +        return err;
    1.26 +
    1.27 +    /* Test for file and directory access. */
    1.28 +
    1.29 +    if (accessing_directory(path, flags, fileid))
    1.30 +        return get_directory(path, flags, fileid, pager);
    1.31 +    else if (accessing_file(path, flags, fileid))
    1.32 +        return get_file(path, flags, fileid, pager);
    1.33 +    else
    1.34 +        return -L4_EIO;
    1.35 +}
    1.36 +
    1.37 +
    1.38 +
    1.39 +/* Return a directory pager. */
    1.40 +
    1.41 +long OpenerResource::get_directory(const char *path, flags_t flags, fileid_t fileid, Pager **pager)
    1.42 +{
    1.43 +    (void) path; (void) flags; (void) fileid; *pager = NULL;
    1.44 +    return -L4_EIO;
    1.45 +}
    1.46 +
    1.47 +/* Return a file pager. */
    1.48 +
    1.49 +long OpenerResource::get_file(const char *path, flags_t flags, fileid_t fileid, Pager **pager)
    1.50 +{
    1.51 +    return _paging->get_pager(this, path, flags, fileid, pager);
    1.52  }
    1.53  
    1.54