From 8d064097eb1033f9ada70e786dd09617ffa0eed0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 3 Jul 2012 10:12:40 +0200 Subject: fs: fix standard zero, full devices The standard devices are currently broken since they have the size ~0. As now files use loff_t as file size which is a signed type the read implementation gets confused and now returns -1. The current implementation also has the (somewhat theorical) problem that we do not have real streaming devices, so /dev/zero went out of zeroes after reading 4GB (or now LLONG_MAX). This patch introduces a new cdev flag DEVFS_IS_CHARACTER_DEV and a new file size flag FILE_SIZE_STREAM which makes it possible to create real stream devices instead. Signed-off-by: Sascha Hauer --- commands/stddev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'commands/stddev.c') diff --git a/commands/stddev.c b/commands/stddev.c index 97080eb43c..098aea8579 100644 --- a/commands/stddev.c +++ b/commands/stddev.c @@ -40,7 +40,7 @@ static int zero_init(void) cdev = xzalloc(sizeof (*cdev)); cdev->name = "zero"; - cdev->size = ~0; + cdev->flags = DEVFS_IS_CHARACTER_DEV; cdev->ops = &zeroops; devfs_create(cdev); @@ -68,7 +68,7 @@ static int full_init(void) cdev = xzalloc(sizeof (*cdev)); cdev->name = "full"; - cdev->size = ~0; + cdev->flags = DEVFS_IS_CHARACTER_DEV; cdev->ops = &fullops; devfs_create(cdev); @@ -95,7 +95,7 @@ static int null_init(void) cdev = xzalloc(sizeof (*cdev)); cdev->name = "null"; - cdev->size = 0; + cdev->flags = DEVFS_IS_CHARACTER_DEV; cdev->ops = &nullops; devfs_create(cdev); -- cgit v1.2.3