[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [PATCH 1/2] lib/vfscore: Implemented stdin fop
Added the stdin operation inside stdio.c. The sdtdio is mapped by default to fd 0. Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> --- lib/vfscore/stdio.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c index c631f5f..6acbb32 100644 --- a/lib/vfscore/stdio.c +++ b/lib/vfscore/stdio.c @@ -35,19 +35,38 @@ #include <vfscore/file.h> #include <uk/plat/console.h> +#include <uk/essentials.h> + +static ssize_t stdin_read(struct vfscore_file *vfscore_file __unused, + void *buf, size_t count) +{ + int read_count; + + read_count = ukplat_cink(buf, count); + + return read_count; +} /* One function for stderr and stdout */ -static ssize_t stdout_write(struct vfscore_file *vfscore_file, const void *buf, - size_t count) +static ssize_t stdout_write(struct vfscore_file *vfscore_file __unused, + const void *buf, size_t count) { - (void) vfscore_file; return ukplat_coutk(buf, count); } +static struct vfscore_fops stdin_fops = { + .read = stdin_read, +}; + static struct vfscore_fops stdout_fops = { .write = stdout_write, }; +static struct vfscore_file stdin_file = { + .fd = 0, + .fops = &stdin_fops, +}; + static struct vfscore_file stdout_file = { .fd = 1, .fops = &stdout_fops, @@ -61,6 +80,7 @@ static struct vfscore_file stderr_file = { void init_stdio(void) { + vfscore_install_fd(0, &stdin_file); vfscore_install_fd(1, &stdout_file); vfscore_install_fd(2, &stderr_file); } -- 2.19.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |