William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 1 | /* |
Wolfgang Denk | 74e0dde | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 2 | * YAFFS: Yet another Flash File System . A NAND-flash specific file system. |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 3 | * |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 4 | * Copyright (C) 2002-2011 Aleph One Ltd. |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 5 | * for Toby Churchill Ltd and Brightstar Engineering |
| 6 | * |
| 7 | * Created by Charles Manning <charles@aleph1.co.uk> |
| 8 | * |
| 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. |
| 12 | * |
| 13 | * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. |
| 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * ydirectenv.h: Environment wrappers for YAFFS direct. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __YDIRECTENV_H__ |
| 21 | #define __YDIRECTENV_H__ |
| 22 | |
Charles Manning | 4f28fc2 | 2012-08-14 18:26:10 +0000 | [diff] [blame] | 23 | #include <malloc.h> |
| 24 | #include <linux/compat.h> |
| 25 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 26 | #include "yaffs_osglue.h" |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 27 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 28 | void yaffs_bug_fn(const char *file_name, int line_no); |
| 29 | |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 30 | #define YCHAR char |
| 31 | #define YUCHAR unsigned char |
| 32 | #define _Y(x) x |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 33 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 34 | #define yaffs_strcat(a, b) strcat(a, b) |
| 35 | #define yaffs_strcpy(a, b) strcpy(a, b) |
| 36 | #define yaffs_strncpy(a, b, c) strncpy(a, b, c) |
| 37 | #define yaffs_strnlen(s, m) strnlen(s, m) |
| 38 | #ifdef CONFIG_YAFFS_CASE_INSENSITIVE |
| 39 | #define yaffs_strcmp(a, b) strcasecmp(a, b) |
| 40 | #define yaffs_strncmp(a, b, c) strncasecmp(a, b, c) |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 41 | #else |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 42 | #define yaffs_strcmp(a, b) strcmp(a, b) |
| 43 | #define yaffs_strncmp(a, b, c) strncmp(a, b, c) |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 44 | #endif |
| 45 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 46 | void yaffs_qsort(void *aa, size_t n, size_t es, |
| 47 | int (*cmp)(const void *, const void *)); |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 48 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 49 | #define sort(base, n, sz, cmp_fn, swp) yaffs_qsort(base, n, sz, cmp_fn) |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 50 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 51 | #define YAFFS_PATH_DIVIDERS "/" |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 52 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 53 | #ifdef NO_inline |
| 54 | #define inline |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 55 | #endif |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 56 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 57 | #define yaffs_trace(msk, fmt, ...) do { \ |
| 58 | if (yaffs_trace_mask & (msk)) \ |
| 59 | printf("yaffs: " fmt "\n", ##__VA_ARGS__); \ |
| 60 | } while (0) |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 61 | |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 62 | #define YAFFS_LOSTNFOUND_NAME "lost+found" |
| 63 | #define YAFFS_LOSTNFOUND_PREFIX "obj" |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 64 | |
| 65 | #include "yaffscfg.h" |
| 66 | |
| 67 | #define Y_CURRENT_TIME yaffsfs_CurrentTime() |
| 68 | #define Y_TIME_CONVERT(x) x |
| 69 | |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 70 | #define YAFFS_ROOT_MODE 0666 |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 71 | #define YAFFS_LOSTNFOUND_MODE 0666 |
| 72 | |
Masahiro Yamada | adae2ec | 2016-09-21 11:28:53 +0900 | [diff] [blame] | 73 | #include <linux/list.h> |
Charles Manning | 3796e1f | 2012-05-09 16:55:17 +0000 | [diff] [blame] | 74 | |
| 75 | #include "yaffsfs.h" |
William Juul | c051bbe | 2007-11-15 11:13:05 +0100 | [diff] [blame] | 76 | |
| 77 | #endif |