ad4efab710e036d3904a256c0e43add08c9d46cc
[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
40 #define hweight8(x)     yaffs_hweight8(x)
41 #define hweight32(x)    yaffs_hweight32(x)
42
43 void yaffs_qsort(void *aa, size_t n, size_t es,
44         int (*cmp)(const void *, const void *));
45
46 #define sort(base, n, sz, cmp_fn, swp) yaffs_qsort(base, n, sz, cmp_fn)
47         
48 #define YAFFS_PATH_DIVIDERS  "/"
49
50 #ifdef NO_inline
51 #define inline
52 #else
53 #define inline __inline__
54 #endif
55
56 #define kmalloc(x,flags) yaffsfs_malloc(x)
57 #define kfree(x)   yaffsfs_free(x)
58 #define vmalloc(x) yaffsfs_malloc(x)
59 #define vfree(x) yaffsfs_free(x)
60
61 #define cond_resched()  do {} while(0)
62
63 #define yaffs_trace(msk, fmt, ...) do { \
64         if(yaffs_trace_mask & (msk)) \
65                 printf("yaffs: " fmt "\n", ##__VA_ARGS__); \
66 } while(0)
67
68
69 #define YAFFS_LOSTNFOUND_NAME           "lost+found"
70 #define YAFFS_LOSTNFOUND_PREFIX         "obj"
71
72 #include "yaffscfg.h"
73
74 #define Y_CURRENT_TIME yaffsfs_CurrentTime()
75 #define Y_TIME_CONVERT(x) x
76
77 #define YAFFS_ROOT_MODE                         0666
78 #define YAFFS_LOSTNFOUND_MODE           0666
79
80 #include "yaffs_list.h"
81
82 #include "yaffsfs.h"
83
84 #endif
85
86