📄 tffsdrv.h
字号:
#ifndef __FLDRVLNX__H__#define __FLDRVLNX__H__/* check the kernel version */#include <linux/version.h>/* older kernels didn't define this */#ifndef KERNEL_VERSION# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))#endif/* not supported kernels */#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,7,0)# error "Linux Kernel Version 2.7.0 and later not supported"#else# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)# else# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)# error "Linux Kernel Version 2.5.0 not supported"# else# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)# else# error "Linux Kernel Version less that 2.4.0 not supported"# endif# endif# endif#endif#include <linux/config.h>#ifdef MODULE# ifdef CONFIG_MODVERSIONS# ifndef MODVERSIONS# define MODVERSIONS# endif# include <linux/modsetver.h># endif# include <linux/module.h># if (LINUX_VERSION_CODE>KERNEL_VERSION(2,5,0))# include <linux/moduleparam.h># endif#endif /* MODULE */#define LOG_DELAY /* delay here to avoid log's clobbering */#ifdef DRIVER_DEBUG# define PrintkDebug(fmt,args...) printk(KERN_DEBUG TFFS_DEVICE_NAME": "fmt"\n",## args);LOG_DELAY;#else /* DRIVER_DEBUG */# define PrintkDebug(fmt,args...)#endif /* DRIVER_DEBUG */#define PrintkInfo(fmt,args...) printk(KERN_INFO TFFS_DEVICE_NAME": "fmt"\n",## args);LOG_DELAY;#define PrintkError(fmt,args...) printk(KERN_ERR TFFS_DEVICE_NAME": "fmt"\n",## args);LOG_DELAY;#define PrintkWarning(fmt,args...) printk(KERN_WARNING TFFS_DEVICE_NAME": "fmt"\n",## args);LOG_DELAY;#if (LINUX_VERSION_CODE<KERNEL_VERSION(2,5,0))# include <asm/semaphore.h> /* struct semaphore */#endif#include <linux/string.h> /* mem... */#include <asm/io.h> /* ioremap_nocache */#include <linux/vmalloc.h> /* kmalloc, kfree */typedef struct{#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)# ifndef DO_NOT_YIELD_CPU struct semaphore threadSemaphore; spinlock_t ioLock; wait_queue_head_t waitQueueHead;# endif unsigned char threadInit;#endif int maxSectorSize; unsigned char fPowerOn; unsigned char handle; /* socket, as ioreq.irHandle */#ifdef TFFS_ALLOW_UNFORMATTED unsigned char fDummy;#endif}SocketInfo;typedef struct{ unsigned char lastTffsError; unsigned char handle; /* socket & partition, as ioreq.irHandle */ unsigned char fValid; /* TRUE - device exist and dformatted */ unsigned long size; /* device size */ int sectorSize; SocketInfo*pSocket; struct gendisk*genDisk; int usage;#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) struct request_queue*requestQueue; spinlock_t queueLock; spinlock_t o_c_lock;# ifndef DO_NOT_YIELD_CPU unsigned char threadInit; struct semaphore threadSemaphore; wait_queue_head_t waitQueueHead;# endif#endif}DeviceInfo;typedef struct{ int noOfSockets; int noOfDevices; SocketInfo*pSockets; DeviceInfo*pDevices; int major;}TheDiskInfo;/* some "windows" types */#ifndef DWORD# define DWORD unsigned long#endif#ifndef WORD# define WORD unsigned short#endif#ifndef BYTE# define BYTE unsigned char#endif#ifndef BOOL# define BOOL unsigned char#endif#ifndef TRUE# define TRUE 1#endif#ifndef FALSE# define FALSE 0#endif#endif /*#ifndef __FLDRVLNX__H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -