Use fops container

Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4333192f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4333192f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4333192f

Branch: refs/heads/develop
Commit: 4333192f9048019439a4dfe7dbe332a807834149
Parents: 7a0dfc8
Author: Fabio Utzig <[email protected]>
Authored: Tue Jan 10 22:33:24 2017 -0200
Committer: Fabio Utzig <[email protected]>
Committed: Thu Jan 12 10:51:46 2017 -0200

----------------------------------------------------------------------
 fs/fs/src/fs_dirent.c | 5 ++---
 fs/fs/src/fs_file.c   | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4333192f/fs/fs/src/fs_dirent.c
----------------------------------------------------------------------
diff --git a/fs/fs/src/fs_dirent.c b/fs/fs/src/fs_dirent.c
index ec26745..0216f3b 100644
--- a/fs/fs/src/fs_dirent.c
+++ b/fs/fs/src/fs_dirent.c
@@ -29,11 +29,10 @@ fops_from_dir(const struct fs_dir *dir)
     return (struct fs_ops *) *((uint32_t *)dir);
 }
 
-static struct fs_ops *
+static inline struct fs_ops *
 fops_from_dirent(const struct fs_dirent *dirent)
 {
-    /* NOTE: fs_ops must always be the first field for any fs_file */
-    return (struct fs_ops *) *((uint32_t *)dirent);
+    return fs_ops_from_container((struct fops_container *) dirent);
 }
 
 int

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4333192f/fs/fs/src/fs_file.c
----------------------------------------------------------------------
diff --git a/fs/fs/src/fs_file.c b/fs/fs/src/fs_file.c
index c706534..5ad28cd 100644
--- a/fs/fs/src/fs_file.c
+++ b/fs/fs/src/fs_file.c
@@ -197,11 +197,10 @@ fops_from_filename(const char *filename)
     return safe_fs_ops_for(fs_name);
 }
 
-static struct fs_ops *
+static inline struct fs_ops *
 fops_from_file(const struct fs_file *file)
 {
-    /* NOTE: fs_ops must always be the first field for any fs_file */
-    return (struct fs_ops *) *((uint32_t *)file);
+    return fs_ops_from_container((struct fops_container *) file);
 }
 
 int

Reply via email to