summary refs log tree commit diff
path: root/ripple/fossil/src
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-04-12 20:20:42 +0000
committeredef <edef@unfathomable.blue>2022-04-12 20:20:42 +0000
commite02ebdd45f5b66f917bb5dfa92605eab7b02044d (patch)
treecf22a6cc6da1c3ce1432c959e62ba0be25166b00 /ripple/fossil/src
parent96335da678fbb592cbaf2091e5e4f754c40ae708 (diff)
downloadunf-legacy-e02ebdd45f5b66f917bb5dfa92605eab7b02044d.tar.zst
ripple/fossil/mount: support symlinks
Change-Id: Ic6cbb1dcee766e30140a1b027d6a80f5768865f5
Diffstat (limited to 'ripple/fossil/src')
-rw-r--r--ripple/fossil/src/bin/mount.rs15
1 files 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(