yportenv.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
  3. *
  4. * Copyright (C) 2002-2011 Aleph One Ltd.
  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. #ifndef __YPORTENV_H__
  16. #define __YPORTENV_H__
  17. /*
  18. * Define the MTD version in terms of Linux Kernel versions
  19. * This allows yaffs to be used independantly of the kernel
  20. * as well as with it.
  21. */
  22. #define MTD_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
  23. #ifdef YAFFS_OUT_OF_TREE
  24. #include "moduleconfig.h"
  25. #endif
  26. #include <linux/version.h>
  27. #define MTD_VERSION_CODE LINUX_VERSION_CODE
  28. #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
  29. #include <linux/config.h>
  30. #endif
  31. #include <linux/version.h>
  32. #include <linux/kernel.h>
  33. #include <linux/mm.h>
  34. #include <linux/sched.h>
  35. #include <linux/string.h>
  36. #include <linux/slab.h>
  37. #include <linux/vmalloc.h>
  38. #include <linux/xattr.h>
  39. #include <linux/list.h>
  40. #include <linux/types.h>
  41. #include <linux/fs.h>
  42. #include <linux/stat.h>
  43. #include <linux/sort.h>
  44. #include <linux/bitops.h>
  45. /* These type wrappings are used to support Unicode names in WinCE. */
  46. #define YCHAR char
  47. #define YUCHAR unsigned char
  48. #define _Y(x) x
  49. #define YAFFS_LOSTNFOUND_NAME "lost+found"
  50. #define YAFFS_LOSTNFOUND_PREFIX "obj"
  51. #define YAFFS_ROOT_MODE 0755
  52. #define YAFFS_LOSTNFOUND_MODE 0700
  53. #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
  54. #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
  55. #define Y_TIME_CONVERT(x) (x).tv_sec
  56. #else
  57. #define Y_CURRENT_TIME CURRENT_TIME
  58. #define Y_TIME_CONVERT(x) (x)
  59. #endif
  60. #define compile_time_assertion(assertion) \
  61. ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
  62. #define yaffs_printf(msk, fmt, ...) \
  63. printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__)
  64. #define yaffs_trace(msk, fmt, ...) do { \
  65. if (yaffs_trace_mask & (msk)) \
  66. printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \
  67. } while (0)
  68. #endif