fs/fs_initialize.c:Sync fs in system restart callback
This commit is contained in:
parent
d60dee4a65
commit
7485f1c81d
@ -23,11 +23,40 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/reboot_notifier.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user