mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] stddev: make reads from /dev/null return 0 bytes
@ 2025-04-22  7:54 Ahmad Fatoum
  2025-04-22  9:23 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-04-22  7:54 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Currently, /dev/null discards all writes, but returns -ENOSYS on read.
Implement read to return 0 always, so it returns EOF immediately.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/stddev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/commands/stddev.c b/commands/stddev.c
index e9b7dcc0d2f3..16cf4e30802d 100644
--- a/commands/stddev.c
+++ b/commands/stddev.c
@@ -64,8 +64,14 @@ static ssize_t null_write(struct cdev *cdev, const void *buf, size_t count, loff
 	return count;
 }
 
+static ssize_t null_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
+{
+	return 0;
+}
+
 static struct cdev_operations nullops = {
 	.write = null_write,
+	.read = null_read,
 };
 
 static int null_init(void)
-- 
2.39.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-22 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-22  7:54 [PATCH] stddev: make reads from /dev/null return 0 bytes Ahmad Fatoum
2025-04-22  9:23 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox