2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2007 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License version 2.1 as
11 * published by the Free Software Foundation.
13 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
17 * This file is just holds extra declarations used during development.
18 * Most of these are from kernel includes placed here so we can use them in
27 #define __inline__ __inline
32 #if 1 /* !(defined __KERNEL__) || (defined WIN32) */
34 /* User space defines */
38 typedef unsigned char __u8;
39 typedef unsigned short __u16;
40 typedef unsigned __u32;
43 #include <asm/types.h>
46 * Simple doubly linked list implementation.
48 * Some of the internal functions ("__xxx") are useful when
49 * manipulating whole lists rather than single entries, as
50 * sometimes we already know the next/prev entries and we can
51 * generate better code by using them directly rather than
52 * using the generic single-entry routines.
58 struct list_head *next, *prev;
61 #define LIST_HEAD_INIT(name) { &(name), &(name) }
63 #define LIST_HEAD(name) \
64 struct list_head name = LIST_HEAD_INIT(name)
66 #define INIT_LIST_HEAD(ptr) do { \
67 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
71 * Insert a new entry between two known consecutive entries.
73 * This is only for internal list manipulation where we know
74 * the prev/next entries already!
76 static __inline__ void __list_add(struct list_head *new,
77 struct list_head *prev,
78 struct list_head *next)
87 * list_add - add a new entry
88 * @new: new entry to be added
89 * @head: list head to add it after
91 * Insert a new entry after the specified head.
92 * This is good for implementing stacks.
94 static __inline__ void list_add(struct list_head *new, struct list_head *head)
96 __list_add(new, head, head->next);
100 * list_add_tail - add a new entry
101 * @new: new entry to be added
102 * @head: list head to add it before
104 * Insert a new entry before the specified head.
105 * This is useful for implementing queues.
107 static __inline__ void list_add_tail(struct list_head *new,
108 struct list_head *head)
110 __list_add(new, head->prev, head);
114 * Delete a list entry by making the prev/next entries
115 * point to each other.
117 * This is only for internal list manipulation where we know
118 * the prev/next entries already!
120 static __inline__ void __list_del(struct list_head *prev,
121 struct list_head *next)
128 * list_del - deletes entry from list.
129 * @entry: the element to delete from the list.
130 * Note: list_empty on entry does not return true after this, the entry is
131 * in an undefined state.
133 static __inline__ void list_del(struct list_head *entry)
135 __list_del(entry->prev, entry->next);
139 * list_del_init - deletes entry from list and reinitialize it.
140 * @entry: the element to delete from the list.
142 static __inline__ void list_del_init(struct list_head *entry)
144 __list_del(entry->prev, entry->next);
145 INIT_LIST_HEAD(entry);
149 * list_empty - tests whether a list is empty
150 * @head: the list to test.
152 static __inline__ int list_empty(struct list_head *head)
154 return head->next == head;
158 * list_splice - join two lists
159 * @list: the new list to add.
160 * @head: the place to add it in the first list.
162 static __inline__ void list_splice(struct list_head *list,
163 struct list_head *head)
165 struct list_head *first = list->next;
168 struct list_head *last = list->prev;
169 struct list_head *at = head->next;
180 * list_entry - get the struct for this entry
181 * @ptr: the &struct list_head pointer.
182 * @type: the type of the struct this is embedded in.
183 * @member: the name of the list_struct within the struct.
185 #define list_entry(ptr, type, member) \
186 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
189 * list_for_each - iterate over a list
190 * @pos: the &struct list_head to use as a loop counter.
191 * @head: the head for your list.
193 #define list_for_each(pos, head) \
194 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
195 pos = pos->next, prefetch(pos->next))
198 * list_for_each_safe - iterate over a list safe against removal
200 * @pos: the &struct list_head to use as a loop counter.
201 * @n: another &struct list_head to use as temporary storage
202 * @head: the head for your list.
204 #define list_for_each_safe(pos, n, head) \
205 for (pos = (head)->next, n = pos->next; pos != (head); \
206 pos = n, n = pos->next)
224 #include <sys/stat.h>
231 * Attribute flags. These should be or-ed together to figure out what
238 #define ATTR_ATIME 16
239 #define ATTR_MTIME 32
240 #define ATTR_CTIME 64
241 #define ATTR_ATIME_SET 128
242 #define ATTR_MTIME_SET 256
243 #define ATTR_FORCE 512 /* Not a change, but a change it */
244 #define ATTR_ATTR_FLAG 1024
247 unsigned int ia_valid;
255 unsigned int ia_attr_flags;
263 #include <linux/types.h>
264 #include <linux/list.h>
265 #include <linux/fs.h>
266 #include <linux/stat.h>