mirror of
https://github.com/sheumann/hush.git
synced 2024-10-29 20:27:40 +00:00
54 lines
1.9 KiB
C
54 lines
1.9 KiB
C
|
/* vi: set sw=4 ts=4: */
|
||
|
/*
|
||
|
File: linux/ext2_ext_attr.h
|
||
|
|
||
|
On-disk format of extended attributes for the ext2 filesystem.
|
||
|
|
||
|
(C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
||
|
*/
|
||
|
|
||
|
/* Magic value in attribute blocks */
|
||
|
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
|
||
|
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
|
||
|
|
||
|
/* Maximum number of references to one attribute block */
|
||
|
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
|
||
|
|
||
|
struct ext2_ext_attr_header {
|
||
|
__u32 h_magic; /* magic number for identification */
|
||
|
__u32 h_refcount; /* reference count */
|
||
|
__u32 h_blocks; /* number of disk blocks used */
|
||
|
__u32 h_hash; /* hash value of all attributes */
|
||
|
__u32 h_reserved[4]; /* zero right now */
|
||
|
};
|
||
|
|
||
|
struct ext2_ext_attr_entry {
|
||
|
__u8 e_name_len; /* length of name */
|
||
|
__u8 e_name_index; /* attribute name index */
|
||
|
__u16 e_value_offs; /* offset in disk block of value */
|
||
|
__u32 e_value_block; /* disk block attribute is stored on (n/i) */
|
||
|
__u32 e_value_size; /* size of attribute value */
|
||
|
__u32 e_hash; /* hash value of name and value */
|
||
|
};
|
||
|
|
||
|
#define EXT2_EXT_ATTR_PAD_BITS 2
|
||
|
#define EXT2_EXT_ATTR_PAD (1<<EXT2_EXT_ATTR_PAD_BITS)
|
||
|
#define EXT2_EXT_ATTR_ROUND (EXT2_EXT_ATTR_PAD-1)
|
||
|
#define EXT2_EXT_ATTR_LEN(name_len) \
|
||
|
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||
|
sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||
|
#define EXT2_EXT_ATTR_NEXT(entry) \
|
||
|
( (struct ext2_ext_attr_entry *)( \
|
||
|
(char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
|
||
|
#define EXT2_EXT_ATTR_SIZE(size) \
|
||
|
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||
|
#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
|
||
|
#define EXT2_EXT_ATTR_NAME(entry) \
|
||
|
(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
|
||
|
#define EXT2_XATTR_LEN(name_len) \
|
||
|
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||
|
sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||
|
#define EXT2_XATTR_SIZE(size) \
|
||
|
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||
|
|