yaffs direct: Add more tests for valid paths.
[yaffs2.git] / direct / ydirectenv.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002-2010 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 "stdlib.h"
26 #include "stdio.h"
27 #include "string.h"
28 #include "yaffs_osglue.h"
29 #include "yaffs_hweight.h"
30
31 #include "assert.h"
32 #define YBUG() assert(0)
33 //#define YBUG() do { *((int *)0) =1;} while(0)
34
35
36 #define YCHAR char
37 #define YUCHAR unsigned char
38 #define _Y(x) x
39 #define yaffs_strcat(a,b)    strcat(a,b)
40 #define yaffs_strcpy(a,b)    strcpy(a,b)
41 #define yaffs_strncpy(a,b,c) strncpy(a,b,c)
42 #define yaffs_strncmp(a,b,c) strncmp(a,b,c)
43 #define yaffs_strnlen(s,m)           strnlen(s,m)
44 #define yaffs_sprintf        sprintf
45 #define yaffs_toupper(a)     toupper(a)
46
47 #define hweight8(x)     yaffs_hweight8(x)
48 #define hweight32(x)    yaffs_hweight32(x)
49
50 void yaffs_qsort(void *aa, size_t n, size_t es,
51         int (*cmp)(const void *, const void *));
52
53 #define yaffs_sort(base, n, sz, cmp_fn) yaffs_qsort(base, n, sz, cmp_fn)
54         
55 #define YAFFS_PATH_DIVIDERS  "/"
56
57 #ifdef NO_Y_INLINE
58 #define Y_INLINE
59 #else
60 #define Y_INLINE __inline__
61 #endif
62
63 #define YMALLOC(x) yaffs_malloc(x)
64 #define YFREE(x)   free(x)
65 #define YMALLOC_ALT(x) yaffs_malloc(x)
66 #define YFREE_ALT(x)   free(x)
67
68 #define YMALLOC_DMA(x) yaffs_malloc(x)
69
70 #define YYIELD()  do {} while(0)
71
72
73
74 //#define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
75 //#define YALERT(s) YINFO(s)
76
77
78 #define TENDSTR "\n"
79 #define TSTR(x) x
80 #define TCONT(x) x
81 #define TOUT(p) printf p
82
83
84 #define YAFFS_LOSTNFOUND_NAME           "lost+found"
85 #define YAFFS_LOSTNFOUND_PREFIX         "obj"
86 //#define YPRINTF(x) printf x
87
88 #include "yaffscfg.h"
89
90 #define Y_CURRENT_TIME yaffsfs_CurrentTime()
91 #define Y_TIME_CONVERT(x) x
92
93 #define YAFFS_ROOT_MODE                         0666
94 #define YAFFS_LOSTNFOUND_MODE           0666
95
96 #define yaffs_sum_cmp(x,y) ((x) == (y))
97 #define yaffs_strcmp(a,b) strcmp(a,b)
98
99 #include "yaffs_list.h"
100
101 #include "yaffsfs.h"
102
103 #endif
104
105