shithub: lwext4

Download patch

ref: d9eb4d52edb19095de66d1a332ec3ff475911da2
parent: e941966c0afc9905726fb985bc235e4bbec27dbd
author: gkostka <[email protected]>
date: Fri Dec 18 09:44:59 EST 2015

ext4: some style fixes & doxygen comments

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -2502,7 +2502,7 @@
 
 void ext4_dir_entry_rewind(ext4_dir *d)
 {
-    d->next_off = 0;
+	d->next_off = 0;
 }
 
 int ext4_test_journal(const char *mount_point)
@@ -2553,8 +2553,8 @@
 
 			ext4_bcache_set_dirty(block.buf);
 
-			struct jbd_trans *trans = jbd_journal_new_trans(journal);
-			if (!trans) {
+			struct jbd_trans *t = jbd_journal_new_trans(journal);
+			if (!t) {
 				ext4_block_set(mp->fs.bdev, &block);
 				r = ENOMEM;
 				goto out;
@@ -2562,9 +2562,10 @@
 
 			switch (rand() % 2) {
 			case 0:
-				r = jbd_trans_add_block(trans, &block);
+				r = jbd_trans_add_block(t, &block);
 				if (r != EOK) {
-					jbd_journal_free_trans(journal, trans, true);
+					jbd_journal_free_trans(journal, t,
+							       true);
 					ext4_block_set(mp->fs.bdev, &block);
 					r = ENOMEM;
 					goto out;
@@ -2571,9 +2572,10 @@
 				}
 				break;
 			case 1:
-				r = jbd_trans_revoke_block(trans, rand_block);
+				r = jbd_trans_revoke_block(t, rand_block);
 				if (r != EOK) {
-					jbd_journal_free_trans(journal, trans, true);
+					jbd_journal_free_trans(journal, t,
+							       true);
 					ext4_block_set(mp->fs.bdev, &block);
 					r = ENOMEM;
 					goto out;
@@ -2580,7 +2582,7 @@
 				}
 			}
 			ext4_block_set(mp->fs.bdev, &block);
-			jbd_journal_submit_trans(journal, trans);
+			jbd_journal_submit_trans(journal, t);
 			jbd_journal_commit_one(journal);
 		}
 out:
--- a/lwext4/ext4.h
+++ b/lwext4/ext4.h
@@ -136,7 +136,7 @@
 /*****************************DIRECTORY DESCRIPTOR***************************/
 
 /**@brief   Directory entry descriptor. Copy from ext4_types.h*/
-typedef struct {
+typedef struct ext4_direntry {
 	uint32_t inode;
 	uint16_t entry_length;
 	uint8_t name_length;
@@ -144,7 +144,7 @@
 	uint8_t name[255];
 } ext4_direntry;
 
-typedef struct {
+typedef struct ext4_dir {
 	/**@brief   File descriptor*/
 	ext4_file f;
 	/**@brief   Current directory entry.*/
@@ -281,7 +281,7 @@
 int ext4_frename(const char *path, const char *new_path);
 
 /**@brief   File open function.
- * @param   filename, (has to start from mount point)
+ * @param   path filename (has to start from mount point)
  *          /my_partition/my_file
  * @param   flags open file flags
  *  |---------------------------------------------------------------|
@@ -363,21 +363,80 @@
  * @return  file size */
 uint64_t ext4_fsize(ext4_file *f);
 
+/**@brief Change file/directory/link mode bits
+ * @param path to file/dir/link
+ * @param mode new mode bits (for example 0777)
+ * @return  standard error code*/
 int ext4_chmod(const char *path, uint32_t mode);
+
+/**@brief Change file owner and group
+ * @param path to file/dir/link
+ * @param uid user id
+ * @param gid group id
+ * @return  standard error code*/
 int ext4_chown(const char *path, uint32_t uid, uint32_t gid);
+
+/**@brief Set file access time
+ * @param path to file/dir/link
+ * @param atime access timestamp
+ * @return  standard error code*/
 int ext4_file_set_atime(const char *path, uint32_t atime);
+
+/**@brief Set file modify time
+ * @param path to file/dir/link
+ * @param mtime modify timestamp
+ * @return  standard error code*/
 int ext4_file_set_mtime(const char *path, uint32_t mtime);
+
+/**@brief Set file change time
+ * @param path to file/dir/link
+ * @param ctime change timestamp
+ * @return  standard error code*/
 int ext4_file_set_ctime(const char *path, uint32_t ctime);
 
+/**@brief Create symbolic link
+ * @param target destination path
+ * @param path source entry
+ * @return standard error code*/
 int ext4_fsymlink(const char *target, const char *path);
 
+
+/**@brief Read symbolic link payload
+ * @param path to symlink
+ * @param buf output buffer
+ * @param bufsize output buffer max size
+ * @param rcnt bytes read
+ * @return standard error code*/
 int ext4_readlink(const char *path, char *buf, size_t bufsize, size_t *rcnt);
 
+/**@brief Set extended attribute
+ * @param path to entry
+ *
+ * TODO: write detailed description
+ */
 int ext4_setxattr(const char *path, const char *name, size_t name_len,
 		  const void *data, size_t data_size, bool replace);
+
+/**@brief Get extended attribute
+ * @param path to entry
+ *
+ * TODO: write detailed description
+ */
 int ext4_getxattr(const char *path, const char *name, size_t name_len,
 		  void *buf, size_t buf_size, size_t *data_size);
+
+/**@brief List extended attributes
+ * @param path to entry
+ *
+ * TODO: write detailed description
+ */
 int ext4_listxattr(const char *path, char *list, size_t size, size_t *ret_size);
+
+/**@brief Remove extended attribute
+ * @param path to entry
+ *
+ * TODO: write detailed description
+ */
 int ext4_removexattr(const char *path, const char *name, size_t name_len);
 
 
@@ -413,6 +472,15 @@
 /**@brief   Rewine directory entry offset.
  * @param   d directory handle*/
 void ext4_dir_entry_rewind(ext4_dir *d);
+
+/**@brief   Test journal functionality
+ * @param   mount_point mount point, for example
+ *          -   /
+ *          -   /my_partition/
+ *          -   /my_second_partition/
+ *
+ * @return standard error code */
+int ext4_test_journal(const char *mount_point);
 
 #ifdef __cplusplus
 }