1b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#include <sys/types.h>
2b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley
3b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_MAGIC 0xEA020000
4b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_INDEX_SECURITY 6
5b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley
6b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalleystruct ext4_xattr_entry {
7b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __u8 e_name_len;
8b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __u8 e_name_index;
9b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __le16 e_value_offs;
10b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __le32 e_value_block;
11b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __le32 e_value_size;
12b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    __le32 e_hash;
13b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    char e_name[0];
14b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley};
15b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley
16b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_PAD_BITS 2
17b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_PAD (1<<EXT4_XATTR_PAD_BITS)
18b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_ROUND (EXT4_XATTR_PAD-1)
19b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_LEN(name_len) \
20b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    (((name_len) + EXT4_XATTR_ROUND + \
21b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND)
22b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley#define EXT4_XATTR_SIZE(size) \
23b4eca4b24af9c80ebb2a7fa2ba539a48096b7576Stephen Smalley    (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
24