diff options
| author | root <ngkaho1234@gmail.com> | 2015-09-30 09:48:58 +0000 |
|---|---|---|
| committer | root <ngkaho1234@gmail.com> | 2015-09-30 09:48:58 +0000 |
| commit | 90ed580cfaf169c57bc1a3e2117a6f72184b36ec (patch) | |
| tree | 2a279ddcff2431481754c796aeb5d7835fa9c9df | |
| parent | 4a137bb50e4645bd562a7b6662167e0708f4a428 (diff) | |
ext4_mount_point_stats should handle the path of files as well.
| -rw-r--r-- | lwext4/ext4.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lwext4/ext4.c b/lwext4/ext4.c index a71389a..99ba961 100644 --- a/lwext4/ext4.c +++ b/lwext4/ext4.c @@ -450,18 +450,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 +510,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; |
