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.
17 #ifndef __YPORTENV_H__
18 #define __YPORTENV_H__
21 * Define the MTD version in terms of Linux Kernel versions
22 * This allows yaffs to be used independantly of the kernel
27 #if defined CONFIG_YAFFS_WINCE
29 #include "ywinceenv.h"
32 #elif defined CONFIG_YAFFS_DIRECT
34 /* Direct interface */
35 #include "ydirectenv.h"
37 #elif defined CONFIG_YAFFS_UTIL
39 /* Stuff for YAFFS utilities */
46 #define kmalloc(x) malloc(x)
47 #define kfree(x) free(x)
48 #define vmalloc(x) malloc(x)
49 #define vfree(x) free(x)
52 #define YUCHAR unsigned char
55 #define Y_INLINE inline
57 #define YAFFS_LOSTNFOUND_NAME "lost+found"
58 #define YAFFS_LOSTNFOUND_PREFIX "obj"
59 /* #define YPRINTF(x) printf x */
61 #define YAFFS_ROOT_MODE 0755
62 #define YAFFS_LOSTNFOUND_MODE 0700
66 /* Should have specified a configuration type */
67 #error Unknown configuration
71 #if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
73 #ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
100 #define O_APPEND 02000
168 #define ENAMETOOLONG 36
199 #define S_IFMT 0170000
203 #define S_IFLNK 0120000
207 #define S_IFDIR 0040000
211 #define S_IFREG 0100000
215 #define S_IREAD 0000400
219 #define S_IWRITE 0000200
223 #define S_IEXEC 0000100
227 #define XATTR_CREATE 1
230 #ifndef XATTR_REPLACE
231 #define XATTR_REPLACE 2
243 #include <sys/stat.h>
250 #define Y_DUMP_STACK() do { } while (0)
256 (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\
266 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
268 * Copyright (C) 2002-2010 Aleph One Ltd.
269 * for Toby Churchill Ltd and Brightstar Engineering
271 * Created by Charles Manning <charles@aleph1.co.uk>
273 * This program is free software; you can redistribute it and/or modify
274 * it under the terms of the GNU Lesser General Public License version 2.1 as
275 * published by the Free Software Foundation.
277 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
281 * This file is just holds extra declarations of macros that would normally
282 * be provided in the Linux kernel. These macros have been written from
283 * scratch but are functionally equivalent to the Linux ones.
291 /* Definition of types */
292 typedef unsigned char u8;
293 typedef unsigned short u16;
294 typedef unsigned u32;
298 #include <sys/stat.h>
302 #ifdef CONFIG_YAFFS_PROVIDE_DEFS
318 #include <sys/stat.h>
322 * Attribute flags. These should be or-ed together to figure out what
329 #define ATTR_ATIME 16
330 #define ATTR_MTIME 32
331 #define ATTR_CTIME 64
334 unsigned int ia_valid;
342 unsigned int ia_attr_flags;