mirror of
git://git.proxmox.com/git/pxar.git
synced 2024-12-22 21:33:50 +03:00
accessor: expose lookup_self
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
6b9e2478e5
commit
a5922fbcdc
@ -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(),
|
||||
|
@ -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()))? {
|
||||
|
Loading…
Reference in New Issue
Block a user