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 #if !(defined __KERNEL__)
29 /* Definition of types */
30 typedef unsigned char __u8
;
31 typedef unsigned short __u16
;
32 typedef unsigned __u32
;
37 * This is a simple doubly linked list implementation that matches the
38 * way the Linux kernel doubly linked list implementation works.
42 struct ylist_head
*next
; /* next in chain */
43 struct ylist_head
*prev
; /* previous in chain */
47 /* Initialise a list head to an empty list */
48 #define YINIT_LIST_HEAD(p) \
55 /* Add an element to a list */
56 static __inline__
void ylist_add(struct ylist_head
*newEntry
,
57 struct ylist_head
*list
)
59 struct ylist_head
*listNext
= list
->next
;
61 list
->next
= newEntry
;
62 newEntry
->prev
= list
;
63 newEntry
->next
= listNext
;
64 listNext
->prev
= newEntry
;
69 /* Take an element out of its current list, with or without
70 * reinitialising the links.of the entry*/
71 static __inline__
void ylist_del(struct ylist_head
*entry
)
73 struct ylist_head
*listNext
= entry
->next
;
74 struct ylist_head
*listPrev
= entry
->prev
;
76 listNext
->prev
= listPrev
;
77 listPrev
->next
= listNext
;
81 static __inline__
void ylist_del_init(struct ylist_head
*entry
)
84 entry
->next
= entry
->prev
= entry
;
88 /* Test if the list is empty */
89 static __inline__
int ylist_empty(struct ylist_head
*entry
)
91 return (entry
->next
== entry
);
95 /* ylist_entry takes a pointer to a list entry and offsets it to that
96 * we can find a pointer to the object it is embedded in.
100 #define ylist_entry(entry, type, member) \
101 ((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member)))
104 /* ylist_for_each and list_for_each_safe iterate over lists.
105 * ylist_for_each_safe uses temporary storage to make the list delete safe
108 #define ylist_for_each(itervar, list) \
109 for (itervar = (list)->next; itervar != (list); itervar = itervar->next )
111 #define ylist_for_each_safe(itervar,saveVar, list) \
112 for (itervar = (list)->next, saveVar = (list)->next->next; itervar != (list); \
113 itervar = saveVar, saveVar = saveVar->next)
116 #if !(defined __KERNEL__)
120 #include <sys/stat.h>
124 #ifdef CONFIG_YAFFS_PROVIDE_DEFS
140 #include <sys/stat.h>
150 #define ATTR_ATIME 16
151 #define ATTR_MTIME 32
152 #define ATTR_CTIME 64
156 unsigned int ia_valid
;
164 unsigned int ia_attr_flags
;
174 #include <linux/types.h>
175 #include <linux/fs.h>
176 #include <linux/stat.h>
This page took 0.046039 seconds and 5 git commands to generate.