15a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#include <sys/types.h> 25a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 35a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#ifndef _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H 45a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define _SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H 1 55a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 65a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_MAGIC 0xEA020000 75a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_INDEX_SECURITY 6 85a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 95a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turnerstruct ext4_xattr_header { 105a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_magic; 115a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_refcount; 125a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_blocks; 135a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_hash; 145a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_checksum; 155a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __u32 h_reserved[3]; 165a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner}; 175a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 185a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turnerstruct ext4_xattr_ibody_header { 195a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 h_magic; 205a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner}; 215a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 225a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turnerstruct ext4_xattr_entry { 235a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __u8 e_name_len; 245a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __u8 e_name_index; 255a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le16 e_value_offs; 265a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 e_value_block; 275a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 e_value_size; 285a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner __le32 e_hash; 295a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner char e_name[0]; 305a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner}; 315a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 325a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_PAD_BITS 2 335a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_PAD (1<<EXT4_XATTR_PAD_BITS) 345a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_ROUND (EXT4_XATTR_PAD-1) 355a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_LEN(name_len) \ 365a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner (((name_len) + EXT4_XATTR_ROUND + \ 375a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND) 385a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_NEXT(entry) \ 395a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner ((struct ext4_xattr_entry *)( \ 405a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len))) 415a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define EXT4_XATTR_SIZE(size) \ 425a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND) 435a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#define IS_LAST_ENTRY(entry) (*(uint32_t *)(entry) == 0) 445a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner 455a60dc51ef5c2b97db192244e79b12ad03ee885eDavid 'Digit' Turner#endif /* !_SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H */ 46