On Wed, Jun 29, 2011 at 04:55:30AM +0200, Emmanuel Dreyfus wrote: > perhaps this is just a bug, since the documentation does not tell about > this prepended one byte length. The funny thing is that glusterfs has a > code section for FreeBSD that uses extattr_list_link(), but it assumes > the behavior from the documentation and is therefore broken with the > original extattr_list_link() implementation.
I checked FreeBSD status on this. The original documentation we imported from them describe extattr_list_file() returning data like the Linux flavor listxattr(), that is with NUL-terminated strings. FreeBSD's doc/79261 reports that problem, and they decided to stick with this implementation and to fix the documentation: http://www.freebsd.org/cgi/query-pr.cgi?pr=79261 http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/sys/extattr_get_file.2.diff?r1=1.16;r2=1.17 That weakens my point about sticking to the documentd behaviour, and I guess I need to revert extattr_list__file() output to what it was before and fix the doc like FreeBSD did. It is easy to do the conversion so that our Linux-like listexattr() returns NUL-separated strings, while our FreeBSD-like extattr_list_file() returns one-byte length prefixed strings. The question is what should our vnode interface (VOP_LISTEXTATTR) require? Linux-like format is also used by MacOS X and FUSE, so it will make FUSE code simplier, so I will go for that second option. This means I leave src/sys/ufs/ufs/ufs_extattr.c as is and just convert the output in src/sys/kern/vfs_xattr.c -- Emmanuel Dreyfus m...@netbsd.org