2011-11-14 12:53:05 +01:00
|
|
|
/* Created (MFS based):
|
|
|
|
* June 2011 (Evgeniy Ivanov)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fs.h"
|
|
|
|
#include <assert.h>
|
|
|
|
#include <minix/vfsif.h>
|
|
|
|
|
|
|
|
#include "puffs.h"
|
|
|
|
#include "puffs_priv.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* fs_sync *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int fs_sync(void)
|
2011-11-14 12:53:05 +01:00
|
|
|
{
|
|
|
|
/* Perform the sync() system call. Flush all the tables.
|
|
|
|
* The order in which the various tables are flushed is critical.
|
|
|
|
*/
|
|
|
|
int r;
|
|
|
|
PUFFS_MAKECRED(pcr, &global_kcred);
|
|
|
|
|
|
|
|
if (is_readonly_fs)
|
|
|
|
return(OK); /* nothing to sync */
|
|
|
|
|
|
|
|
r = global_pu->pu_ops.puffs_fs_sync(global_pu, MNT_WAIT, pcr);
|
|
|
|
if (r) {
|
|
|
|
lpuffs_debug("Warning: sync failed!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return(OK); /* sync() can't fail */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* fs_flush *
|
|
|
|
*===========================================================================*/
|
2014-02-24 14:00:17 +01:00
|
|
|
int fs_flush(void)
|
2011-11-14 12:53:05 +01:00
|
|
|
{
|
|
|
|
/* Flush the blocks of a device from the cache after writing any dirty blocks
|
|
|
|
* to disk.
|
|
|
|
*/
|
|
|
|
#if 0
|
2014-04-29 16:15:37 +02:00
|
|
|
dev_t dev = fs_m_in.m_vfs_fs_flush.device;
|
2011-11-14 12:53:05 +01:00
|
|
|
|
|
|
|
if(dev == fs_dev) return(EBUSY);
|
|
|
|
|
|
|
|
flushall(dev);
|
|
|
|
invalidate(dev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return(OK);
|
|
|
|
}
|
2011-11-29 16:02:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* fs_new_driver *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
int fs_new_driver(void)
|
2011-11-29 16:02:37 +01:00
|
|
|
{
|
|
|
|
/* Do not do anything. */
|
|
|
|
|
|
|
|
return(OK);
|
|
|
|
}
|