yaffs More tests added to direct/timothy_tests/quick_tests
[yaffs2.git] / yportenv_single.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 #ifndef __YPORTENV_LINUX_H__
17 #define __YPORTENV_LINUX_H__
18
19 #include <linux/version.h>
20 #include <linux/kernel.h>
21 #include <linux/mm.h>
22 #include <linux/sched.h>
23 #include <linux/string.h>
24 #include <linux/slab.h>
25 #include <linux/vmalloc.h>
26 #include <linux/xattr.h>
27 #include <linux/list.h>
28 #include <linux/types.h>
29 #include <linux/fs.h>
30 #include <linux/stat.h>
31 #include <linux/sort.h>
32
33 #define YCHAR char
34 #define YUCHAR unsigned char
35 #define _Y(x)     x
36 #define yaffs_strcat(a, b)     strcat(a, b)
37 #define yaffs_strcpy(a, b)     strcpy(a, b)
38 #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
39 #define yaffs_strncmp(a, b, c) strncmp(a, b, c)
40 #define yaffs_strnlen(s,m)      strnlen(s,m)
41 #define yaffs_sprintf          sprintf
42 #define yaffs_toupper(a)       toupper(a)
43
44 #define yaffs_sort(base, n, sz, cmp_fn) sort(base, n, sz, cmp_fn, NULL)
45
46 #define Y_INLINE __inline__
47
48 #define YAFFS_LOSTNFOUND_NAME           "lost+found"
49 #define YAFFS_LOSTNFOUND_PREFIX         "obj"
50
51 #define YMALLOC(x) kmalloc(x, GFP_NOFS)
52 #define YFREE(x)   kfree(x)
53 #define YMALLOC_ALT(x) vmalloc(x)
54 #define YFREE_ALT(x)   vfree(x)
55 #define YMALLOC_DMA(x) YMALLOC(x)
56
57 #define YYIELD() schedule()
58 #define Y_DUMP_STACK() dump_stack()
59
60 #define YAFFS_ROOT_MODE                 0755
61 #define YAFFS_LOSTNFOUND_MODE           0700
62
63 #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
64 #define Y_TIME_CONVERT(x) (x).tv_sec
65
66 #define yaffs_sum_cmp(x, y) ((x) == (y))
67 #define yaffs_strcmp(a, b) strcmp(a, b)
68
69 #define TENDSTR "\n"
70 #define TSTR(x) KERN_DEBUG x
71 #define TCONT(x) x
72 #define TOUT(p) printk p
73
74 #define compile_time_assertion(assertion) \
75         ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
76
77 #ifndef Y_DUMP_STACK
78 #define Y_DUMP_STACK() do { } while (0)
79 #endif
80
81 #ifndef YBUG
82 #define YBUG() do {\
83         T(YAFFS_TRACE_BUG,\
84                 (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\
85                 __LINE__));\
86         Y_DUMP_STACK();\
87 } while (0)
88 #endif
89
90 #endif