Add flex bg superblock helpers
[lwext4.git] / lwext4 / ext4_dir.h
index 5b65ed8725a3b46d4b102c745287eddb484cbe28..ce3896300c2843a4e81068df510fd3ab8775515f 100644 (file)
 #include <ext4_blockdev.h>\r
 #include <ext4_super.h>\r
 \r
-\r
 #include <stdint.h>\r
 \r
+/**@brief Get i-node number from directory entry.\r
+ * @param de Directory entry\r
+ * @return I-node number\r
+ */\r
 uint32_t ext4_dir_entry_ll_get_inode(struct ext4_directory_entry_ll *de);\r
 \r
+/**@brief Set i-node number to directory entry.\r
+ * @param de Directory entry\r
+ * @param inode I-node number\r
+ */\r
 void ext4_dir_entry_ll_set_inode(struct ext4_directory_entry_ll *de,\r
     uint32_t inode);\r
 \r
-\r
+/**@brief Get directory entry length.\r
+ * @param de Directory entry\r
+ * @return Entry length\r
+ */\r
 uint16_t ext4_dir_entry_ll_get_entry_length(struct ext4_directory_entry_ll *de);\r
+\r
+/**@brief Set directory entry length.\r
+ * @param de     Directory entry\r
+ * @param length Entry length\r
+ */\r
 void ext4_dir_entry_ll_set_entry_length(struct ext4_directory_entry_ll *de,\r
     uint16_t len);\r
 \r
-\r
+/**@brief Get directory entry name length.\r
+ * @param sb Superblock\r
+ * @param de Directory entry\r
+ * @return Entry name length\r
+ */\r
 uint16_t ext4_dir_entry_ll_get_name_length(struct ext4_sblock *sb,\r
     struct ext4_directory_entry_ll *de);\r
+\r
+/**@brief Set directory entry name length.\r
+ * @param sb     Superblock\r
+ * @param de     Directory entry\r
+ * @param length Entry name length\r
+ */\r
 void ext4_dir_entry_ll_set_name_length(struct ext4_sblock *sb,\r
     struct ext4_directory_entry_ll *de, uint16_t len);\r
 \r
-\r
-\r
+/**@brief Get i-node type of directory entry.\r
+ * @param sb Superblock\r
+ * @param de Directory entry\r
+ * @return I-node type (file, dir, etc.)\r
+ */\r
 uint8_t ext4_dir_entry_ll_get_inode_type(struct ext4_sblock *sb,\r
     struct ext4_directory_entry_ll *de);\r
-void   ext4_dir_entry_ll_set_inode_type(struct ext4_sblock *sb,\r
-    struct ext4_directory_entry_ll *de, uint8_t type);\r
 \r
+/**@brief Set i-node type of directory entry.\r
+ * @param sb   Superblock\r
+ * @param de   Directory entry\r
+ * @param type I-node type (file, dir, etc.)\r
+ */\r
+void ext4_dir_entry_ll_set_inode_type(struct ext4_sblock *sb,\r
+    struct ext4_directory_entry_ll *de, uint8_t type);\r
 \r
+/**@brief Initialize directory iterator.\r
+ * Set position to the first valid entry from the required position.\r
+ * @param it        Pointer to iterator to be initialized\r
+ * @param inode_ref Directory i-node\r
+ * @param pos       Position to start reading entries from\r
+ * @return Error code\r
+ */\r
 int ext4_dir_iterator_init(struct ext4_directory_iterator *it,\r
     struct ext4_inode_ref *inode_ref, uint64_t pos);\r
 \r
+/**@brief Jump to the next valid entry\r
+ * @param it Initialized iterator\r
+ * @return Error code\r
+ */\r
 int ext4_dir_iterator_next(struct ext4_directory_iterator *it);\r
+\r
+/**@brief Uninitialize directory iterator.\r
+ *        Release all allocated structures.\r
+ * @param it Iterator to be finished\r
+ * @return Error code\r
+ */\r
 int ext4_dir_iterator_fini(struct ext4_directory_iterator *it);\r
 \r
+/**@brief Write directory entry to concrete data block.\r
+ * @param sb        Superblock\r
+ * @param entry     Pointer to entry to be written\r
+ * @param entry_len Length of new entry\r
+ * @param child     Child i-node to be written to new entry\r
+ * @param name      Name of the new entry\r
+ * @param name_len  Length of entry name\r
+ */\r
 void ext4_dir_write_entry(struct ext4_sblock *sb,\r
     struct ext4_directory_entry_ll *entry, uint16_t entry_len,\r
     struct ext4_inode_ref *child,  const char *name, size_t name_len);\r
 \r
+/**@brief Add new entry to the directory.\r
+ * @param parent Directory i-node\r
+ * @param name   Name of new entry\r
+ * @param child  I-node to be referenced from new entry\r
+ * @return Error code\r
+ */\r
 int ext4_dir_add_entry(struct ext4_inode_ref *parent, const char *name,\r
-        uint32_t name_len, struct ext4_inode_ref *child);\r
-\r
+    uint32_t name_len, struct ext4_inode_ref *child);\r
+\r
+/**@brief Find directory entry with passed name.\r
+ * @param result Result structure to be returned if entry found\r
+ * @param parent Directory i-node\r
+ * @param name   Name of entry to be found\r
+ * @param name_len  Name length\r
+ * @return Error code\r
+ */\r
 int ext4_dir_find_entry(struct ext4_directory_search_result *result,\r
-        struct ext4_inode_ref *parent, const char *name, uint32_t name_len);\r
+    struct ext4_inode_ref *parent, const char *name, uint32_t name_len);\r
 \r
+/**@brief Remove directory entry.\r
+ * @param parent Directory i-node\r
+ * @param name   Name of the entry to be removed\r
+ * @param name_len  Name length\r
+ * @return Error code\r
+ */\r
 int ext4_dir_remove_entry(struct ext4_inode_ref *parent, const char *name,\r
     uint32_t name_len);\r
 \r
+/**@brief Try to insert entry to concrete data block.\r
+ * @param sb           Superblock\r
+ * @param target_block Block to try to insert entry to\r
+ * @param child        Child i-node to be inserted by new entry\r
+ * @param name         Name of the new entry\r
+ * @param name_len     Length of the new entry name\r
+ * @return Error code\r
+ */\r
 int ext4_dir_try_insert_entry(struct ext4_sblock *sb,\r
     struct ext4_block *target_block, struct ext4_inode_ref *child,\r
     const char *name, uint32_t name_len);\r
 \r
+/**@brief Try to find entry in block by name.\r
+ * @param block     Block containing entries\r
+ * @param sb        Superblock\r
+ * @param name_len  Length of entry name\r
+ * @param name      Name of entry to be found\r
+ * @param res_entry Output pointer to found entry, NULL if not found\r
+ * @return Error code\r
+ */\r
 int ext4_dir_find_in_block(struct ext4_block *block, struct ext4_sblock *sb,\r
     size_t name_len, const char *name,\r
     struct ext4_directory_entry_ll **res_entry);\r
 \r
+/**@brief Simple function to release allocated data from result.\r
+ * @param parent Parent inode\r
+ * @param result Search result to destroy\r
+ * @return Error code\r
+ *\r
+ */\r
 int ext4_dir_destroy_result(struct ext4_inode_ref *parent,\r
     struct ext4_directory_search_result *result);\r
 \r
-\r
 #endif /* EXT4_DIR_H_ */\r
 \r
 /**\r