From e02ebdd45f5b66f917bb5dfa92605eab7b02044d Mon Sep 17 00:00:00 2001 From: edef Date: Tue, 12 Apr 2022 20:20:42 +0000 Subject: ripple/fossil/mount: support symlinks Change-Id: Ic6cbb1dcee766e30140a1b027d6a80f5768865f5 --- ripple/fossil/src/bin/mount.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ripple/fossil/src/bin/mount.rs b/ripple/fossil/src/bin/mount.rs index 8b03104..75698a5 100644 --- a/ripple/fossil/src/bin/mount.rs +++ b/ripple/fossil/src/bin/mount.rs @@ -149,7 +149,9 @@ impl fuser::Filesystem for Filesystem { memtree::Node::File(f) => { attr = file_attr(ino, Kind::File, f.size as u64); } - memtree::Node::Link { target } => todo!(), + memtree::Node::Link { target } => { + attr = file_attr(ino, Kind::Link, target.len() as u64); + } } reply.entry(&Duration::ZERO, &attr, 0); } @@ -168,7 +170,9 @@ impl fuser::Filesystem for Filesystem { memtree::Node::File(f) => { attr = file_attr(ino, Kind::File, f.size as u64); } - memtree::Node::Link { target } => todo!(), + memtree::Node::Link { target } => { + attr = file_attr(ino, Kind::Link, target.len() as u64); + } } reply.attr(&Duration::ZERO, &attr); } else { @@ -198,8 +202,11 @@ impl fuser::Filesystem for Filesystem { } fn readlink(&mut self, _req: &fuser::Request<'_>, ino: u64, reply: fuser::ReplyData) { - debug!("[Not Implemented] readlink(ino: {:#x?})", ino); - reply.error(ENOSYS); + match self.find(ino) { + Some(memtree::Node::Link { target }) => reply.data(target.as_bytes()), + Some(_) => reply.error(EINVAL), + None => reply.error(ENOENT), + } } fn mknod( -- cgit 1.4.1