summaryrefslogtreecommitdiffstats
path: root/main.h
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2012-12-24 12:53:20 -0600
committerKyle Kaminski <kyle@kkaminsk.com>2012-12-24 12:53:20 -0600
commit0d9aff9bd305d18625c322a1a891aba278049862 (patch)
tree274aa52bf311107232488fb3f924cef316cfcb28 /main.h
parentf0531d88e958b5fa77f8dc9bb34e697e872aeba9 (diff)
downloadkernelhello-0d9aff9bd305d18625c322a1a891aba278049862.tar.gz
kernelhello-0d9aff9bd305d18625c322a1a891aba278049862.tar.bz2
kernelhello-0d9aff9bd305d18625c322a1a891aba278049862.zip
spawn char device at /dev/, implement read
Diffstat (limited to 'main.h')
-rw-r--r--main.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/main.h b/main.h
index 229e387..e437853 100644
--- a/main.h
+++ b/main.h
@@ -1,7 +1,29 @@
-#ifndef _MAIN_H_
-#define _MAIN_H_
+#ifndef _HELLOMAIN_H_
+#define _HELLOMAIN_H_
-extern char *debugmsg;
+#include <linux/cdev.h>
+
+#ifndef HELLO_MAJOR
+#define HELLO_MAJOR 0 /* let kernel choose, unless user really defined it */
+#endif
+
+#define HELLO_KERNEL_BUFF_LEN 1024
+
+extern int hello_major;
+extern int hello_minor;
+
+extern char *magicstr;
+
+struct hello_dev {
+ dev_t devnum;
+ struct cdev cdev; /* char device */
+ /* for r/w operations */
+ char hello_buffer[HELLO_KERNEL_BUFF_LEN];
+ size_t buff_index;
+};
+
+/* function prototypes */
+int hello_debugfs(void);
#endif