Add fops container for nicer casting
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/7a0dfc8e Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7a0dfc8e Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7a0dfc8e Branch: refs/heads/develop Commit: 7a0dfc8ecc103e1eb55d5945c6b55fbfff56b6f0 Parents: fab9ee3 Author: Fabio Utzig <[email protected]> Authored: Tue Jan 10 22:30:25 2017 -0200 Committer: Fabio Utzig <[email protected]> Committed: Thu Jan 12 10:51:46 2017 -0200 ---------------------------------------------------------------------- fs/fs/include/fs/fs_if.h | 6 ++++++ fs/fs/src/fs_mount.c | 6 ++++++ 2 files changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7a0dfc8e/fs/fs/include/fs/fs_if.h ---------------------------------------------------------------------- diff --git a/fs/fs/include/fs/fs_if.h b/fs/fs/include/fs/fs_if.h index ade4f97..5ce3d4e 100644 --- a/fs/fs/include/fs/fs_if.h +++ b/fs/fs/include/fs/fs_if.h @@ -58,6 +58,10 @@ struct fs_ops { SLIST_ENTRY(fs_ops) sc_next; }; +struct fops_container { + struct fs_ops *fops; +}; + /** * Registers a new filesystem interface * @@ -84,6 +88,8 @@ struct fs_ops *fs_ops_try_unique(void); */ struct fs_ops *fs_ops_for(const char *name); +struct fs_ops *fs_ops_from_container(struct fops_container *container); + #ifdef __cplusplus } #endif http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7a0dfc8e/fs/fs/src/fs_mount.c ---------------------------------------------------------------------- diff --git a/fs/fs/src/fs_mount.c b/fs/fs/src/fs_mount.c index 3fceb70..d79854e 100644 --- a/fs/fs/src/fs_mount.c +++ b/fs/fs/src/fs_mount.c @@ -79,3 +79,9 @@ fs_ops_for(const char *fs_name) return fops; } + +struct fs_ops * +fs_ops_from_container(struct fops_container *container) +{ + return container->fops; +}
