1.1 --- a/libfsserver/lib/files/opener_resource.cc Sat Oct 16 22:09:18 2021 +0200
1.2 +++ b/libfsserver/lib/files/opener_resource.cc Sat Oct 16 22:11:11 2021 +0200
1.3 @@ -109,11 +109,8 @@
1.4 long OpenerResource::open(const char *path, flags_t flags, offset_t *size,
1.5 l4_cap_idx_t *cap, object_flags_t *object_flags)
1.6 {
1.7 - /* Obtain an identifier for the file, even for new files (subject to use of
1.8 - the appropriate flag). */
1.9 -
1.10 - fileid_t fileid;
1.11 - long err = get_fileid(path, flags, &fileid);
1.12 + Resource *resource;
1.13 + long err = _registry->get_resource(this, path, flags, size, object_flags, &resource);
1.14
1.15 if (err)
1.16 return err;
1.17 @@ -122,58 +119,9 @@
1.18
1.19 notify_parent(path);
1.20
1.21 - /* Test for file and directory access. */
1.22 -
1.23 - if (accessing_directory(path, flags, fileid))
1.24 - return get_directory(path, flags, fileid, size, cap, object_flags);
1.25 - else if (accessing_file(path, flags, fileid))
1.26 - return get_file(path, flags, fileid, size, cap, object_flags);
1.27 - else
1.28 - return -L4_EIO;
1.29 -}
1.30 -
1.31 -
1.32 -
1.33 -/* Return a directory object reference for the given file identifier. */
1.34 -
1.35 -long OpenerResource::get_directory(const char *path, flags_t flags,
1.36 - fileid_t fileid, offset_t *size,
1.37 - l4_cap_idx_t *cap,
1.38 - object_flags_t *object_flags)
1.39 -{
1.40 - Resource *directory;
1.41 - long err = _registry->get_directory(this, path, flags, fileid, &directory);
1.42 -
1.43 - if (err)
1.44 - return err;
1.45 + /* Start a server for the resource. */
1.46
1.47 - /* Provide non-file values for certain outputs. */
1.48 -
1.49 - *size = 0;
1.50 - *object_flags = 0;
1.51 -
1.52 - return ResourceServer(directory).start_thread(cap);
1.53 -}
1.54 -
1.55 -/* Return a file pager. */
1.56 -
1.57 -long OpenerResource::get_file(const char *path, flags_t flags, fileid_t fileid,
1.58 - offset_t *size, l4_cap_idx_t *cap,
1.59 - object_flags_t *object_flags)
1.60 -{
1.61 - Pager *pager;
1.62 - long err = _registry->get_pager(this, path, flags, fileid, &pager);
1.63 -
1.64 - if (err)
1.65 - return err;
1.66 -
1.67 - /* Obtain the size details from the pager, also providing appropriate
1.68 - flags. */
1.69 -
1.70 - *size = pager->get_data_size();
1.71 - *object_flags = OBJECT_SUPPORTS_MMAP | OBJECT_HAS_SIZE;
1.72 -
1.73 - return ResourceServer(pager).start_thread(cap);
1.74 + return ResourceServer(resource).start_thread(cap);
1.75 }
1.76
1.77