2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
3 * yportenv.h: Portable services used by yaffs. This is done to allow
4 * simple migration from kernel space into app space for testing.
6 * Copyright (C) 2002 Aleph One Ltd.
7 * for Toby Churchill Ltd and Brightstar Engineering
9 * Created by Charles Manning <charles@aleph1.co.uk>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 2.1 as
13 * published by the Free Software Foundation.
16 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
18 * $Id: yportenv.h,v 1.5 2002-09-27 20:50:50 charles Exp $
33 #define YMALLOC(x) malloc(x)
34 #define YFREE(x) free(x)
37 #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
38 #define YALERT(s) YINFO(s)
42 #define YAFFS_LOSTNFOUND_NAME "LOST_CLUSTERS"
43 #define YAFFS_LOSTNFOUND_PREFIX "OBJ"
47 // Always pass the sum compare to overcome the case insensitivity issue
48 #define yaffs_SumCompare(x,y) 1
49 #define yaffs_strcmp(a,b) _stricmp(a,b)
52 #define u_char unsigned char
61 extern unsigned yfsd_U32FileTimeNow(void);
63 #define CURRENT_TIME yfsd_U32FileTimeNow()
64 #define YAFFS_ROOT_MODE FILE_ATTRIBUTE_ARCHIVE
65 #define YAFFS_LOSTNFOUND_MODE (FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN)
68 #define TENDSTR "\r\n"
69 #define TSTR(x) TEXT(x)
70 #define T(x) RETAILMSG(1, x)
73 #elif defined __KERNEL__
78 #include "linux/kernel.h"
80 #include "linux/string.h"
81 #include "linux/slab.h"
82 #define YAFFS_LOSTNFOUND_NAME "lost+found"
83 #define YAFFS_LOSTNFOUND_PREFIX "obj"
85 #define YPRINTF(x) printk x
86 #define YMALLOC(x) kmalloc(x,GFP_KERNEL)
87 #define YFREE(x) kfree(x)
89 #define YAFFS_ROOT_MODE 0666
90 #define YAFFS_LOSTNFOUND_MODE 0666
93 #define yaffs_SumCompare(x,y) ((x) == (y))
94 #define yaffs_strcmp(a,b) strcmp(a,b)
97 #define TSTR(x) KERN_DEBUG x
108 #define YMALLOC(x) malloc(x)
109 #define YFREE(x) free(x)
112 #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
113 #define YALERT(s) YINFO(s)
118 #define T(x) printf x
121 #define YAFFS_LOSTNFOUND_NAME "lost+found"
122 #define YAFFS_LOSTNFOUND_PREFIX "obj"
123 #define YPRINTF(x) printf x
125 #define CURRENT_TIME 0
126 #define YAFFS_ROOT_MODE 0666
127 #define YAFFS_LOSTNFOUND_MODE 0666
129 #define yaffs_SumCompare(x,y) ((x) == (y))
130 #define yaffs_strcmp(a,b) strcmp(a,b)
139 #define YINFO(s) YPRINTF((KERN_DEBUG __FILE__ " %d %s\n",__LINE__,s))
140 #define YALERT(s) YINFO(s)
142 #define YBUG() do{YINFO("bug");} while(0)