ref: 0d951d61e5ae9c64091daf6f469dc71af6175daf
parent: 5819cc9f59fa39a85405b704d04540a31fa4b83f
author: gkostka <[email protected]>
date: Fri Oct 16 12:40:40 EDT 2015
Add CONFIG_EXTENT_FULL compilation flag This switch decides which extent implementation will be chosen to compile.
--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -142,6 +142,11 @@
#define CONFIG_HAVE_OWN_OFLAGS 0
#endif
+/**@brief Use full extent implemrntation*/
+#ifndef CONFIG_EXTENT_FULL
+#define CONFIG_EXTENT_FULL 1
+#endif
+
#ifdef __GNUC__
#ifndef __unused
#define __unused __attribute__ ((__unused__))
--- a/lwext4/ext4_extent.c
+++ b/lwext4/ext4_extent.c
@@ -49,6 +49,8 @@
#include <string.h>
#include <stdlib.h>
+#if !CONFIG_EXTENT_FULL
+
uint32_t ext4_extent_get_first_block(struct ext4_extent *extent)
{
return to_le32(extent->first_block);
@@ -988,6 +990,7 @@
return rc;
}
+#endif
/**
* @}
*/
--- a/lwext4/ext4_extent.h
+++ b/lwext4/ext4_extent.h
@@ -44,6 +44,8 @@
#include "ext4_config.h"
#include "ext4_types.h"
+#if !CONFIG_EXTENT_FULL
+
/**@brief Get logical number of the block covered by extent.
* @param extent Extent to load number from
* @return Logical number of the first block covered by extent */
@@ -183,7 +185,9 @@
int ext4_extent_append_block(struct ext4_inode_ref *inode_ref, uint32_t *iblock,
uint32_t *fblock, bool update_size);
+#endif
+
#endif /* EXT4_EXTENT_H_ */
- /**
- * @}
- */
+/**
+* @}
+*/
--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -26,6 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "ext4_config.h"
#include "ext4_blockdev.h"
#include "ext4_super.h"
#include "ext4_balloc.h"
@@ -36,8 +37,10 @@
#include <inttypes.h>
#include <stddef.h>
-#include "ext4_extent.h"
+#include "ext4_extent_full.h"
+#if CONFIG_EXTENT_FULL
+
/*
* used by extent splitting.
*/
@@ -1762,3 +1765,4 @@
return err;
}
+#endif
--- a/lwext4/ext4_extent_full.h
+++ b/lwext4/ext4_extent_full.h
@@ -32,6 +32,7 @@
#include "ext4_config.h"
#include "ext4_types.h"
+#if CONFIG_EXTENT_FULL
int ext4_ext_get_blocks(struct ext4_inode_ref *inode_ref, ext4_fsblk_t iblock,
uint32_t max_blocks, ext4_fsblk_t *result, bool create,
uint32_t *blocks_count);
@@ -40,5 +41,6 @@
int ext4_ext_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
ext4_lblk_t to);
+#endif
#endif /* EXT4_EXTENT_H_ */