0c2820579eade2682159b932fd004c894c737212
[yaffs2.git] / direct / ydirectenv.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002-2007 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Charles Manning <charles@aleph1.co.uk>
8  *
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.
12  *
13  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
14  */
15
16 /*
17  * ydirectenv.h: Environment wrappers for YAFFS direct.
18  */
19
20 #ifndef __YDIRECTENV_H__
21 #define __YDIRECTENV_H__
22
23 // Direct interface
24
25 #include "devextras.h"
26
27 #include "stdlib.h"
28 #include "stdio.h"
29 #include "string.h"
30 #include "yaffs_malloc.h"
31
32 #include "assert.h"
33 #define YBUG() assert(1)
34
35 #define YCHAR char
36 #define YUCHAR unsigned char
37 #define _Y(x) x
38 #define yaffs_strcpy(a,b)    strcpy(a,b)
39 #define yaffs_strncpy(a,b,c) strncpy(a,b,c)
40 #define yaffs_strncmp(a,b,c) strncmp(a,b,c)
41 #define yaffs_strlen(s)      strlen(s)
42 #define yaffs_sprintf        sprintf
43 #define yaffs_toupper(a)     toupper(a)
44
45 #ifdef NO_Y_INLINE
46 #define Y_INLINE
47 #else
48 #define Y_INLINE inline
49 #endif
50
51 #define YMALLOC(x) yaffs_malloc(x)
52 #define YFREE(x)   free(x)
53 #define YMALLOC_ALT(x) yaffs_malloc(x)
54 #define YFREE_ALT(x)   free(x)
55
56 #define YMALLOC_DMA(x) yaffs_malloc(x)
57
58 #define YYIELD()  do {} while(0)
59
60
61
62 //#define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
63 //#define YALERT(s) YINFO(s)
64
65
66 #define TENDSTR "\n"
67 #define TSTR(x) x
68 #define TOUT(p) printf p
69
70
71 #define YAFFS_LOSTNFOUND_NAME           "lost+found"
72 #define YAFFS_LOSTNFOUND_PREFIX         "obj"
73 //#define YPRINTF(x) printf x
74
75 #include "yaffscfg.h"
76
77 #define Y_CURRENT_TIME yaffsfs_CurrentTime()
78 #define Y_TIME_CONVERT(x) x
79
80 #define YAFFS_ROOT_MODE                         0666
81 #define YAFFS_LOSTNFOUND_MODE           0666
82
83 #define yaffs_SumCompare(x,y) ((x) == (y))
84 #define yaffs_strcmp(a,b) strcmp(a,b)
85
86 #endif
87
88