m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kbuild2
-rw-r--r--char.c39
-rw-r--r--surface.c8
-rw-r--r--surface.h8
4 files changed, 54 insertions, 3 deletions
diff --git a/Kbuild b/Kbuild
index fdebf0f..0fa0a82 100644
--- a/Kbuild
+++ b/Kbuild
@@ -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
diff --git a/char.c b/char.c
index db8ffcc..881c3d0 100644
--- a/char.c
+++ b/char.c
@@ -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