summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2012-06-09 11:34:26 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2012-06-30 12:46:01 +0200
commit488dc91f93bc143c7fa7d435fba0a5f0a70fd137 (patch)
tree4404e02151194f1c0d90625090b3a0ce4caad73a /commands
parent0e4fdcc81b8f47b613b8d3d61005bc920a2ebcad (diff)
downloadbarebox-488dc91f93bc143c7fa7d435fba0a5f0a70fd137.tar.gz
barebox-488dc91f93bc143c7fa7d435fba0a5f0a70fd137.tar.xz
Added "/dev/full" and "/dev/null" devices
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/stddev.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/commands/stddev.c b/commands/stddev.c
index 18fea94074..8995fad796 100644
--- a/commands/stddev.c
+++ b/commands/stddev.c
@@ -49,3 +49,58 @@ static int zero_init(void)
}
device_initcall(zero_init);
+
+static ssize_t full_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+{
+ memset(buf, 0xff, count);
+ return count;
+}
+
+static struct file_operations fullops = {
+ .read = full_read,
+ .lseek = dev_lseek_default,
+};
+
+static int full_init(void)
+{
+ struct cdev *cdev;
+
+ cdev = xzalloc(sizeof (*cdev));
+
+ cdev->name = "full";
+ cdev->size = ~0;
+ cdev->ops = &fullops;
+
+ devfs_create(cdev);
+
+ return 0;
+}
+
+device_initcall(full_init);
+
+static ssize_t null_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+{
+ return count;
+}
+
+static struct file_operations nullops = {
+ .write = null_write,
+ .lseek = dev_lseek_default,
+};
+
+static int null_init(void)
+{
+ struct cdev *cdev;
+
+ cdev = xzalloc(sizeof (*cdev));
+
+ cdev->name = "null";
+ cdev->size = 0;
+ cdev->ops = &nullops;
+
+ devfs_create(cdev);
+
+ return 0;
+}
+
+device_initcall(null_init);