]> git.proxmox.com Git - pxar.git/commitdiff
accessor: expose lookup_self
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 6 May 2020 07:41:01 +0000 (09:41 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 13 May 2020 10:34:03 +0000 (12:34 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/accessor.rs
src/accessor/sync.rs

index ec0385cd8afc8b0d7e4d5fe38daf74be31846df5..0196e6a656b7e74bd909f241764cbbcf2f9ac7e9 100644 (file)
@@ -375,7 +375,7 @@ impl<T: Clone + ReadAt> DirectoryImpl<T> {
         binary_tree_array::search_by(&self.table, start, skip, |i| hash.cmp(&i.hash))
     }
 
-    async fn lookup_self(&self) -> io::Result<FileEntryImpl<T>> {
+    pub async fn lookup_self(&self) -> io::Result<FileEntryImpl<T>> {
         let (entry, _decoder) = self.decode_one_entry(self.entry_range(), None).await?;
         Ok(FileEntryImpl {
             input: self.input.clone(),
index 623660fe0503f3f204dff3c650c2886e8c545b88..684e4d0015ef28a8d312fd0d5fe30d8c93106bad 100644 (file)
@@ -190,6 +190,15 @@ impl<T: Clone + ReadAt> Directory<T> {
         )?))
     }
 
+    /// Get a `FileEntry` referencing the directory itself.
+    ///
+    /// Helper function for our fuse implementation.
+    pub fn lookup_self(&self) -> io::Result<FileEntry<T>> {
+        Ok(FileEntry {
+            inner: poll_result_once(self.inner.lookup_self())?,
+        })
+    }
+
     /// Lookup an entry in a directory.
     pub fn lookup<P: AsRef<Path>>(&self, path: P) -> io::Result<Option<FileEntry<T>>> {
         if let Some(file_entry) = poll_result_once(self.inner.lookup(path.as_ref()))? {