I’m trying to switch from using sycall/kernel-driver to direct pvfs_*() functions. A major issue is that pvfs_getxattr() returns a length 1 byte longer than syscalls, as shown:
svy@papp1:~$ sudo attr -l /srv/data/cyphre-v2/user0
Attribute "cyphre.owner" has a 6 byte value for /srv/data/cyphre-v2/user0
svy@papp1:~$ sudo ./attr-test /srv/data/cyphre-v2/user0
user.cyphre.owner is 7 bytes
Note that 6 is the correct answer. It’s the length I set with setxattr().
The second program was a quick one I write using pvfs_getxattr() where as the
first one is using the attr program, so it uses getxattr() syscall directly,
and goes through the kernel driver.
If I do something like:
len = pvfs_getxattr(path, key, NULL, 0);
len—; // True length
buf = malloc(len);
len = pvfs_getxattr(path, key, buf, len);
I get data that is, technically, the right length, but truncated by one byte
(last byte is ‘\0’). My assumption (without digging too deep) is that the pvfs
function adds an extra byte to null terminate the buffer, but it definitely
shouldn’t do this (keys, sure, but not values).
Either way, this makes the pvfs wrapper incompatible with the posix functions.
——
Ben Collins
Cyphre Champion
——————————————
VP of Engineering
Servergy, Inc.
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Pvfs2-developers mailing list [email protected] http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
