Re-compile a previous driver test module
Previously it was in fc9, but fc14 encountered the following compilation error,
Make: Entering directory '/usr/src/kernels/2.6.35.6-45. fc14.i686'
CC [m]/home/TY/development/driver/ch6/globalmem. o
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ read ':
/Home/TY/development/driver/ch6/globalmem. c: 77: 7: Warning: format' % d' expects type 'int', but argument 3 has type 'long unsigned int'
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ write ':
/Home/TY/development/driver/ch6/globalmem. c: 100: 7: Warning: format' % d' expects type 'int', but argument 3 has type 'long unsigned int'
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ init ':
/Home/TY/development/driver/ch6/globalmem. C: 185: 3:Error: Implicit declaration of function 'kmalloc'
/Home/TY/development/driver/ch6/globalmem. C: 185: 18: Warning: Assignment makes pointer from integer without a cast
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ exit ':
/Home/TY/development/driver/ch6/globalmem. C: 202: 3: Error: Implicit declaration of function 'kfree'
Make [1]: *** [/home/TY/development/driver/ch6/globalmem. O] Error 1
Make: *** [_ module _/home/TY/development/driver/ch6] Error 2
Make: Leaving directory '/usr/src/kernels/2.6.35.6-45. fc14.i686'
I found it online, but a header file is missing.
# Include <Linux/slab. h>
After adding it, there will be no problem.
DriverSource code
Http://blog.csdn.net/tiany524/archive/2010/09/14/5884535.aspx