diff --git a/fs/fs_initialize.c b/fs/fs_initialize.c index f04aee4e70..a598f9b7e8 100644 --- a/fs/fs_initialize.c +++ b/fs/fs_initialize.c @@ -23,11 +23,40 @@ ****************************************************************************/ #include +#include #include "rpmsgfs/rpmsgfs.h" #include "inode/inode.h" #include "aio/aio.h" +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sync_reboot_handler + ****************************************************************************/ + +static int sync_reboot_handler(FAR struct notifier_block *nb, + unsigned long action, FAR void *data) +{ + sync(); + return 0; +} + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Name: fs_sync_reboot_nb + ****************************************************************************/ + +static struct notifier_block g_sync_nb = +{ + sync_reboot_handler +}; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -57,4 +86,6 @@ void fs_initialize(void) #ifdef CONFIG_FS_RPMSGFS_SERVER rpmsgfs_server_init(); #endif + + register_reboot_notifier(&g_sync_nb); }