2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
\r
3 * yportenv.h: Portable services used by yaffs. This is done to allow
\r
4 * simple migration from kernel space into app space for testing.
\r
6 * Copyright (C) 2002 Aleph One Ltd.
\r
7 * for Toby Churchill Ltd and Brightstar Engineering
\r
9 * Created by Charles Manning <charles@aleph1.co.uk>
\r
11 * This program is free software; you can redistribute it and/or modify
\r
12 * it under the terms of the GNU General Public License version 2 as
\r
13 * published by the Free Software Foundation.
\r
17 #ifndef __PORTENV_H__
\r
18 #define __PORTENV_H__
\r
28 #define YMALLOC(x) malloc(x)
\r
29 #define YFREE(x) free(x)
\r
32 #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
\r
33 #define YALERT(s) YINFO(s)
\r
35 #include <windows.h>
\r
37 #define YAFFS_LOSTNFOUND_NAME "LOST-N-FOUND"
\r
38 #define YAFFS_LOSTNFOUND_PREFIX "OBJ"
\r
42 // Always pass the sum compare to overcome the case insensitivity issue
\r
43 #define yaffs_SumCompare(x,y) 1
\r
44 #define yaffs_strcmp(a,b) _stricmp(a,b)
\r
47 #define u_char unsigned char
\r
49 #define S_IFDIR 04000
\r
51 #define S_ISFIFO(x) 0
\r
52 #define S_ISCHR(x) 0
\r
53 #define S_ISBLK(x) 0
\r
54 #define S_ISSOCK(x) 0
\r
56 extern unsigned yfsd_U32FileTimeNow(void);
\r
58 #define CURRENT_TIME yfsd_U32FileTimeNow()
\r
59 #define YAFFS_ROOT_MODE FILE_ATTRIBUTE_ARCHIVE
\r
62 #define TENDSTR "\r\n"
\r
63 #define TSTR(x) TEXT(x)
\r
64 #define T(x) RETAILMSG(1, x)
\r
67 #elif defined __KERNEL__
\r
72 #include "linux/kernel.h"
\r
73 #include "linux/mm.h"
\r
74 #include "linux/string.h"
\r
75 #include "linux/slab.h"
\r
76 #define YAFFS_LOSTNFOUND_NAME "lost+found"
\r
77 #define YAFFS_LOSTNFOUND_PREFIX "obj"
\r
79 #define YPRINTF(x) printk x
\r
80 #define YMALLOC(x) kmalloc(x,GFP_KERNEL)
\r
81 #define YFREE(x) kfree(x)
\r
83 #define YAFFS_ROOT_MODE 0666
\r
86 #define yaffs_SumCompare(x,y) ((x) == (y))
\r
87 #define yaffs_strcmp(a,b) strcmp(a,b)
\r
89 #define TENDSTR "\n"
\r
90 #define TSTR(x) KERN_DEBUG x
\r
91 #define T(x) printk x
\r
96 // Linux application
\r
101 #define YMALLOC(x) malloc(x)
\r
102 #define YFREE(x) free(x)
\r
105 #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s))
\r
106 #define YALERT(s) YINFO(s)
\r
109 #define TENDSTR "\n"
\r
111 #define T(x) printf x
\r
114 #define YAFFS_LOSTNFOUND_NAME "lost+found"
\r
115 #define YAFFS_LOSTNFOUND_PREFIX "obj"
\r
116 #define YPRINTF(x) printf x
\r
118 #define CURRENT_TIME 0
\r
119 #define YAFFS_ROOT_MODE 0666
\r
121 #define yaffs_SumCompare(x,y) ((x) == (y))
\r
122 #define yaffs_strcmp(a,b) strcmp(a,b)
\r
131 #define YINFO(s) YPRINTF((KERN_DEBUG __FILE__ " %d %s\n",__LINE__,s))
\r
132 #define YALERT(s) YINFO(s)
\r