[Tux3] [PATCH 2/2] Implementing listattr for fuse: implementation of tux3_listxattr

Jonas Fietz info at jonasfietz.de
Mon Dec 1 11:18:53 PST 2008


Hi,

second part of my patch. As the note says, this is untested for multiple
xattrs.
Hirofumi and I just noticed another problem with the xattrs, so the last
patch may be faulty. So please don't apply that yet as further research
is needed.

# HG changeset patch
# User Jonas Fietz <data at geekig.de>
# Date 1228158752 -3600
# Node ID 746bbab5b39fc4755c316b368494e4031a67cecd
# Parent  41fb4940acadb1cfd095bfeb68ea625b428dc1d6
Implementation  of tux3_listxattr.
Quite simple, as it only has to patch through to xattr_list. This is still
untested for multiple xattrs as there are further problems with those

diff -r 41fb4940acad -r 746bbab5b39f user/tux3fuse.c
--- a/user/tux3fuse.c	Mon Dec 01 19:41:33 2008 +0100
+++ b/user/tux3fuse.c	Mon Dec 01 20:12:32 2008 +0100
@@ -613,8 +613,25 @@

 static void tux3_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
 {
-	warn("not implemented");
-	fuse_reply_err(req, ENOSYS);
+	fprintf(stderr, "tux3_listxattr(%Lx, size:%u)\n", (L)ino, (unsigned
int)size);
+	
+	struct inode *inode = open_fuse_ino(ino);
+	if(!inode) {
+		fuse_reply_err(req,ENOENT);
+		return;
+	}
+
+	char *buf = malloc(size);
+	if (!buf) {
+		fuse_reply_err(req, ENOMEM);
+		return;
+	}
+
+	int len = xattr_list(inode, buf, size);
+	fprintf(stderr, "listxattr-buffer:%s\n", buf);
+	fuse_reply_buf(req, buf, len);
+	free(buf);
+	return;
 }

 static void tux3_removexattr(fuse_req_t req, fuse_ino_t ino, const char
*name)

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list