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 of macros that would normally
18 * be providesd in the Linux kernel. These macros have been written from
19 * scratch but are functionally equivalent to the Linux ones.
27 #define __inline__ __inline
31 #if !(defined __KERNEL__) || (defined WIN32)
33 /* Definition of types */
34 typedef unsigned char __u8;
35 typedef unsigned short __u16;
36 typedef unsigned __u32;
39 * This is a simple doubly linked list implementation that matches the
40 * way the Linux kernel doubly linked list implementation works.
44 struct list_head *next; /* next in chain */
45 struct list_head *prev; /* previous in chain */
49 /* Initialise a list head to an empty list */
50 #define INIT_LIST_HEAD(p) \
57 /* Add an element to a list */
58 static __inline__ void list_add(struct list_head *newEntry,
59 struct list_head *list)
61 struct list_head *listNext = list->next;
63 list->next = newEntry;
64 newEntry->prev = list;
65 newEntry->next = listNext;
66 listNext->prev = newEntry;
71 /* Take an element out of its current list, with or without
72 * reinitialising the links.of the entry*/
73 static __inline__ void list_del(struct list_head *entry)
75 struct list_head *listNext = entry->next;
76 struct list_head *listPrev = entry->prev;
78 listNext->prev = listPrev;
79 listPrev->next = listNext;
83 static __inline__ void list_del_init(struct list_head *entry)
86 entry->next = entry->prev = entry;
90 /* Test if the list is empty */
91 static __inline__ int list_empty(struct list_head *entry)
93 return (entry->next == entry);
97 /* list_entry takes a pointer to a list entry and offsets it to that
98 * we can find a pointer to the object it is embedded in.
102 #define list_entry(entry, type, member) \
103 ((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member)))
106 /* list_for_each and list_for_each_safe iterate over lists.
107 * list_for_each_safe uses temporary storage to make the list delete safe
110 #define list_for_each(itervar, list) \
111 for (itervar = (list)->next; itervar != (list); itervar = itervar->next )
113 #define list_for_each_safe(itervar,saveVar, list) \
114 for (itervar = (list)->next, saveVar = (list)->next->next; itervar != (list); \
115 itervar = saveVar, saveVar = saveVar->next)
131 #include <sys/stat.h>
141 #define ATTR_ATIME 16
142 #define ATTR_MTIME 32
143 #define ATTR_CTIME 64
147 unsigned int ia_valid;
155 unsigned int ia_attr_flags;
163 #include <linux/types.h>
164 #include <linux/list.h>
165 #include <linux/fs.h>
166 #include <linux/stat.h>