Fix compile warnings for 16 bit machines
[lwext4.git] / lwext4 / ext4.c
index 2bb783f921100d1d1bdfc7cc5e606ac4af7573fb..0cdf045afcff648175034de89e8574107fc5fd17 100644 (file)
@@ -44,6 +44,7 @@
 #include "ext4_inode.h"
 #include "ext4_super.h"
 #include "ext4_dir_idx.h"
+#include "ext4_xattr.h"
 #include "ext4.h"
 
 #include <stdlib.h>
@@ -450,18 +451,25 @@ int ext4_umount(const char *mount_point)
        return ext4_block_fini(mp->fs.bdev);
 }
 
+static struct ext4_mountpoint *ext4_get_mount(const char *path)
+{
+       int i;
+       for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
+
+               if (!_mp[i].mounted)
+                       continue;
+
+               if (!strncmp(_mp[i].name, path, strlen(_mp[i].name)))
+                       return &_mp[i];
+       }
+       return 0;
+}
+
 int ext4_mount_point_stats(const char *mount_point,
                           struct ext4_mount_stats *stats)
 {
-       uint32_t i;
-       struct ext4_mountpoint *mp = 0;
+       struct ext4_mountpoint *mp = ext4_get_mount(mount_point);
 
-       for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
-               if (!strcmp(_mp[i].name, mount_point)) {
-                       mp = &_mp[i];
-                       break;
-               }
-       }
        if (!mp)
                return ENOENT;
 
@@ -503,20 +511,6 @@ int ext4_mount_setup_locks(const char *mount_point,
 
 /********************************FILE OPERATIONS*****************************/
 
-static struct ext4_mountpoint *ext4_get_mount(const char *path)
-{
-       int i;
-       for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
-
-               if (!_mp[i].mounted)
-                       continue;
-
-               if (!strncmp(_mp[i].name, path, strlen(_mp[i].name)))
-                       return &_mp[i];
-       }
-       return 0;
-}
-
 static int ext4_path_check(const char *path, bool *is_goal)
 {
        int i;
@@ -737,6 +731,7 @@ static int ext4_generic_open2(ext4_file *f, const char *path, int flags,
 
                if (f->flags & O_APPEND)
                        f->fpos = f->fsize;
+
        }
 
        r = ext4_fs_put_inode_ref(&ref);
@@ -2180,7 +2175,10 @@ int ext4_dir_open(ext4_dir *d, const char *path)
        return r;
 }
 
-int ext4_dir_close(ext4_dir *d) { return ext4_fclose(&d->f); }
+int ext4_dir_close(ext4_dir *d)
+{
+    return ext4_fclose(&d->f);
+}
 
 const ext4_direntry *ext4_dir_entry_next(ext4_dir *d)
 {
@@ -2225,6 +2223,11 @@ Finish:
        return de;
 }
 
+void ext4_dir_entry_rewind(ext4_dir *d)
+{
+    d->next_off = 0;
+}
+
 /**
  * @}
  */