ext4_config.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com)
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * - Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * - Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * - The name of the author may not be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. /** @addtogroup lwext4
  29. * @{
  30. */
  31. /**
  32. * @file ext4_config.h
  33. * @brief Configuration file.
  34. */
  35. #ifndef EXT4_CONFIG_H_
  36. #define EXT4_CONFIG_H_
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if !CONFIG_USE_DEFAULT_CFG
  41. #include "generated/ext4_config.h"
  42. #endif
  43. /*****************************************************************************/
  44. #define F_SET_EXT2 2
  45. #define F_SET_EXT3 3
  46. #define F_SET_EXT4 4
  47. #ifndef CONFIG_EXT_FEATURE_SET_LVL
  48. #define CONFIG_EXT_FEATURE_SET_LVL F_SET_EXT4
  49. #endif
  50. /*****************************************************************************/
  51. #if CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT2
  52. /*Superblock features flag EXT2*/
  53. #define CONFIG_SUPPORTED_FCOM EXT2_SUPPORTED_FCOM
  54. #define CONFIG_SUPPORTED_FINCOM (EXT2_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
  55. #define CONFIG_SUPPORTED_FRO_COM EXT2_SUPPORTED_FRO_COM
  56. #elif CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT3
  57. /*Superblock features flag EXT3*/
  58. #define CONFIG_SUPPORTED_FCOM EXT3_SUPPORTED_FCOM
  59. #define CONFIG_SUPPORTED_FINCOM (EXT3_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
  60. #define CONFIG_SUPPORTED_FRO_COM EXT3_SUPPORTED_FRO_COM
  61. #elif CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT4
  62. /*Superblock features flag EXT4*/
  63. #define CONFIG_SUPPORTED_FCOM EXT4_SUPPORTED_FCOM
  64. #define CONFIG_SUPPORTED_FINCOM (EXT4_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
  65. #define CONFIG_SUPPORTED_FRO_COM EXT4_SUPPORTED_FRO_COM
  66. #else
  67. #define "Unsupported CONFIG_EXT_FEATURE_SET_LVL"
  68. #endif
  69. #define CONFIG_DIR_INDEX_ENABLE (CONFIG_SUPPORTED_FCOM & EXT4_FCOM_DIR_INDEX)
  70. #define CONFIG_EXTENT_ENABLE (CONFIG_SUPPORTED_FINCOM & EXT4_FINCOM_EXTENTS)
  71. #define CONFIG_META_CSUM_ENABLE (CONFIG_SUPPORTED_FRO_COM & EXT4_FRO_COM_METADATA_CSUM)
  72. /*****************************************************************************/
  73. /**@brief Enable/disable journaling*/
  74. #ifndef CONFIG_JOURNALING_ENABLE
  75. #define CONFIG_JOURNALING_ENABLE 1
  76. #endif
  77. /**@brief Enable/disable xattr*/
  78. #ifndef CONFIG_XATTR_ENABLE
  79. #define CONFIG_XATTR_ENABLE 1
  80. #endif
  81. /**@brief Enable/disable extents*/
  82. #ifndef CONFIG_EXTENTS_ENABLE
  83. #define CONFIG_EXTENTS_ENABLE 1
  84. #endif
  85. /**@brief Include error codes from ext4_errno or standard library.*/
  86. #ifndef CONFIG_HAVE_OWN_ERRNO
  87. #define CONFIG_HAVE_OWN_ERRNO 0
  88. #endif
  89. /**@brief Debug printf enable (stdout)*/
  90. #ifndef CONFIG_DEBUG_PRINTF
  91. #define CONFIG_DEBUG_PRINTF 1
  92. #endif
  93. /**@brief Assert printf enable (stdout)*/
  94. #ifndef CONFIG_DEBUG_ASSERT
  95. #define CONFIG_DEBUG_ASSERT 1
  96. #endif
  97. /**@brief Include assert codes from ext4_debug or standard library.*/
  98. #ifndef CONFIG_HAVE_OWN_ASSERT
  99. #define CONFIG_HAVE_OWN_ASSERT 1
  100. #endif
  101. /**@brief Statistics of block device*/
  102. #ifndef CONFIG_BLOCK_DEV_ENABLE_STATS
  103. #define CONFIG_BLOCK_DEV_ENABLE_STATS 1
  104. #endif
  105. /**@brief Cache size of block device.*/
  106. #ifndef CONFIG_BLOCK_DEV_CACHE_SIZE
  107. #define CONFIG_BLOCK_DEV_CACHE_SIZE 8
  108. #endif
  109. /**@brief Maximum block device name*/
  110. #ifndef CONFIG_EXT4_MAX_BLOCKDEV_NAME
  111. #define CONFIG_EXT4_MAX_BLOCKDEV_NAME 32
  112. #endif
  113. /**@brief Maximum block device count*/
  114. #ifndef CONFIG_EXT4_BLOCKDEVS_COUNT
  115. #define CONFIG_EXT4_BLOCKDEVS_COUNT 4
  116. #endif
  117. /**@brief Maximum mountpoint name*/
  118. #ifndef CONFIG_EXT4_MAX_MP_NAME
  119. #define CONFIG_EXT4_MAX_MP_NAME 32
  120. #endif
  121. /**@brief Maximum mountpoint count*/
  122. #ifndef CONFIG_EXT4_MOUNTPOINTS_COUNT
  123. #define CONFIG_EXT4_MOUNTPOINTS_COUNT 20
  124. #endif
  125. /**@brief Include open flags from ext4_errno or standard library.*/
  126. #ifndef CONFIG_HAVE_OWN_OFLAGS
  127. #define CONFIG_HAVE_OWN_OFLAGS 1
  128. #endif
  129. /**@brief Maximum single truncate size. Transactions must be limited to reduce
  130. * number of allocetions for single transaction*/
  131. #ifndef CONFIG_MAX_TRUNCATE_SIZE
  132. #define CONFIG_MAX_TRUNCATE_SIZE (16ul * 1024ul * 1024ul)
  133. #endif
  134. /**@brief Unaligned access switch on/off*/
  135. #ifndef CONFIG_UNALIGNED_ACCESS
  136. #define CONFIG_UNALIGNED_ACCESS 0
  137. #endif
  138. /**@brief Switches use of malloc/free functions family
  139. * from standard library to user provided*/
  140. #ifndef CONFIG_USE_USER_MALLOC
  141. #define CONFIG_USE_USER_MALLOC 0
  142. #endif
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #endif /* EXT4_CONFIG_H_ */
  147. /**
  148. * @}
  149. */