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 * ydirectenv.h: Environment wrappers for YAFFS direct.
19 #ifndef __YDIRECTENV_H__
20 #define __YDIRECTENV_H__
25 #include "yaffs_osglue.h"
26 #include "yaffs_hweight.h"
28 void yaffs_bug_fn(const char *file_name, int line_no);
30 #define BUG() do { yaffs_bug_fn(__FILE__, __LINE__); } while (0)
32 #ifdef YAFFS_USE_32_BIT_TIME_T
39 #define YUCHAR unsigned char
43 #define Y_LOFF_T loff_t
46 /* Some RTOSs (eg. VxWorks) need strnlen. */
47 size_t strnlen(const char *s, size_t maxlen);
49 #define yaffs_strcat(a, b) strcat(a, b)
50 #define yaffs_strcpy(a, b) strcpy(a, b)
51 #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
52 #define yaffs_strnlen(s, m) strnlen(s, m)
53 #ifdef CONFIG_YAFFS_CASE_INSENSITIVE
54 #define yaffs_strcmp(a, b) strcasecmp(a, b)
55 #define yaffs_strncmp(a, b, c) strncasecmp(a, b, c)
57 #define yaffs_strcmp(a, b) strcmp(a, b)
58 #define yaffs_strncmp(a, b, c) strncmp(a, b, c)
61 #define hweight8(x) yaffs_hweight8(x)
62 #define hweight32(x) yaffs_hweight32(x)
64 #define sort(base, n, sz, cmp_fn, swp) qsort(base, n, sz, cmp_fn)
66 #define YAFFS_PATH_DIVIDERS "/"
71 #define inline __inline__
74 #define kmalloc(x, flags) yaffsfs_malloc(x)
75 #define kfree(x) yaffsfs_free(x)
76 #define vmalloc(x) yaffsfs_malloc(x)
77 #define vfree(x) yaffsfs_free(x)
79 #define cond_resched() do {} while (0)
81 #ifdef CONFIG_YAFFS_NO_TRACE
82 #define yaffs_trace(...) do { } while (0)
84 #define yaffs_trace(msk, fmt, ...) do { \
85 if (yaffs_trace_mask & (msk)) \
86 printf("yaffs: " fmt "\n", ##__VA_ARGS__); \
91 #define YAFFS_LOSTNFOUND_NAME "lost+found"
92 #define YAFFS_LOSTNFOUND_PREFIX "obj"
96 #define Y_CURRENT_TIME yaffsfs_CurrentTime()
97 #define Y_TIME_CONVERT(x) x
99 #define YAFFS_ROOT_MODE 0666
100 #define YAFFS_LOSTNFOUND_MODE 0666
102 #include "yaffs_list.h"