Fix the location where the new coldfire boards appear in the documentation
[barebox-mini2440.git] / include / envfs.h
blob99a4b0c16b507d162007a068e53a79d5e7fb61b3
1 #ifndef _ENVFS_H
2 #define _ENVFS_H
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 "U-Boot envfs"
11 struct envfs_inode {
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
18 * boundary.
23 * Superblock information at the beginning of the FS.
25 struct envfs_super {
26 uint32_t magic; /* ENVFS_MAGIC */
27 uint32_t priority;
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 */
35 #ifndef __BYTE_ORDER
36 #error "No byte order defined in __BYTE_ORDER"
37 #endif
39 #if __BYTE_ORDER == __LITTLE_ENDIAN
40 #warning "envfs compiled on little endian host"
41 #define ENVFS_16(x) (x)
42 #define ENVFS_24(x) (x)
43 #define ENVFS_32(x) (x)
44 #define ENVFS_GET_NAMELEN(x) ((x)->namelen)
45 #define ENVFS_GET_OFFSET(x) ((x)->offset)
46 #define ENVFS_SET_OFFSET(x,y) ((x)->offset = (y))
47 #define ENVFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
48 #elif __BYTE_ORDER == __BIG_ENDIAN
49 #warning "envfs compiled on big endian host"
50 #ifdef __KERNEL__
51 #define ENVFS_16(x) swab16(x)
52 #define ENVFS_24(x) ((swab32(x)) >> 8)
53 #define ENVFS_32(x) swab32(x)
54 #else /* not __KERNEL__ */
55 #define ENVFS_16(x) bswap_16(x)
56 #define ENVFS_24(x) ((bswap_32(x)) >> 8)
57 #define ENVFS_32(x) bswap_32(x)
58 #endif /* not __KERNEL__ */
59 #define ENVFS_GET_NAMELEN(x) ENVFS_32(((x)->namelen))
60 #define ENVFS_GET_OFFSET(x) ENVFS_32(((x)->offset))
61 #define ENVFS_SET_NAMELEN(x,y)((x)->offset = ENVFS_32((y)))
62 #define ENVFS_SET_OFFSET(x,y) ((x)->namelen = ENVFS_32((y)))
63 #else
64 #error "__BYTE_ORDER must be __LITTLE_ENDIAN or __BIG_ENDIAN"
65 #endif
67 #endif /* _ENVFS_H */