Well I have finally come back to this program and I am trying to get my actual driver to work so that i can call it from any type of program. I am gettin an error though and I am not sure how to fix it. The code for my driver is the following.
#include <linux/config.h>
#include <asm/io.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/fs.h>
//#include <linux/mm.h>
#include <linux/errno.h>
#include <asm/segment.h>
static int base = 0x378;
static int write_Lights(node, file, buf, count)
struct inode *node;
struct file *file;
char *buf;
int count;
{
char i = get_user_byte(buf);
outb(i,base);
return 1;
}
static int read_Lights(file, buf, count, offset)
struct file *file;
char *buf;
int count;
char *offset;
{
return 1;
}
static int open_Lights(node, file)
struct inode *node;
struct file *file;
{
return 1;
}
static struct file_operations Lights_ops={
NULL,
NULL,
read_Lights,
write_Lights,
NULL,
NULL,
NULL,
NULL,
open_Lights,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
i use the following makefile to compile it.
#/bin/bash
CFLAGS = -O -DMODULE -D__KERNEL__
CC=gcc
ALL: driver.o
driver.o: driver.c
$(CC) $(CFLAGS) -c driver.c
I get the following output from the compile.
root@localhost IOINFO]# make
gcc -O -DMODULE -D__KERNEL__ -c driver.c
In file included from driver.c:2:
/usr/include/asm/io.h:4:2: warning: #warning <asm/io.h> is deprecated, use <sys/io.h> instead
driver.c:41: error: variable `Lights_ops' has initializer but incomplete type
driver.c:42: warning: excess elements in struct initializer
driver.c:42: warning: (near initialization for `Lights_ops')
driver.c:43: warning: excess elements in struct initializer
driver.c:43: warning: (near initialization for `Lights_ops')
driver.c:44: warning: excess elements in struct initializer
driver.c:44: warning: (near initialization for `Lights_ops')
driver.c:45: warning: excess elements in struct initializer
driver.c:45: warning: (near initialization for `Lights_ops')
driver.c:46: warning: excess elements in struct initializer
driver.c:46: warning: (near initialization for `Lights_ops')
driver.c:47: warning: excess elements in struct initializer
driver.c:47: warning: (near initialization for `Lights_ops')
driver.c:48: warning: excess elements in struct initializer
driver.c:48: warning: (near initialization for `Lights_ops')
driver.c:49: warning: excess elements in struct initializer
driver.c:49: warning: (near initialization for `Lights_ops')
driver.c:50: warning: excess elements in struct initializer
driver.c:50: warning: (near initialization for `Lights_ops')
driver.c:51: warning: excess elements in struct initializer
driver.c:51: warning: (near initialization for `Lights_ops')
driver.c:52: warning: excess elements in struct initializer
driver.c:52: warning: (near initialization for `Lights_ops')
driver.c:53: warning: excess elements in struct initializer
driver.c:53: warning: (near initialization for `Lights_ops')
driver.c:54: warning: excess elements in struct initializer
driver.c:54: warning: (near initialization for `Lights_ops')
driver.c:55: warning: excess elements in struct initializer
driver.c:55: warning: (near initialization for `Lights_ops')
driver.c:56: warning: excess elements in struct initializer
driver.c:56: warning: (near initialization for `Lights_ops')
driver.c:57: warning: excess elements in struct initializer
driver.c:57: warning: (near initialization for `Lights_ops')
driver.c:58: warning: excess elements in struct initializer
driver.c:58: warning: (near initialization for `Lights_ops')
driver.c:59: warning: excess elements in struct initializer
driver.c:59: warning: (near initialization for `Lights_ops')
driver.c:41: error: storage size of `Lights_ops' isn't known
make: *** [driver.o] Error 1
I need to know what it means to not have the storage size of the struct file_operations. I have googled and so far have not found anything usefull about it. Also I am trying to get this working on a stock Fedora Core 1 Machine with Linux version 2.4.22-1.2115.nptl (
bhcompile@daffy.perf.redhat.com) (gcc version 3.2.3 20030422 (Red Hat Linux 3.2.3-6))