Skip to content
Snippets Groups Projects
Commit 9619ffbb authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

zio-zero: add an output cset that eats data


Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
Acked-by: default avatarFederico Vaga <federico.vaga@gmail.com>
parent fce9797b
No related branches found
No related tags found
No related merge requests found
/* Federico Vaga for CERN, 2011, GNU GPLv2 or later */
/*
* zero-zio is a simple zio driver which fill buffer with 0. From the ZIO
* point of view is an input device
* zio-zero is a simple zio driver, with both input and output. The
* channels are completely software driven. The input channels fill
* the data block with zeroes, random data and sequential numbers,
* respectively. The output channel just discards data it receives.
*/
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -46,8 +48,15 @@ static int zzero_input(struct zio_cset *cset)
return 1; /* Already done */
}
static int zzero_output(struct zio_cset *cset)
{
/* We just eat data, like /dev/zero and /dev/null */
return 1; /* Already done */
}
static const struct zio_device_operations zzero_d_op = {
.input_cset = zzero_input,
.output_cset = zzero_output,
};
static struct zio_cset zzero_cset[] = {
......@@ -56,6 +65,11 @@ static struct zio_cset zzero_cset[] = {
.ssize = 1,
.flags = ZIO_DIR_INPUT | ZCSET_TYPE_ANALOG,
},
{
.n_chan = 1,
.ssize = 1,
.flags = ZIO_DIR_OUTPUT | ZCSET_TYPE_ANALOG,
},
};
static struct zio_device zzero_dev = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment