2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2011 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 /* Definition of types */
22 #ifdef CONFIG_YAFFS_DEFINES_TYPES
23 typedef unsigned char u8;
24 typedef unsigned short u16;
25 typedef unsigned int u32;
26 typedef signed int s32;
30 #define YAFFS_UNUSED(x) (void)(x)
32 #ifdef CONFIG_YAFFS_PROVIDE_DEFS
49 * These are or-ed together to select what has been changed.
60 unsigned int ia_valid;
68 unsigned int ia_attr_flags;
75 #if defined CONFIG_YAFFS_WINCE
77 #include "ywinceenv.h"
80 #elif defined CONFIG_YAFFS_DIRECT
82 /* Direct interface */
83 #include "ydirectenv.h"
85 #elif defined CONFIG_YAFFS_UTIL
87 #include "yutilsenv.h"
90 /* Should have specified a configuration type */
91 #error Unknown configuration
95 #if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
97 #ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
120 #define O_TRUNC 01000
124 #define O_APPEND 02000
192 #define ENAMETOOLONG 36
223 #define S_IFMT 0170000
227 #define S_IFSOCK 0140000
231 #define S_IFIFO 0010000
235 #define S_IFCHR 0020000
239 #define S_IFBLK 0060000
243 #define S_IFLNK 0120000
247 #define S_IFDIR 0040000
251 #define S_IFREG 0100000
255 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
258 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
261 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
264 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
267 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
270 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
273 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
279 #define S_IREAD 0000400
283 #define S_IWRITE 0000200
287 #define S_IEXEC 0000100
291 #define XATTR_CREATE 1
294 #ifndef XATTR_REPLACE
295 #define XATTR_REPLACE 2
307 #include <sys/stat.h>
314 #define Y_DUMP_STACK() do { } while (0)
319 yaffs_trace(YAFFS_TRACE_BUG,\
320 "==>> yaffs bug: " __FILE__ " %d",\