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 YMALLOC(x) malloc(x)
47 #define YFREE(x) free(x)
48 #define YMALLOC_ALT(x) malloc(x)
49 #define YFREE_ALT(x) free(x)
52 #define YUCHAR unsigned char
54 #define yaffs_strcat(a, b) strcat(a, b)
55 #define yaffs_strcpy(a, b) strcpy(a, b)
56 #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
57 #define yaffs_strnlen(s,m) strnlen(s,m)
58 #define yaffs_sprintf sprintf
59 #define yaffs_toupper(a) toupper(a)
61 #define Y_INLINE inline
63 /* #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s)) */
64 /* #define YALERT(s) YINFO(s) */
68 #define TOUT(p) printf p
70 #define YAFFS_LOSTNFOUND_NAME "lost+found"
71 #define YAFFS_LOSTNFOUND_PREFIX "obj"
72 /* #define YPRINTF(x) printf x */
74 #define YAFFS_ROOT_MODE 0755
75 #define YAFFS_LOSTNFOUND_MODE 0700
77 #define yaffs_sum_cmp(x, y) ((x) == (y))
78 #define yaffs_strcmp(a, b) strcmp(a, b)
81 /* Should have specified a configuration type */
82 #error Unknown configuration
86 #if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
88 #ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
111 #define O_TRUNC 01000
115 #define O_APPEND 02000
183 #define ENAMETOOLONG 36
206 #define S_IFMT 0170000
210 #define S_IFLNK 0120000
214 #define S_IFDIR 0040000
218 #define S_IFREG 0100000
222 #define S_IREAD 0000400
226 #define S_IWRITE 0000200
230 #define S_IEXEC 0000100
234 #define XATTR_CREATE 1
237 #ifndef XATTR_REPLACE
238 #define XATTR_REPLACE 2
250 #include <sys/stat.h>
257 #define Y_DUMP_STACK() do { } while (0)
263 (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\
273 * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
275 * Copyright (C) 2002-2010 Aleph One Ltd.
276 * for Toby Churchill Ltd and Brightstar Engineering
278 * Created by Charles Manning <charles@aleph1.co.uk>
280 * This program is free software; you can redistribute it and/or modify
281 * it under the terms of the GNU Lesser General Public License version 2.1 as
282 * published by the Free Software Foundation.
284 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
288 * This file is just holds extra declarations of macros that would normally
289 * be provided in the Linux kernel. These macros have been written from
290 * scratch but are functionally equivalent to the Linux ones.
298 /* Definition of types */
299 typedef unsigned char u8;
300 typedef unsigned short u16;
301 typedef unsigned u32;
305 #include <sys/stat.h>
309 #ifdef CONFIG_YAFFS_PROVIDE_DEFS
325 #include <sys/stat.h>
329 * Attribute flags. These should be or-ed together to figure out what
336 #define ATTR_ATIME 16
337 #define ATTR_MTIME 32
338 #define ATTR_CTIME 64
341 unsigned int ia_valid;
349 unsigned int ia_attr_flags;