--- a/src/simple.c Fri Sep 26 21:20:48 2008 +0300
+++ b/src/simple.c Sat Sep 27 00:20:47 2008 +0300
@@ -112,6 +112,34 @@
EWARNING(err, "fuse_reply_err");
}
+static void simple_readlink (fuse_req_t req, fuse_ino_t ino) {
+ struct simple_fs *fs = fuse_req_userdata(req);
+ const struct simple_node *node;
+ int err;
+
+ INFO("[simple.readlink %p] ino=%lu", fs, ino);
+
+ // look up the node
+ if ((node = _simple_get_ino(fs, ino)) == NULL)
+ EERROR(err = EINVAL, "bad inode");
+
+ // check that it's a symlink
+ if (node->mode_type != S_IFLNK)
+ EERROR(err = EINVAL, "bad mode");
+
+ // return the contents
+ if ((err = fuse_reply_readlink(req, node->data)))
+ EERROR(err, "fuse_reply_readlink");
+
+ // suceccss
+ return;
+
+error:
+ if ((err = fuse_reply_err(req, err)))
+ EWARNING(err, "fuse_reply_err");
+
+}
+
static void simple_readdir (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi) {
struct simple_fs *fs = fuse_req_userdata(req);
const struct simple_node *dir_node, *node;
@@ -214,6 +242,8 @@
.getattr = simple_getattr,
+ .readlink = simple_readlink,
+
.readdir = simple_readdir,
.read = simple_read,