From 8cbf32f110d47136d853ee88b74103445732a62e Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 8 May 2018 11:43:34 +0200 Subject: Create surface scaffold --- char.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'char.c') diff --git a/char.c b/char.c index db8ffcc..881c3d0 100644 --- a/char.c +++ b/char.c @@ -4,8 +4,10 @@ #include #include +#include "doomdev.h" #include "util.h" #include "pci.h" +#include "surface.h" #define DOOMDEV_COUNT 256 #define DOOMDEV_NAME "doom" @@ -14,16 +16,49 @@ dev_t first; int major; int next_minor = 0; -long doom_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +long doom_create_surface(struct file *filp, unsigned long arg) +{ + struct doomdev_ioctl_create_surface *params; + params = (struct doomdev_ioctl_create_surface *)arg; + return new_surface(params); +} + +long doom_create_texture(struct file *filp, unsigned long arg) { return -1; } -int doom_open(struct inode *inode, struct file *filp) +long doom_create_flat(struct file *filp, unsigned long arg) { return -1; } +long doom_create_colormaps(struct file *filp, unsigned long arg) +{ + return -1; +} + +long doom_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case DOOMDEV_IOCTL_CREATE_SURFACE: + return doom_create_surface(filp, arg); + case DOOMDEV_IOCTL_CREATE_TEXTURE: + return doom_create_texture(filp, arg); + case DOOMDEV_IOCTL_CREATE_FLAT: + return doom_create_flat(filp, arg); + case DOOMDEV_IOCTL_CREATE_COLORMAPS: + return doom_create_colormaps(filp, arg); + default: + return -EINVAL; + } +} + +int doom_open(struct inode *inode, struct file *filp) +{ + return 0; +} + struct file_operations doomdev_fops = { .owner = THIS_MODULE, .unlocked_ioctl = doom_ioctl, -- cgit v1.2.3