summaryrefslogtreecommitdiffstats
path: root/fs/devfs.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-03-25 11:04:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-11 12:36:07 +0200
commitf1bb89fd9e5c6f3527ebaafcf57346fec19e4d5f (patch)
tree494e54adea9b5a2f9cd0a4a66e2ed5b360b7783a /fs/devfs.c
parent3efa8f7bed53dba8d9252d94233db36aac64b6ce (diff)
downloadbarebox-f1bb89fd9e5c6f3527ebaafcf57346fec19e4d5f.tar.gz
barebox-f1bb89fd9e5c6f3527ebaafcf57346fec19e4d5f.tar.xz
fs: implement flush function
Once we have caching in file functions we need a way to sync the the underlying devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/devfs.c')
-rw-r--r--fs/devfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/devfs.c b/fs/devfs.c
index ddb3447673..f82fdddbc2 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -169,6 +169,16 @@ static int devfs_close(struct device_d *_dev, FILE *f)
return 0;
}
+static int devfs_flush(struct device_d *_dev, FILE *f)
+{
+ struct cdev *cdev = f->inode;
+
+ if (cdev->ops->flush)
+ return cdev->ops->flush(cdev);
+
+ return 0;
+}
+
static int partition_ioctl(struct cdev *cdev, int request, void *buf)
{
size_t offset;
@@ -287,6 +297,7 @@ static struct fs_driver_d devfs_driver = {
.lseek = devfs_lseek,
.open = devfs_open,
.close = devfs_close,
+ .flush = devfs_flush,
.ioctl = devfs_ioctl,
.opendir = devfs_opendir,
.readdir = devfs_readdir,