ydirectenv.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. /*
  16. * ydirectenv.h: Environment wrappers for YAFFS direct.
  17. */
  18. #ifndef __YDIRECTENV_H__
  19. #define __YDIRECTENV_H__
  20. #include "stdlib.h"
  21. #include "stdio.h"
  22. #include "string.h"
  23. #include "yaffs_osglue.h"
  24. #include "yaffs_hweight.h"
  25. void yaffs_bug_fn(const char *file_name, int line_no);
  26. #define BUG() do { yaffs_bug_fn(__FILE__, __LINE__); } while (0)
  27. #define YCHAR char
  28. #define YUCHAR unsigned char
  29. #define _Y(x) x
  30. #define yaffs_strcat(a, b) strcat(a, b)
  31. #define yaffs_strcpy(a, b) strcpy(a, b)
  32. #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
  33. #define yaffs_strnlen(s, m) strnlen(s, m)
  34. #ifdef CONFIG_YAFFS_CASE_INSENSITIVE
  35. #define yaffs_strcmp(a, b) strcasecmp(a, b)
  36. #define yaffs_strncmp(a, b, c) strncasecmp(a, b, c)
  37. #else
  38. #define yaffs_strcmp(a, b) strcmp(a, b)
  39. #define yaffs_strncmp(a, b, c) strncmp(a, b, c)
  40. #endif
  41. #define hweight8(x) yaffs_hweight8(x)
  42. #define hweight32(x) yaffs_hweight32(x)
  43. void yaffs_qsort(void *aa, size_t n, size_t es,
  44. int (*cmp)(const void *, const void *));
  45. #define sort(base, n, sz, cmp_fn, swp) yaffs_qsort(base, n, sz, cmp_fn)
  46. #define YAFFS_PATH_DIVIDERS "/"
  47. #ifdef NO_inline
  48. #define inline
  49. #else
  50. #define inline __inline__
  51. #endif
  52. #define kmalloc(x, flags) yaffsfs_malloc(x)
  53. #define kfree(x) yaffsfs_free(x)
  54. #define vmalloc(x) yaffsfs_malloc(x)
  55. #define vfree(x) yaffsfs_free(x)
  56. #define cond_resched() do {} while (0)
  57. #define yaffs_trace(msk, fmt, ...) do { \
  58. if (yaffs_trace_mask & (msk)) \
  59. printf("yaffs: " fmt "\n", ##__VA_ARGS__); \
  60. } while (0)
  61. #define YAFFS_LOSTNFOUND_NAME "lost+found"
  62. #define YAFFS_LOSTNFOUND_PREFIX "obj"
  63. #include "yaffscfg.h"
  64. #define Y_CURRENT_TIME yaffsfs_CurrentTime()
  65. #define Y_TIME_CONVERT(x) x
  66. #define YAFFS_ROOT_MODE 0666
  67. #define YAFFS_LOSTNFOUND_MODE 0666
  68. #include "yaffs_list.h"
  69. #include "yaffsfs.h"
  70. #endif