4 #include <asm/byteorder.h>
6 #define ENVFS_MAGIC 0x798fba79 /* some random number */
7 #define ENVFS_INODE_MAGIC 0x67a8c78d
8 #define ENVFS_END_MAGIC 0x6a87d6cd
9 #define ENVFS_SIGNATURE "barebox envfs"
12 uint32_t magic
; /* ENVFS_INODE_MAGIC */
13 uint32_t size
; /* data size in bytes */
14 uint32_t namelen
; /* The length of the filename _including_ a trailing 0 */
15 char data
[0]; /* The filename (zero terminated) + padding to 4 byte boundary
16 * followed by the data for this inode.
17 * The next inode follows after the data + padding to 4 byte
23 * Superblock information at the beginning of the FS.
26 uint32_t magic
; /* ENVFS_MAGIC */
28 uint32_t crc
; /* crc for the data */
29 uint32_t size
; /* size of data */
30 uint32_t flags
; /* feature flags */
31 uint32_t future
; /* reserved for future use */
32 uint32_t sb_crc
; /* crc for the superblock */
36 #error "No byte order defined in __BYTE_ORDER"
39 #if __BYTE_ORDER == __LITTLE_ENDIAN
40 #define ENVFS_16(x) (x)
41 #define ENVFS_24(x) (x)
42 #define ENVFS_32(x) (x)
43 #define ENVFS_GET_NAMELEN(x) ((x)->namelen)
44 #define ENVFS_GET_OFFSET(x) ((x)->offset)
45 #define ENVFS_SET_OFFSET(x,y) ((x)->offset = (y))
46 #define ENVFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
47 #elif __BYTE_ORDER == __BIG_ENDIAN
49 #define ENVFS_16(x) swab16(x)
50 #define ENVFS_24(x) ((swab32(x)) >> 8)
51 #define ENVFS_32(x) swab32(x)
52 #else /* not __KERNEL__ */
53 #define ENVFS_16(x) bswap_16(x)
54 #define ENVFS_24(x) ((bswap_32(x)) >> 8)
55 #define ENVFS_32(x) bswap_32(x)
56 #endif /* not __KERNEL__ */
57 #define ENVFS_GET_NAMELEN(x) ENVFS_32(((x)->namelen))
58 #define ENVFS_GET_OFFSET(x) ENVFS_32(((x)->offset))
59 #define ENVFS_SET_NAMELEN(x,y)((x)->offset = ENVFS_32((y)))
60 #define ENVFS_SET_OFFSET(x,y) ((x)->namelen = ENVFS_32((y)))
62 #error "__BYTE_ORDER must be __LITTLE_ENDIAN or __BIG_ENDIAN"