Home | History | Annotate | Download | only in ext4_utils
      1 #include <sys/types.h>
      2 
      3 #ifndef _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H
      4 #define _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H 1
      5 
      6 #define EXT4_XATTR_MAGIC 0xEA020000
      7 #define EXT4_XATTR_INDEX_SECURITY 6
      8 
      9 struct ext4_xattr_header {
     10     __le32  h_magic;
     11     __le32  h_refcount;
     12     __le32  h_blocks;
     13     __le32  h_hash;
     14     __le32  h_checksum;
     15     __u32   h_reserved[3];
     16 };
     17 
     18 struct ext4_xattr_ibody_header {
     19     __le32  h_magic;
     20 };
     21 
     22 struct ext4_xattr_entry {
     23     __u8 e_name_len;
     24     __u8 e_name_index;
     25     __le16 e_value_offs;
     26     __le32 e_value_block;
     27     __le32 e_value_size;
     28     __le32 e_hash;
     29     char e_name[0];
     30 };
     31 
     32 #define EXT4_XATTR_PAD_BITS 2
     33 #define EXT4_XATTR_PAD (1<<EXT4_XATTR_PAD_BITS)
     34 #define EXT4_XATTR_ROUND (EXT4_XATTR_PAD-1)
     35 #define EXT4_XATTR_LEN(name_len) \
     36     (((name_len) + EXT4_XATTR_ROUND + \
     37     sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND)
     38 #define EXT4_XATTR_NEXT(entry) \
     39     ((struct ext4_xattr_entry *)( \
     40      (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)))
     41 #define EXT4_XATTR_SIZE(size) \
     42     (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
     43 #define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
     44 
     45 #endif /* !_SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H */
     46