2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
5 * Copyright (C) 2002 Aleph One Ltd.
6 * for Toby Churchill Ltd and Brightstar Engineering
8 * Created by Charles Manning <charles@aleph1.co.uk>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This file is just holds extra declarations used during development.
15 * Most of these are from kernel includes placed here so we can use them in
27 typedef unsigned char __u8;
28 typedef unsigned short __u16;
29 typedef unsigned __u32;
33 * Simple doubly linked list implementation.
35 * Some of the internal functions ("__xxx") are useful when
36 * manipulating whole lists rather than single entries, as
37 * sometimes we already know the next/prev entries and we can
38 * generate better code by using them directly rather than
39 * using the generic single-entry routines.
46 struct list_head *next, *prev;
49 #define LIST_HEAD_INIT(name) { &(name), &(name) }
51 #define LIST_HEAD(name) \
52 struct list_head name = LIST_HEAD_INIT(name)
54 #define INIT_LIST_HEAD(ptr) do { \
55 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
59 * Insert a new entry between two known consecutive entries.
61 * This is only for internal list manipulation where we know
62 * the prev/next entries already!
64 static __inline__ void __list_add(struct list_head * new,
65 struct list_head * prev,
66 struct list_head * next)
75 * list_add - add a new entry
76 * @new: new entry to be added
77 * @head: list head to add it after
79 * Insert a new entry after the specified head.
80 * This is good for implementing stacks.
82 static __inline__ void list_add(struct list_head *new, struct list_head *head)
84 __list_add(new, head, head->next);
88 * list_add_tail - add a new entry
89 * @new: new entry to be added
90 * @head: list head to add it before
92 * Insert a new entry before the specified head.
93 * This is useful for implementing queues.
95 static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
97 __list_add(new, head->prev, head);
101 * Delete a list entry by making the prev/next entries
102 * point to each other.
104 * This is only for internal list manipulation where we know
105 * the prev/next entries already!
107 static __inline__ void __list_del(struct list_head * prev,
108 struct list_head * next)
115 * list_del - deletes entry from list.
116 * @entry: the element to delete from the list.
117 * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
119 static __inline__ void list_del(struct list_head *entry)
121 __list_del(entry->prev, entry->next);
125 * list_del_init - deletes entry from list and reinitialize it.
126 * @entry: the element to delete from the list.
128 static __inline__ void list_del_init(struct list_head *entry)
130 __list_del(entry->prev, entry->next);
131 INIT_LIST_HEAD(entry);
135 * list_empty - tests whether a list is empty
136 * @head: the list to test.
138 static __inline__ int list_empty(struct list_head *head)
140 return head->next == head;
144 * list_splice - join two lists
145 * @list: the new list to add.
146 * @head: the place to add it in the first list.
148 static __inline__ void list_splice(struct list_head *list, struct list_head *head)
150 struct list_head *first = list->next;
153 struct list_head *last = list->prev;
154 struct list_head *at = head->next;
165 * list_entry - get the struct for this entry
166 * @ptr: the &struct list_head pointer.
167 * @type: the type of the struct this is embedded in.
168 * @member: the name of the list_struct within the struct.
170 #define list_entry(ptr, type, member) \
171 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
174 * list_for_each - iterate over a list
175 * @pos: the &struct list_head to use as a loop counter.
176 * @head: the head for your list.
178 #define list_for_each(pos, head) \
179 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
180 pos = pos->next, prefetch(pos->next))
183 * list_for_each_safe - iterate over a list safe against removal of list entry
184 * @pos: the &struct list_head to use as a loop counter.
185 * @n: another &struct list_head to use as temporary storage
186 * @head: the head for your list.
188 #define list_for_each_safe(pos, n, head) \
189 for (pos = (head)->next, n = pos->next; pos != (head); \
190 pos = n, n = pos->next)
194 #define CURRENT_TIME 0
210 #include <sys/stat.h>
213 * Attribute flags. These should be or-ed together to figure out what
220 #define ATTR_ATIME 16
221 #define ATTR_MTIME 32
222 #define ATTR_CTIME 64
223 #define ATTR_ATIME_SET 128
224 #define ATTR_MTIME_SET 256
225 #define ATTR_FORCE 512 /* Not a change, but a change it */
226 #define ATTR_ATTR_FLAG 1024
230 unsigned int ia_valid;
238 unsigned int ia_attr_flags;
245 #include <linux/types.h>
246 #include <linux/list.h>
247 #include <linux/fs.h>
248 #include <linux/stat.h>