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 Lesser General Public License version 2.1 as
12 * published by the Free Software Foundation.
14 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
16 * This file is just holds extra declarations used during development.
17 * Most of these are from kernel includes placed here so we can use them in
20 * $Id: devextras.h,v 1.1 2004-11-03 08:14:07 charles Exp $
28 #define __inline__ __inline
32 #if !(defined __KERNEL__) || (defined WIN32)
36 typedef unsigned char __u8;
37 typedef unsigned short __u16;
38 typedef unsigned __u32;
42 * Simple doubly linked list implementation.
44 * Some of the internal functions ("__xxx") are useful when
45 * manipulating whole lists rather than single entries, as
46 * sometimes we already know the next/prev entries and we can
47 * generate better code by using them directly rather than
48 * using the generic single-entry routines.
55 struct list_head *next, *prev;
58 #define LIST_HEAD_INIT(name) { &(name), &(name) }
60 #define LIST_HEAD(name) \
61 struct list_head name = LIST_HEAD_INIT(name)
63 #define INIT_LIST_HEAD(ptr) do { \
64 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
68 * Insert a new entry between two known consecutive entries.
70 * This is only for internal list manipulation where we know
71 * the prev/next entries already!
73 static __inline__ void __list_add(struct list_head * new,
74 struct list_head * prev,
75 struct list_head * next)
84 * list_add - add a new entry
85 * @new: new entry to be added
86 * @head: list head to add it after
88 * Insert a new entry after the specified head.
89 * This is good for implementing stacks.
91 static __inline__ void list_add(struct list_head *new, struct list_head *head)
93 __list_add(new, head, head->next);
97 * list_add_tail - add a new entry
98 * @new: new entry to be added
99 * @head: list head to add it before
101 * Insert a new entry before the specified head.
102 * This is useful for implementing queues.
104 static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
106 __list_add(new, head->prev, head);
110 * Delete a list entry by making the prev/next entries
111 * point to each other.
113 * This is only for internal list manipulation where we know
114 * the prev/next entries already!
116 static __inline__ void __list_del(struct list_head * prev,
117 struct list_head * next)
124 * list_del - deletes entry from list.
125 * @entry: the element to delete from the list.
126 * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
128 static __inline__ void list_del(struct list_head *entry)
130 __list_del(entry->prev, entry->next);
134 * list_del_init - deletes entry from list and reinitialize it.
135 * @entry: the element to delete from the list.
137 static __inline__ void list_del_init(struct list_head *entry)
139 __list_del(entry->prev, entry->next);
140 INIT_LIST_HEAD(entry);
144 * list_empty - tests whether a list is empty
145 * @head: the list to test.
147 static __inline__ int list_empty(struct list_head *head)
149 return head->next == head;
153 * list_splice - join two lists
154 * @list: the new list to add.
155 * @head: the place to add it in the first list.
157 static __inline__ void list_splice(struct list_head *list, struct list_head *head)
159 struct list_head *first = list->next;
162 struct list_head *last = list->prev;
163 struct list_head *at = head->next;
174 * list_entry - get the struct for this entry
175 * @ptr: the &struct list_head pointer.
176 * @type: the type of the struct this is embedded in.
177 * @member: the name of the list_struct within the struct.
179 #define list_entry(ptr, type, member) \
180 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
183 * list_for_each - iterate over a list
184 * @pos: the &struct list_head to use as a loop counter.
185 * @head: the head for your list.
187 #define list_for_each(pos, head) \
188 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
189 pos = pos->next, prefetch(pos->next))
192 * list_for_each_safe - iterate over a list safe against removal of list entry
193 * @pos: the &struct list_head to use as a loop counter.
194 * @n: another &struct list_head to use as temporary storage
195 * @head: the head for your list.
197 #define list_for_each_safe(pos, n, head) \
198 for (pos = (head)->next, n = pos->next; pos != (head); \
199 pos = n, n = pos->next)
218 #include <sys/stat.h>
222 * Attribute flags. These should be or-ed together to figure out what
229 #define ATTR_ATIME 16
230 #define ATTR_MTIME 32
231 #define ATTR_CTIME 64
232 #define ATTR_ATIME_SET 128
233 #define ATTR_MTIME_SET 256
234 #define ATTR_FORCE 512 /* Not a change, but a change it */
235 #define ATTR_ATTR_FLAG 1024
239 unsigned int ia_valid;
247 unsigned int ia_attr_flags;
256 #include <linux/types.h>
257 #include <linux/list.h>
258 #include <linux/fs.h>
259 #include <linux/stat.h>