2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 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.
16 #ifndef __YPORTENV_LINUX_H__
17 #define __YPORTENV_LINUX_H__
19 #include <linux/version.h>
20 #include <linux/kernel.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>
30 #include <linux/stat.h>
31 #include <linux/sort.h>
32 #include <linux/bitops.h>
35 #define YUCHAR unsigned char
37 #define yaffs_strcat(a, b) strcat(a, b)
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_strnlen(s,m) strnlen(s,m)
42 #define yaffs_sprintf sprintf
43 #define yaffs_toupper(a) toupper(a)
45 #define yaffs_sort(base, n, sz, cmp_fn) sort(base, n, sz, cmp_fn, NULL)
47 #define Y_INLINE __inline__
49 #define YAFFS_LOSTNFOUND_NAME "lost+found"
50 #define YAFFS_LOSTNFOUND_PREFIX "obj"
52 #define YMALLOC(x) kmalloc(x, GFP_NOFS)
53 #define YFREE(x) kfree(x)
54 #define YMALLOC_ALT(x) vmalloc(x)
55 #define YFREE_ALT(x) vfree(x)
56 #define YMALLOC_DMA(x) YMALLOC(x)
58 #define YYIELD() schedule()
59 #define Y_DUMP_STACK() dump_stack()
61 #define YAFFS_ROOT_MODE 0755
62 #define YAFFS_LOSTNFOUND_MODE 0700
64 #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
65 #define Y_TIME_CONVERT(x) (x).tv_sec
67 #define yaffs_sum_cmp(x, y) ((x) == (y))
68 #define yaffs_strcmp(a, b) strcmp(a, b)
71 #define TSTR(x) KERN_DEBUG x
73 #define TOUT(p) printk p
75 #define compile_time_assertion(assertion) \
76 ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
79 #define Y_DUMP_STACK() do { } while (0)
85 (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\