2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
4 * Copyright (C) 2002-2018 Aleph One Ltd.
6 * Created by Charles Manning <charles@aleph1.co.uk>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License version 2.1 as
10 * published by the Free Software Foundation.
12 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
16 #ifndef __YPORTENV_H__
17 #define __YPORTENV_H__
22 #include <sys/types.h>
27 #define CONFIG_YAFFS_DIRECT 1
28 #define CONFIG_YAFFS_SHORT_NAMES_IN_RAM 1
29 #define CONFIG_YAFFS_YAFFS2 1
30 #define CONFIG_YAFFS_PROVIDE_DEFS 1
31 #define CONFIG_YAFFSFS_PROVIDE_VALUES 1
32 #define CONFIG_YAFFS_DEFINES_TYPES 1
33 #define CONFIG_YAFFS_USE_32_BIT_TIME_T 1
37 #endif /* __rtems__ */
39 /* Definition of types */
40 #ifdef CONFIG_YAFFS_DEFINES_TYPES
41 typedef unsigned char u8;
42 typedef unsigned short u16;
43 typedef unsigned int u32;
44 typedef unsigned long long u64;
45 typedef signed int s32;
48 #ifdef CONFIG_YAFFS_PROVIDE_DEFS
65 * These are or-ed together to select what has been changed.
76 unsigned int ia_valid;
84 unsigned int ia_attr_flags;
91 #if defined CONFIG_YAFFS_WINCE
93 #include "ywinceenv.h"
96 #elif defined CONFIG_YAFFS_DIRECT
98 /* Direct interface */
99 #include "ydirectenv.h"
101 #elif defined CONFIG_YAFFS_UTIL
103 #include "yutilsenv.h"
106 /* Should have specified a configuration type */
107 #error Unknown configuration
111 #if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
113 #ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
136 #define O_TRUNC 01000
140 #define O_APPEND 02000
208 #define ENAMETOOLONG 36
239 #define S_IFMT 0170000
243 #define S_IFSOCK 0140000
247 #define S_IFIFO 0010000
251 #define S_IFCHR 0020000
255 #define S_IFBLK 0060000
259 #define S_IFLNK 0120000
263 #define S_IFDIR 0040000
267 #define S_IFREG 0100000
271 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
274 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
277 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
280 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
283 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
286 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
289 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
294 #define S_IRUSR 0000400
298 #define S_IWUSR 0000200
302 #define S_IXUSR 0000100
306 #define S_IREAD 0000400
310 #define S_IWRITE 0000200
314 #define S_IEXEC 0000100
320 #include <sys/stat.h>
326 /* Create some less common define values if they don't exist */
328 #define XATTR_CREATE 1
331 #ifndef XATTR_REPLACE
332 #define XATTR_REPLACE 2
343 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
347 #define Y_DUMP_STACK() do { } while (0)
352 yaffs_trace(YAFFS_TRACE_BUG,\
353 "==>> yaffs bug: " __FILE__ " %d",\