OSDN Git Service

ext4_utils: add filesystem capabilities support.
[android-x86/system-extras.git] / ext4_utils / xattr.h
index 2c6d9cc..60c01ce 100644 (file)
@@ -1,8 +1,24 @@
 #include <sys/types.h>
 
+#ifndef _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H
+#define _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H 1
+
 #define EXT4_XATTR_MAGIC 0xEA020000
 #define EXT4_XATTR_INDEX_SECURITY 6
 
+struct ext4_xattr_header {
+    __le32  h_magic;
+    __le32  h_refcount;
+    __le32  h_blocks;
+    __le32  h_hash;
+    __le32  h_checksum;
+    __u32   h_reserved[3];
+};
+
+struct ext4_xattr_ibody_header {
+    __le32  h_magic;
+};
+
 struct ext4_xattr_entry {
     __u8 e_name_len;
     __u8 e_name_index;
@@ -19,5 +35,11 @@ struct ext4_xattr_entry {
 #define EXT4_XATTR_LEN(name_len) \
     (((name_len) + EXT4_XATTR_ROUND + \
     sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND)
+#define EXT4_XATTR_NEXT(entry) \
+    ((struct ext4_xattr_entry *)( \
+     (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)))
 #define EXT4_XATTR_SIZE(size) \
     (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
+#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
+
+#endif /* !_SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H */