shithub: lwext4

Download patch

ref: f6bfcc1073939f1ee99d53853ae34c72fb6177c2
parent: 803375001a1985ae323c86fa3f6f2c4eff14e1e9
author: Grzegorz Kostka <kostka.grzegorz@gmail.com>
date: Fri Feb 17 09:30:30 EST 2017

ext4: little style improvements

--- a/src/ext4.c
+++ b/src/ext4.c
@@ -475,8 +475,7 @@
 
 static struct ext4_mountpoint *ext4_get_mount(const char *path)
 {
-	int i;
-	for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
+	for (size_t i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
 
 		if (!s_mp[i].mounted)
 			continue;
@@ -484,6 +483,7 @@
 		if (!strncmp(s_mp[i].name, path, strlen(s_mp[i].name)))
 			return &s_mp[i];
 	}
+
 	return NULL;
 }
 
@@ -492,6 +492,7 @@
 {
 	int r = EOK;
 	struct ext4_mountpoint *mp = ext4_get_mount(mount_point);
+
 	if (!mp)
 		return ENOENT;
 
@@ -522,6 +523,7 @@
 {
 	int r = EOK;
 	struct ext4_mountpoint *mp = ext4_get_mount(mount_point);
+
 	if (!mp)
 		return ENOENT;
 
@@ -557,10 +559,11 @@
 static int __ext4_recover(const char *mount_point)
 {
 	struct ext4_mountpoint *mp = ext4_get_mount(mount_point);
+	int r = ENOTSUP;
+
 	if (!mp)
 		return ENOENT;
 
-	int r = ENOTSUP;
 	EXT4_MP_LOCK(mp);
 	if (ext4_sb_feature_com(&mp->fs.sb, EXT4_FCOM_HAS_JOURNAL)) {
 		struct jbd_fs *jbd_fs = ext4_calloc(1, sizeof(struct jbd_fs));
@@ -569,7 +572,6 @@
 			 goto Finish;
 		}
 
-
 		r = jbd_get_fs(&mp->fs, jbd_fs);
 		if (r != EOK) {
 			ext4_free(jbd_fs);
@@ -615,6 +617,7 @@
 static int __ext4_trans_start(struct ext4_mountpoint *mp)
 {
 	int r = EOK;
+
 	if (mp->fs.jbd_journal && !mp->fs.curr_trans) {
 		struct jbd_journal *journal = mp->fs.jbd_journal;
 		struct jbd_trans *trans;
@@ -633,6 +636,7 @@
 static int __ext4_trans_stop(struct ext4_mountpoint *mp)
 {
 	int r = EOK;
+
 	if (mp->fs.jbd_journal && mp->fs.curr_trans) {
 		struct jbd_journal *journal = mp->fs.jbd_journal;
 		struct jbd_trans *trans = mp->fs.curr_trans;