arm: sc8830: gpio: remove the redefined macro
[profile/mobile/platform/kernel/u-boot-tm1.git] / fs / yaffs2 / fdl_yaffs2.h
1 #ifndef FDL_YAFFS2_H
2 #define FDL_YAFFS2_H
3
4
5 #define YAFFS_MAX_NAME_LENGTH           255
6 #define YAFFS_MAX_ALIAS_LENGTH          159
7
8 #define BOOT_MAGIC_SIZE 8
9 #define BOOT_NAME_SIZE 16
10 #define BOOT_ARGS_SIZE 512
11
12 #define YAFFS_LOWEST_SEQUENCE_NUMBER    0x00001000
13 #define YAFFS_HIGHEST_SEQUENCE_NUMBER   0xEFFFFF00
14
15 #ifndef __u16
16  #define __u16 unsigned short
17 #endif
18
19 #ifndef __u32
20  #define __u32 unsigned int
21 #endif
22
23 #ifndef __u8
24  #define __u8 unsigned char
25 #endif
26
27 typedef enum {
28         YAFFS_ECC_RESULT_UNKNOWN,
29         YAFFS_ECC_RESULT_NO_ERROR,
30         YAFFS_ECC_RESULT_FIXED,
31         YAFFS_ECC_RESULT_UNFIXED
32 } yaffs_ECCResult;
33
34 typedef enum {
35         YAFFS_OBJECT_TYPE_UNKNOWN,
36         YAFFS_OBJECT_TYPE_FILE,
37         YAFFS_OBJECT_TYPE_SYMLINK,
38         YAFFS_OBJECT_TYPE_DIRECTORY,
39         YAFFS_OBJECT_TYPE_HARDLINK,
40         YAFFS_OBJECT_TYPE_SPECIAL
41 } yaffs_ObjectType;
42
43 typedef struct {
44
45         unsigned validMarker0;
46         unsigned chunkUsed;     /*  Status of the chunk: used or unused */
47         unsigned objectId;      /* If 0 then this is not part of an object (unused) */
48         unsigned chunkId;       /* If 0 then this is a header, else a data chunk */
49         unsigned byteCount;     /* Only valid for data chunks */
50
51         /* The following stuff only has meaning when we read */
52         yaffs_ECCResult eccResult;
53         unsigned blockBad;
54
55         /* YAFFS 1 stuff */
56         unsigned chunkDeleted;  /* The chunk is marked deleted */
57         unsigned serialNumber;  /* Yaffs1 2-bit serial number */
58
59         /* YAFFS2 stuff */
60         unsigned sequenceNumber;        /* The sequence number of this block */
61
62         /* Extra info if this is an object header (YAFFS2 only) */
63
64         unsigned extraHeaderInfoAvailable;      /* There is extra info available if this is not zero */
65         unsigned extraParentObjectId;   /* The parent object */
66         unsigned extraIsShrinkHeader;   /* Is it a shrink header? */
67         unsigned extraShadows;          /* Does this shadow another object? */
68
69         yaffs_ObjectType extraObjectType;       /* What object type? */
70
71         unsigned extraFileLength;               /* Length if it is a file */
72         unsigned extraEquivalentObjectId;       /* Equivalent object Id if it is a hard link */
73
74         unsigned validMarker1;
75
76 } yaffs_ExtendedTags;
77
78 /* -------------------------- Object structure -------------------------------*/
79 /* This is the object structure as stored on NAND */
80
81 typedef struct {
82         yaffs_ObjectType type;
83
84         /* Apply to everything  */
85         int parentObjectId;
86         __u16 sum__NoLongerUsed;        /* checksum of name. No longer used */
87         char name[YAFFS_MAX_NAME_LENGTH + 1];
88
89         /* Thes following apply to directories, files, symlinks - not hard links */
90         __u32 yst_mode;         /* protection */
91
92 #ifdef CONFIG_YAFFS_WINCE
93         __u32 notForWinCE[5];
94 #else
95         __u32 yst_uid;
96         __u32 yst_gid;
97         __u32 yst_atime;
98         __u32 yst_mtime;
99         __u32 yst_ctime;
100 #endif
101
102         /* File size  applies to files only */
103         int fileSize;
104
105         /* Equivalent object id applies to hard links only. */
106         int equivalentObjectId;
107
108         /* Alias is for symlinks only. */
109         char alias[YAFFS_MAX_ALIAS_LENGTH + 1];
110
111         __u32 yst_rdev;         /* device stuff for block and char devices (major/min) */
112
113 #ifdef CONFIG_YAFFS_WINCE
114         __u32 win_ctime[2];
115         __u32 win_atime[2];
116         __u32 win_mtime[2];
117         __u32 roomToGrow[4];
118 #else
119         __u32 roomToGrow[10];
120 #endif
121
122         int shadowsObject;      /* This object header shadows the specified object if > 0 */
123
124         /* isShrink applies to object headers written when we shrink the file (ie resize) */
125         __u32 isShrink;
126
127 } yaffs_ObjectHeader;
128
129
130 typedef struct {
131         unsigned char colParity;
132         unsigned lineParity;
133         unsigned lineParityPrime;
134 } yaffs_ECCOther;
135
136 typedef struct {
137         unsigned sequenceNumber;
138         unsigned objectId;
139         unsigned chunkId;
140         unsigned byteCount;
141 } yaffs_PackedTags2TagsPart;
142
143 typedef struct {
144         yaffs_PackedTags2TagsPart t;
145         yaffs_ECCOther ecc;
146 } yaffs_PackedTags2;
147
148 typedef struct{
149     unsigned char magic[BOOT_MAGIC_SIZE];
150
151     unsigned kernel_size;  /* size in bytes */
152     unsigned kernel_addr;  /* physical load addr */
153
154     unsigned ramdisk_size; /* size in bytes */
155     unsigned ramdisk_addr; /* physical load addr */
156
157     unsigned second_size;  /* size in bytes */
158     unsigned second_addr;  /* physical load addr */
159
160     unsigned tags_addr;    /* physical addr for kernel tags */
161     unsigned page_size;    /* flash page size we assume */
162     unsigned unused[2];    /* future expansion: should be 0 */
163
164     unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */
165     unsigned char cmdline[BOOT_ARGS_SIZE];
166
167     unsigned id[8]; /* timestamp / checksum / sha1 / etc */
168 }bootimg_hdr;
169
170 void yaffs2_InitialiseTags(yaffs_ExtendedTags * tags);
171 void yaffs2_PackTags2(yaffs_PackedTags2 * pt, const yaffs_ExtendedTags * t);
172
173 #endif /* FDL_YAFFS2_H */