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
31 #if !(defined __KERNEL__) || (defined WIN32)
33 /* User space defines */
35 typedef unsigned char __u8
;
36 typedef unsigned short __u16
;
37 typedef unsigned __u32
;
40 * Simple doubly linked list implementation.
42 * Some of the internal functions ("__xxx") are useful when
43 * manipulating whole lists rather than single entries, as
44 * sometimes we already know the next/prev entries and we can
45 * generate better code by using them directly rather than
46 * using the generic single-entry routines.
52 struct list_head
*next
, *prev
;
55 #define LIST_HEAD_INIT(name) { &(name), &(name) }
57 #define LIST_HEAD(name) \
58 struct list_head name = LIST_HEAD_INIT(name)
60 #define INIT_LIST_HEAD(ptr) do { \
61 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
65 * Insert a new entry between two known consecutive entries.
67 * This is only for internal list manipulation where we know
68 * the prev/next entries already!
70 static __inline__
void __list_add(struct list_head
*new,
71 struct list_head
*prev
,
72 struct list_head
*next
)
81 * list_add - add a new entry
82 * @new: new entry to be added
83 * @head: list head to add it after
85 * Insert a new entry after the specified head.
86 * This is good for implementing stacks.
88 static __inline__
void list_add(struct list_head
*new, struct list_head
*head
)
90 __list_add(new, head
, head
->next
);
94 * list_add_tail - add a new entry
95 * @new: new entry to be added
96 * @head: list head to add it before
98 * Insert a new entry before the specified head.
99 * This is useful for implementing queues.
101 static __inline__
void list_add_tail(struct list_head
*new,
102 struct list_head
*head
)
104 __list_add(new, head
->prev
, head
);
108 * Delete a list entry by making the prev/next entries
109 * point to each other.
111 * This is only for internal list manipulation where we know
112 * the prev/next entries already!
114 static __inline__
void __list_del(struct list_head
*prev
,
115 struct list_head
*next
)
122 * list_del - deletes entry from list.
123 * @entry: the element to delete from the list.
124 * Note: list_empty on entry does not return true after this, the entry is
125 * in an undefined state.
127 static __inline__
void list_del(struct list_head
*entry
)
129 __list_del(entry
->prev
, entry
->next
);
133 * list_del_init - deletes entry from list and reinitialize it.
134 * @entry: the element to delete from the list.
136 static __inline__
void list_del_init(struct list_head
*entry
)
138 __list_del(entry
->prev
, entry
->next
);
139 INIT_LIST_HEAD(entry
);
143 * list_empty - tests whether a list is empty
144 * @head: the list to test.
146 static __inline__
int list_empty(struct list_head
*head
)
148 return head
->next
== head
;
152 * list_splice - join two lists
153 * @list: the new list to add.
154 * @head: the place to add it in the first list.
156 static __inline__
void list_splice(struct list_head
*list
,
157 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
194 * @pos: the &struct list_head to use as a loop counter.
195 * @n: another &struct list_head to use as temporary storage
196 * @head: the head for your list.
198 #define list_for_each_safe(pos, n, head) \
199 for (pos = (head)->next, n = pos->next; pos != (head); \
200 pos = n, n = pos->next)
216 #include <sys/stat.h>
220 * Attribute flags. These should be or-ed together to figure out what
227 #define ATTR_ATIME 16
228 #define ATTR_MTIME 32
229 #define ATTR_CTIME 64
230 #define ATTR_ATIME_SET 128
231 #define ATTR_MTIME_SET 256
232 #define ATTR_FORCE 512 /* Not a change, but a change it */
233 #define ATTR_ATTR_FLAG 1024
236 unsigned int ia_valid
;
244 unsigned int ia_attr_flags
;
252 #include <linux/types.h>
253 #include <linux/list.h>
254 #include <linux/fs.h>
255 #include <linux/stat.h>
This page took 0.05583 seconds and 5 git commands to generate.