shithub: lwext4

Download patch

ref: b251c6d77850d6996f6262c80bb04b05196ac446
parent: 81dd784e161c12620eba3ce5c9684512d27390a6
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Oct 28 21:20:44 EDT 2014

Move some simple functions to c file (no need to public)

--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -45,6 +45,147 @@
 #include <string.h>
 #include <stdlib.h>
 
+/**@brief Get hash version used in directory index.
+ * @param root_info Pointer to root info structure of index
+ * @return Hash algorithm version
+ */
+static inline uint8_t ext4_dir_dx_root_info_get_hash_version(
+    struct ext4_directory_dx_root_info *root_info)
+{
+    return root_info->hash_version;
+}
+
+/**@brief Set hash version, that will be used in directory index.
+ * @param root_info Pointer to root info structure of index
+ * @param v Hash algorithm version
+ */
+static inline void ext4_dir_dx_root_info_set_hash_version(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t v)
+{
+    root_info->hash_version = v;
+}
+
+/**@brief Get length of root_info structure in bytes.
+ * @param root_info Pointer to root info structure of index
+ * @return Length of the structure
+ */
+static inline uint8_t ext4_dir_dx_root_info_get_info_length(
+    struct ext4_directory_dx_root_info *root_info)
+{
+    return root_info->info_length;
+}
+
+/**@brief Set length of root_info structure in bytes.
+ * @param root_info   Pointer to root info structure of index
+ * @param info_length Length of the structure
+ */
+static inline void ext4_dir_dx_root_info_set_info_length(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t len)
+{
+    root_info->info_length = len;
+}
+
+/**@brief Get number of indirect levels of HTree.
+ * @param root_info Pointer to root info structure of index
+ * @return Height of HTree (actually only 0 or 1)
+ */
+static inline uint8_t ext4_dir_dx_root_info_get_indirect_levels(
+    struct ext4_directory_dx_root_info *root_info)
+{
+    return root_info->indirect_levels;
+}
+
+/**@brief Set number of indirect levels of HTree.
+ * @param root_info Pointer to root info structure of index
+ * @param lvl Height of HTree (actually only 0 or 1)
+ */
+static inline void ext4_dir_dx_root_info_set_indirect_levels(
+    struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
+{
+    root_info->indirect_levels = lvl;
+}
+
+/**@brief Get maximum number of index node entries.
+ * @param climit Pointer to counlimit structure
+ * @return Maximum of entries in node
+ */
+static inline uint16_t ext4_dir_dx_countlimit_get_limit(
+    struct ext4_directory_dx_countlimit *climit)
+{
+    return to_le16(climit->limit);
+}
+
+/**@brief Set maximum number of index node entries.
+ * @param climit Pointer to counlimit structure
+ * @param limit Maximum of entries in node
+ */
+static inline void ext4_dir_dx_countlimit_set_limit(
+    struct ext4_directory_dx_countlimit *climit, uint16_t limit)
+{
+    climit->limit = to_le16(limit);
+}
+
+
+/**@brief Get current number of index node entries.
+ * @param climit Pointer to counlimit structure
+ * @return Number of entries in node
+ */
+static inline uint16_t ext4_dir_dx_countlimit_get_count(
+    struct ext4_directory_dx_countlimit *climit)
+{
+    return to_le16(climit->count);
+}
+
+/**@brief Set current number of index node entries.
+ * @param climit Pointer to counlimit structure
+ * @param count Number of entries in node
+ */
+static inline void ext4_dir_dx_countlimit_set_count(
+    struct ext4_directory_dx_countlimit *climit, uint16_t count)
+{
+    climit->count = to_le16(count);
+}
+
+/**@brief Get hash value of index entry.
+ * @param entry Pointer to index entry
+ * @return Hash value
+ */
+static inline uint32_t ext4_dir_dx_entry_get_hash(
+    struct ext4_directory_dx_entry *entry)
+{
+    return to_le32(entry->hash);
+}
+
+/**@brief Set hash value of index entry.
+ * @param entry Pointer to index entry
+ * @param hash  Hash value
+ */
+static inline void ext4_dir_dx_entry_set_hash(
+    struct ext4_directory_dx_entry *entry, uint32_t hash)
+{
+    entry->hash = to_le32(hash);
+}
+
+/**@brief Get block address where child node is located.
+ * @param entry Pointer to index entry
+ * @return Block address of child node
+ */
+static inline uint32_t ext4_dir_dx_entry_get_block(
+    struct ext4_directory_dx_entry *entry)
+{
+    return to_le32(entry->block);
+}
+
+/**@brief Set block address where child node is located.
+ * @param entry Pointer to index entry
+ * @param block Block address of child node
+ */
+static inline void ext4_dir_dx_entry_set_block(
+    struct ext4_directory_dx_entry *entry, uint32_t block)
+{
+    entry->block = to_le32(block);
+}
+
 /**@brief Sort entry item.*/
 struct ext4_dx_sort_entry {
     uint32_t hash;
--- a/lwext4/ext4_dir_idx.h
+++ b/lwext4/ext4_dir_idx.h
@@ -48,148 +48,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-
-/**@brief Get hash version used in directory index.
- * @param root_info Pointer to root info structure of index
- * @return Hash algorithm version
- */
-static inline uint8_t ext4_dir_dx_root_info_get_hash_version(
-    struct ext4_directory_dx_root_info *root_info)
-{
-    return root_info->hash_version;
-}
-
-/**@brief Set hash version, that will be used in directory index.
- * @param root_info Pointer to root info structure of index
- * @param v Hash algorithm version
- */
-static inline void ext4_dir_dx_root_info_set_hash_version(
-    struct ext4_directory_dx_root_info  *root_info, uint8_t v)
-{
-    root_info->hash_version = v;
-}
-
-/**@brief Get length of root_info structure in bytes.
- * @param root_info Pointer to root info structure of index
- * @return Length of the structure
- */
-static inline uint8_t ext4_dir_dx_root_info_get_info_length(
-    struct ext4_directory_dx_root_info *root_info)
-{
-    return root_info->info_length;
-}
-
-/**@brief Set length of root_info structure in bytes.
- * @param root_info   Pointer to root info structure of index
- * @param info_length Length of the structure
- */
-static inline void ext4_dir_dx_root_info_set_info_length(
-    struct ext4_directory_dx_root_info  *root_info, uint8_t len)
-{
-    root_info->info_length = len;
-}
-
-/**@brief Get number of indirect levels of HTree.
- * @param root_info Pointer to root info structure of index
- * @return Height of HTree (actually only 0 or 1)
- */
-static inline uint8_t ext4_dir_dx_root_info_get_indirect_levels(
-    struct ext4_directory_dx_root_info *root_info)
-{
-    return root_info->indirect_levels;
-}
-
-/**@brief Set number of indirect levels of HTree.
- * @param root_info Pointer to root info structure of index
- * @param lvl Height of HTree (actually only 0 or 1)
- */
-static inline void ext4_dir_dx_root_info_set_indirect_levels(
-    struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
-{
-    root_info->indirect_levels = lvl;
-}
-
-/**@brief Get maximum number of index node entries.
- * @param climit Pointer to counlimit structure
- * @return Maximum of entries in node
- */
-static inline uint16_t ext4_dir_dx_countlimit_get_limit(
-    struct ext4_directory_dx_countlimit *climit)
-{
-    return to_le16(climit->limit);
-}
-
-/**@brief Set maximum number of index node entries.
- * @param climit Pointer to counlimit structure
- * @param limit Maximum of entries in node
- */
-static inline void ext4_dir_dx_countlimit_set_limit(
-    struct ext4_directory_dx_countlimit *climit, uint16_t limit)
-{
-    climit->limit = to_le16(limit);
-}
-
-
-/**@brief Get current number of index node entries.
- * @param climit Pointer to counlimit structure
- * @return Number of entries in node
- */
-static inline uint16_t ext4_dir_dx_countlimit_get_count(
-    struct ext4_directory_dx_countlimit *climit)
-{
-    return to_le16(climit->count);
-}
-
-/**@brief Set current number of index node entries.
- * @param climit Pointer to counlimit structure
- * @param count Number of entries in node
- */
-static inline void ext4_dir_dx_countlimit_set_count(
-    struct ext4_directory_dx_countlimit *climit, uint16_t count)
-{
-    climit->count = to_le16(count);
-}
-
-/**@brief Get hash value of index entry.
- * @param entry Pointer to index entry
- * @return Hash value
- */
-static inline uint32_t ext4_dir_dx_entry_get_hash(
-    struct ext4_directory_dx_entry *entry)
-{
-    return to_le32(entry->hash);
-}
-
-/**@brief Set hash value of index entry.
- * @param entry Pointer to index entry
- * @param hash  Hash value
- */
-static inline void ext4_dir_dx_entry_set_hash(
-    struct ext4_directory_dx_entry *entry, uint32_t hash)
-{
-    entry->hash = to_le32(hash);
-}
-
-/**@brief Get block address where child node is located.
- * @param entry Pointer to index entry
- * @return Block address of child node
- */
-static inline uint32_t ext4_dir_dx_entry_get_block(
-    struct ext4_directory_dx_entry *entry)
-{
-    return to_le32(entry->block);
-}
-
-/**@brief Set block address where child node is located.
- * @param entry Pointer to index entry
- * @param block Block address of child node
- */
-static inline void ext4_dir_dx_entry_set_block(
-    struct ext4_directory_dx_entry *entry, uint32_t block)
-{
-    entry->block = to_le32(block);
-}
-
 /**@brief Initialize index structure of new directory.
  * @param dir Pointer to directory i-node
  * @return Error code