diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-08 11:43:34 +0200 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-08 11:43:34 +0200 |
commit | 8cbf32f110d47136d853ee88b74103445732a62e (patch) | |
tree | 4660cb3c0278ce45cb577ad412b0ce45e0ba5446 | |
parent | fa5bb24685b585521ba7eb52c5d63da43f3e2436 (diff) |
Create surface scaffold
-rw-r--r-- | Kbuild | 2 | ||||
-rw-r--r-- | char.c | 39 | ||||
-rw-r--r-- | surface.c | 8 | ||||
-rw-r--r-- | surface.h | 8 |
4 files changed, 54 insertions, 3 deletions
@@ -1,2 +1,2 @@ obj-m := harddoom.o -harddoom-objs := harddoom_main.o pci.o char.o harddoomdev.o +harddoom-objs := harddoom_main.o pci.o char.o harddoomdev.o surface.o @@ -4,8 +4,10 @@ #include <linux/device.h> #include <linux/fs.h> +#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, diff --git a/surface.c b/surface.c new file mode 100644 index 0000000..3c24871 --- /dev/null +++ b/surface.c @@ -0,0 +1,8 @@ +#include <linux/fs.h> + +#include "surface.h" + +int new_surface(struct doomdev_ioctl_create_surface *params) +{ + return -1; +} diff --git a/surface.h b/surface.h new file mode 100644 index 0000000..db9c80c --- /dev/null +++ b/surface.h @@ -0,0 +1,8 @@ +#ifndef SURFACE_H +#define SURFACE_H + +#include "doomdev.h" + +int new_surface(struct doomdev_ioctl_create_surface *params); + +#endif |