Skip to content

Commit

Permalink
Documentation improvements (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Huveneers <[email protected]>
  • Loading branch information
huven and huven authored Sep 22, 2022
1 parent 1eee453 commit 58bcf89
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 71 deletions.
22 changes: 11 additions & 11 deletions include/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int ext4_mount(const char *dev_name,

/**@brief Umount operation.
*
* @param mount_pount Mount point.
* @param mount_point Mount point.
*
* @return Standard error code */
int ext4_umount(const char *mount_point);
Expand All @@ -161,23 +161,23 @@ int ext4_umount(const char *mount_point);
*
* ext4_journal_stop("/");
* ext4_umount("/");
* @param mount_pount Mount point.
* @param mount_point Mount point.
*
* @return Standard error code. */
int ext4_journal_start(const char *mount_point);

/**@brief Stops journaling. Journaling start/stop functions are transparent
* and might be used on filesystems without journaling support.
*
* @param mount_pount Mount point name.
* @param mount_point Mount point name.
*
* @return Standard error code. */
int ext4_journal_stop(const char *mount_point);

/**@brief Journal recovery.
* @warning Must be called after @ref ext4_mount.
*
* @param mount_pount Mount point.
* @param mount_point Mount point.
*
* @return Standard error code. */
int ext4_recover(const char *mount_point);
Expand All @@ -199,7 +199,7 @@ struct ext4_mount_stats {

/**@brief Get file mount point stats.
*
* @param mount_pount Mount point.
* @param mount_point Mount point.
* @param stats Filesystem stats.
*
* @return Standard error code. */
Expand All @@ -208,7 +208,7 @@ int ext4_mount_point_stats(const char *mount_point,

/**@brief Setup OS lock routines.
*
* @param mount_pount Mount point.
* @param mount_point Mount point.
* @param locks Lock and unlock functions
*
* @return Standard error code. */
Expand All @@ -217,7 +217,7 @@ int ext4_mount_setup_locks(const char *mount_point,

/**@brief Acquire the filesystem superblock pointer of a mp.
*
* @param mount_pount Mount point.
* @param mount_point Mount point.
* @param sb Superblock handle
*
* @return Standard error code. */
Expand Down Expand Up @@ -254,7 +254,7 @@ int ext4_get_sblock(const char *mount_point, struct ext4_sblock **sb);
* Write back mode is useful when you want to create a lot of empty
* files/directories.
*
* @param mount_pount Mount point.
* @param path Mount point.
* @param on Enable/disable cache writeback mode.
*
* @return Standard error code. */
Expand All @@ -263,7 +263,7 @@ int ext4_cache_write_back(const char *path, bool on);

/**@brief Force cache flush.
*
* @param mount_pount Mount point.
* @param path Mount point.
*
* @return Standard error code. */
int ext4_cache_flush(const char *path);
Expand Down Expand Up @@ -538,8 +538,8 @@ int ext4_setxattr(const char *path, const char *name, size_t name_len,
* @param path Path to file/directory.
* @param name Name of the entry to get.
* @param name_len Length of @name in bytes.
* @param data Data of the entry to get.
* @param data_size Size of data to get.
* @param buf Data of the entry to get.
* @param buf_size Size of data to get.
*
* @return Standard error code.*/
int ext4_getxattr(const char *path, const char *name, size_t name_len,
Expand Down
5 changes: 2 additions & 3 deletions include/ext4_balloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ extern "C" {
#include <stdbool.h>

/**@brief Compute number of block group from block address.
* @param sb superblock pointer.
* @param s superblock pointer.
* @param baddr Absolute address of block.
* @return Block group index
*/
uint32_t ext4_balloc_get_bgid_of_block(struct ext4_sblock *s,
ext4_fsblk_t baddr);

/**@brief Compute the starting block address of a block group
* @param sb superblock pointer.
* @param s superblock pointer.
* @param bgid block group index
* @return Block address
*/
Expand Down Expand Up @@ -95,7 +95,6 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,

/**@brief Allocate block procedure.
* @param inode_ref inode reference
* @param goal
* @param baddr allocated block address
* @return standard error code*/
int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
Expand Down
3 changes: 1 addition & 2 deletions include/ext4_bcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ void ext4_bcache_invalidate_buf(struct ext4_bcache *bc,
/**@brief Invalidate a range of buffers.
* @param bc block cache descriptor
* @param from starting lba
* @param cnt block counts
* @param buf buffer*/
* @param cnt block counts*/
void ext4_bcache_invalidate_lba(struct ext4_bcache *bc,
uint64_t from,
uint32_t cnt);
Expand Down
11 changes: 4 additions & 7 deletions include/ext4_block_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ static inline uint64_t ext4_bg_get_block_bitmap(struct ext4_bgroup *bg,
* @param bg pointer to block group
* @param s pointer to superblock
* @param blk block to set
* @return Address of block with block bitmap
*/
static inline void ext4_bg_set_block_bitmap(struct ext4_bgroup *bg,
struct ext4_sblock *s, uint64_t blk)
Expand Down Expand Up @@ -106,7 +105,6 @@ static inline uint64_t ext4_bg_get_inode_bitmap(struct ext4_bgroup *bg,
* @param bg Pointer to block group
* @param s Pointer to superblock
* @param blk block to set
* @return Address of block with i-node bitmap
*/
static inline void ext4_bg_set_inode_bitmap(struct ext4_bgroup *bg,
struct ext4_sblock *s, uint64_t blk)
Expand Down Expand Up @@ -139,7 +137,6 @@ ext4_bg_get_inode_table_first_block(struct ext4_bgroup *bg,
* @param bg Pointer to block group
* @param s Pointer to superblock
* @param blk block to set
* @return Address of first block of i-node table
*/
static inline void
ext4_bg_set_inode_table_first_block(struct ext4_bgroup *bg,
Expand All @@ -152,7 +149,7 @@ ext4_bg_set_inode_table_first_block(struct ext4_bgroup *bg,

/**@brief Get number of free blocks in block group.
* @param bg Pointer to block group
* @param sb Pointer to superblock
* @param s Pointer to superblock
* @return Number of free blocks in block group
*/
static inline uint32_t ext4_bg_get_free_blocks_count(struct ext4_bgroup *bg,
Expand Down Expand Up @@ -282,7 +279,7 @@ static inline void ext4_bg_set_checksum(struct ext4_bgroup *bg, uint16_t crc)

/**@brief Check if block group has a flag.
* @param bg Pointer to block group
* @param flag Flag to be checked
* @param f Flag to be checked
* @return True if flag is set to 1
*/
static inline bool ext4_bg_has_flag(struct ext4_bgroup *bg, uint32_t f)
Expand All @@ -292,7 +289,7 @@ static inline bool ext4_bg_has_flag(struct ext4_bgroup *bg, uint32_t f)

/**@brief Set flag of block group.
* @param bg Pointer to block group
* @param flag Flag to be set
* @param f Flag to be set
*/
static inline void ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)
{
Expand All @@ -303,7 +300,7 @@ static inline void ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)

/**@brief Clear flag of block group.
* @param bg Pointer to block group
* @param flag Flag to be cleared
* @param f Flag to be cleared
*/
static inline void ext4_bg_clear_flag(struct ext4_bgroup *bg, uint32_t f)
{
Expand Down
5 changes: 1 addition & 4 deletions include/ext4_blockdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ struct ext4_blockdev {
}

/**@brief Block device initialization.
* @param bdev block device descriptor
* @param bg_bsize logical block size
* @param bdev block device descriptor
* @return standard error code*/
int ext4_block_init(struct ext4_blockdev *bdev);
Expand Down Expand Up @@ -185,8 +183,7 @@ int ext4_block_flush_lba(struct ext4_blockdev *bdev, uint64_t lba);

/**@brief Set logical block size in block device.
* @param bdev block device descriptor
* @param lb_size logical block size (in bytes)
* @return standard error code*/
* @param lb_bsize logical block size (in bytes)*/
void ext4_block_set_lb_size(struct ext4_blockdev *bdev, uint32_t lb_bsize);

/**@brief Block get function (through cache, don't read).
Expand Down
2 changes: 1 addition & 1 deletion include/ext4_crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ uint32_t ext4_crc32(uint32_t crc, const void *buf, uint32_t size);
/**@brief CRC32C algorithm.
* @param crc input feed
* @param buf input buffer
* @param length input buffer length (bytes)
* @param size input buffer length (bytes)
* @return updated crc32c value*/
uint32_t ext4_crc32c(uint32_t crc, const void *buf, uint32_t size);

Expand Down
4 changes: 2 additions & 2 deletions include/ext4_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ static inline const char *ext4_dmask_id2str(uint32_t m)
#define DBG_ERROR "[error] "

/**@brief Global mask debug set.
* @brief m new debug mask.*/
* @param m new debug mask.*/
void ext4_dmask_set(uint32_t m);

/**@brief Global mask debug clear.
* @brief m new debug mask.*/
* @param m new debug mask.*/
void ext4_dmask_clr(uint32_t m);

/**@brief Global debug mask get.
Expand Down
6 changes: 3 additions & 3 deletions include/ext4_dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static inline uint16_t ext4_dir_en_get_entry_len(struct ext4_dir_en *de)

/**@brief Set directory entry length.
* @param de Directory entry
* @param length Entry length
* @param l Entry length
*/
static inline void ext4_dir_en_set_entry_len(struct ext4_dir_en *de, uint16_t l)
{
Expand All @@ -135,7 +135,7 @@ static inline uint16_t ext4_dir_en_get_name_len(struct ext4_sblock *sb,
/**@brief Set directory entry name length.
* @param sb Superblock
* @param de Directory entry
* @param length Entry name length
* @param len Entry name length
*/
static inline void ext4_dir_en_set_name_len(struct ext4_sblock *sb,
struct ext4_dir_en *de,
Expand Down Expand Up @@ -165,7 +165,7 @@ static inline uint8_t ext4_dir_en_get_inode_type(struct ext4_sblock *sb,
/**@brief Set i-node type of directory entry.
* @param sb Superblock
* @param de Directory entry
* @param type I-node type (file, dir, etc.)
* @param t I-node type (file, dir, etc.)
*/

static inline void ext4_dir_en_set_inode_type(struct ext4_sblock *sb,
Expand Down
2 changes: 1 addition & 1 deletion include/ext4_dir_idx.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct ext4_dir_idx_block {

/**@brief Initialize index structure of new directory.
* @param dir Pointer to directory i-node
* @param dir Pointer to parent directory i-node
* @param parent Pointer to parent directory i-node
* @return Error code
*/
int ext4_dir_dx_init(struct ext4_inode_ref *dir,
Expand Down
9 changes: 4 additions & 5 deletions include/ext4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct ext4_inode_ref {


/**@brief Convert block address to relative index in block group.
* @param sb Superblock pointer
* @param s Superblock pointer
* @param baddr Block number to convert
* @return Relative number of block
*/
Expand Down Expand Up @@ -187,7 +187,7 @@ void ext4_fs_inode_blocks_init(struct ext4_fs *fs,
int ext4_fs_put_inode_ref(struct ext4_inode_ref *ref);

/**@brief Convert filetype to inode mode.
* @param filetype
* @param filetype File type
* @return inode mode
*/
uint32_t ext4_fs_correspond_inode_mode(int filetype);
Expand Down Expand Up @@ -222,7 +222,6 @@ ext4_fsblk_t ext4_fs_inode_to_goal_block(struct ext4_inode_ref *inode_ref);

/**@brief Compute 'goal' for allocation algorithm (For blockmap).
* @param inode_ref Reference to inode, to allocate block for
* @param goal
* @return error code
*/
int ext4_fs_indirect_find_goal(struct ext4_inode_ref *inode_ref,
Expand Down Expand Up @@ -260,12 +259,12 @@ int ext4_fs_append_inode_dblk(struct ext4_inode_ref *inode_ref,
ext4_fsblk_t *fblock, ext4_lblk_t *iblock);

/**@brief Increment inode link count.
* @param inode none handle
* @param inode_ref none handle
*/
void ext4_fs_inode_links_count_inc(struct ext4_inode_ref *inode_ref);

/**@brief Decrement inode link count.
* @param inode none handle
* @param inode_ref none handle
*/
void ext4_fs_inode_links_count_dec(struct ext4_inode_ref *inode_ref);

Expand Down
2 changes: 1 addition & 1 deletion include/ext4_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct ext4_hash_info {
* @param name entry name
* @param len entry name length
* @param hash_seed (from superblock)
* @param hash version (from superblock)
* @param hash_version version (from superblock)
* @param hash_minor output value
* @param hash_major output value
* @return standard error code*/
Expand Down
18 changes: 9 additions & 9 deletions include/ext4_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ uint16_t ext4_inode_get_links_cnt(struct ext4_inode *inode);

/**@brief Set number of links to i-node.
* @param inode I-node to set number of links to
* @param count Number of links to i-node
* @param cnt Number of links to i-node
*/
void ext4_inode_set_links_cnt(struct ext4_inode *inode, uint16_t cnt);

Expand All @@ -174,7 +174,7 @@ uint64_t ext4_inode_get_blocks_count(struct ext4_sblock *sb,
/**@brief Set number of 512-bytes blocks used for i-node.
* @param sb Superblock
* @param inode I-node
* @param count Number of 512-bytes blocks
* @param cnt Number of 512-bytes blocks
* @return Error code
*/
int ext4_inode_set_blocks_count(struct ext4_sblock *sb,
Expand All @@ -200,7 +200,7 @@ uint32_t ext4_inode_get_generation(struct ext4_inode *inode);

/**@brief Set file generation (used by NFS).
* @param inode I-node
* @param generation File generation
* @param gen File generation
*/
void ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen);

Expand Down Expand Up @@ -232,7 +232,7 @@ uint64_t ext4_inode_get_file_acl(struct ext4_inode *inode,
/**@brief Set address of block, where are extended attributes located.
* @param inode I-node
* @param sb Superblock
* @param file_acl Block address
* @param acl Block address
*/
void ext4_inode_set_file_acl(struct ext4_inode *inode, struct ext4_sblock *sb,
uint64_t acl);
Expand All @@ -247,7 +247,7 @@ uint32_t ext4_inode_get_direct_block(struct ext4_inode *inode, uint32_t idx);
/**@brief Set block address of specified direct block.
* @param inode I-node to set block address to
* @param idx Index of logical block
* @param fblock Physical block address
* @param block Physical block address
*/
void ext4_inode_set_direct_block(struct ext4_inode *inode, uint32_t idx,
uint32_t block);
Expand All @@ -262,7 +262,7 @@ uint32_t ext4_inode_get_indirect_block(struct ext4_inode *inode, uint32_t idx);
/**@brief Set block address of specified indirect block.
* @param inode I-node to set block address to
* @param idx Index of indirect block
* @param fblock Physical block address
* @param block Physical block address
*/
void ext4_inode_set_indirect_block(struct ext4_inode *inode, uint32_t idx,
uint32_t block);
Expand Down Expand Up @@ -297,20 +297,20 @@ bool ext4_inode_is_type(struct ext4_sblock *sb, struct ext4_inode *inode,

/**@brief Check if i-node has specified flag.
* @param inode I-node to check flags of
* @param flag Flag to check
* @param f Flag to check
* @return Result of check operation
*/
bool ext4_inode_has_flag(struct ext4_inode *inode, uint32_t f);

/**@brief Remove specified flag from i-node.
* @param inode I-node to clear flag on
* @param clear_flag Flag to be cleared
* @param f Flag to be cleared
*/
void ext4_inode_clear_flag(struct ext4_inode *inode, uint32_t f);

/**@brief Set specified flag to i-node.
* @param inode I-node to set flag on
* @param set_flag Flag to be set
* @param f Flag to be set
*/
void ext4_inode_set_flag(struct ext4_inode *inode, uint32_t f);

Expand Down
Loading

0 comments on commit 58bcf89

Please sign in to comment.