From: Richard W.M. Jones Date: Thu, 16 Dec 2010 20:05:48 +0000 (+0000) Subject: New APIs: getxattr and lgetxattr to get single extended attributes. X-Git-Tag: 1.7.24~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3a3836b933b80c4f9f2c767fda4f8b459f998db2;hp=3a3836b933b80c4f9f2c767fda4f8b459f998db2;p=libguestfs.git New APIs: getxattr and lgetxattr to get single extended attributes. These APIs are essentially required to work around a problem with ntfs-3g. This filesystem (or FUSE?) does not list all extended attributes of a file when you call listxattr(2). However if you know the name of an extended attribute, you can retrieve it directly using getxattr(2). The current APIs (getxattrs etc) are simple to use, but they don't work if we can't list out the extended attributes (ie. by calling listxattr(2)). Example using the new APIs on an ntfs-3g filesystem: > lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 > lgetxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C 00000000 03 00 00 a0 34 00 00 00 00 00 18 00 1a 00 10 00 |....4...........| 00000010 5c 00 3f 00 3f 00 5c 00 43 00 3a 00 5c 00 55 00 |\.?.?.\.C.:.\.U.| 00000020 73 00 65 00 72 00 73 00 00 00 43 00 3a 00 5c 00 |s.e.r.s...C.:.\.| 00000030 55 00 73 00 65 00 72 00 73 00 00 00 |U.s.e.r.s...| 0000003c > getxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory > getxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory > lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 > getxattr "/Users" system.ntfs_attrib | hexdump -C 00000000 11 00 00 00 |....| 00000004 ---