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.
16 #ifndef __YPORTENV_H__
17 #define __YPORTENV_H__
20 * Define the MTD version in terms of Linux Kernel versions
21 * This allows yaffs to be used independantly of the kernel
25 #define MTD_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
27 #include "moduleconfig.h"
29 #include <linux/version.h>
30 #define MTD_VERSION_CODE LINUX_VERSION_CODE
32 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
33 #include <linux/config.h>
35 #include <linux/version.h>
36 #include <linux/kernel.h>
38 #include <linux/sched.h>
39 #include <linux/string.h>
40 #include <linux/slab.h>
41 #include <linux/vmalloc.h>
42 #include <linux/xattr.h>
43 #include <linux/list.h>
44 #include <linux/types.h>
46 #include <linux/stat.h>
47 #include <linux/sort.h>
48 #include <linux/bitops.h>
51 #define YUCHAR unsigned char
54 #define Y_INLINE __inline__
56 #define yaffs_trace(msk, fmt, ...) do { \
57 if(yaffs_trace_mask & ((msk) | YAFFS_TRACE_ALWAYS)) \
58 printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
61 #define YAFFS_LOSTNFOUND_NAME "lost+found"
62 #define YAFFS_LOSTNFOUND_PREFIX "obj"
65 #define YAFFS_ROOT_MODE 0755
66 #define YAFFS_LOSTNFOUND_MODE 0700
68 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
69 #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
70 #define Y_TIME_CONVERT(x) (x).tv_sec
72 #define Y_CURRENT_TIME CURRENT_TIME
73 #define Y_TIME_CONVERT(x) (x)
76 #define compile_time_assertion(assertion) \
77 ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
81 #define Y_DUMP_STACK() dump_stack()
86 yaffs_trace(YAFFS_TRACE_BUG,\
87 "bug " __FILE__ " %d",\