yaffs-vfs-multi.c: Handle search context properly to prevent leaking
[yaffs2.git] / yportenv_single.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2018 Aleph One Ltd.
5  *
6  * Created by Charles Manning <charles@aleph1.co.uk>
7  *
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.
11  *
12  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
13  */
14
15 #ifndef __YPORTENV_LINUX_H__
16 #define __YPORTENV_LINUX_H__
17
18 #include <linux/version.h>
19 #include <linux/kernel.h>
20 #include <linux/mm.h>
21 #include <linux/sched.h>
22 #include <linux/string.h>
23 #include <linux/slab.h>
24 #include <linux/vmalloc.h>
25 #include <linux/xattr.h>
26 #include <linux/list.h>
27 #include <linux/types.h>
28 #include <linux/fs.h>
29 #include <linux/stat.h>
30 #include <linux/sort.h>
31 #include <linux/bitops.h>
32
33 /*  These type wrappings are used to support Unicode names in WinCE. */
34 #define YCHAR char
35 #define YUCHAR unsigned char
36 #define _Y(x)     x
37
38 #define YAFFS_LOSTNFOUND_NAME           "lost+found"
39 #define YAFFS_LOSTNFOUND_PREFIX         "obj"
40
41
42 #define YAFFS_ROOT_MODE                 0755
43 #define YAFFS_LOSTNFOUND_MODE           0700
44
45 #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
46 #define Y_TIME_CONVERT(x) (x).tv_sec
47
48 #define compile_time_assertion(assertion) \
49         ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
50
51 #define yaffs_printf(msk, fmt, ...) \
52         printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__)
53
54 #ifdef CONFIG_YAFFS_DEBUG
55 #define yaffs_trace(msk, fmt, ...) do { \
56         if (yaffs_trace_mask & (msk)) \
57                 printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
58 } while (0)
59 #else
60 #define yaffs_trace(msk, fmt, ...) do { \
61 } while (0)
62 #endif
63
64 #endif