I would like to write a linux block device driver. The driver would not need to access the hardware so it can be in userspace.
To start, I have tried to build an example block device driver with this Makefile:
obj-m = sbd.o KVERSION = $(shell pwd) PWD = $(shell pwd) all: make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules I however get these errors which I do not know how to fix. Here is the stdout and stderr:
make -C /lib/modules/2.6.31-19-generic/build M=/home/andreas/sp/nivoa/src/driver/sbd modules make[1]: Entering directory `/usr/src/linux-headers-2.6.31-19-generic' CC [M] /home/andreas/sp/nivoa/src/driver/sbd/sbd.o /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:72: error: expected ‘)’ before ‘*’ token /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:128: warning: initialization from incompatible pointer type /home/andreas/sp/nivoa/src/driver/sbd/sbd.c: In function ‘sbd_init’: /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:143: error: ‘sbd_request’ undeclared (first use in this function) /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:143: error: (Each undeclared identifier is reported only once /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:143: error: for each function it appears in.) /home/andreas/sp/nivoa/src/driver/sbd/sbd.c:146: error: implicit declaration of function ‘blk_queue_hardsect_size’ make[2]: *** [/home/andreas/sp/nivoa/src/driver/sbd/sbd.o] Error 1 make[1]: *** [_module_/home/andreas/sp/nivoa/src/driver/sbd] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-19-generic' make: *** [all] Error 2
sbd.c:72: error: expected ‘)’ before ‘*’ token