?? scullp.h
字號:
/* * scullp.h -- definitions for the page-oriented char module * *********/#include <linux/ioctl.h>/* version dependencies have been confined to a separate file */#include "sysdep.h"/* * Macros to help debugging */#undef PDEBUG /* undef it, just in case */#ifdef SCULLP_DEBUG# ifdef __KERNEL__ /* This one if debugging is on, and kernel space */# define PDEBUG(fmt, args...) printk( KERN_DEBUG "scullp: " fmt, ## args)# else /* This one for user space */# define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)# endif#else# define PDEBUG(fmt, args...) /* not debugging: nothing */#endif#undef PDEBUGG#define PDEBUGG(fmt, args...) /* nothing: it's a placeholder */#define SCULLP_MAJOR 0 /* dynamic major by default */#define SCULLP_DEVS 4 /* scullp0 through scullp3 *//* * The bare device is a variable-length region of memory. * Use a linked list of indirect blocks. * * "ScullP_Dev->data" points to an array of pointers, each * pointer refers to a memory page. * * The array (quantum-set) is SCULLP_QSET long. */#define SCULLP_ORDER 0 /* one page at a time */#define SCULLP_QSET 500typedef struct ScullP_Dev { void **data; struct ScullP_Dev *next; /* next listitem */ int vmas; /* active mappings */ int order; /* the current allocation order */ int qset; /* the current array size */ size_t size; /* 32-bit will suffice */} ScullP_Dev;extern ScullP_Dev *scullp_devices;extern struct file_operations scullp_fops;/* * The different configurable parameters */extern int scullp_major; /* main.c */extern int scullp_devs;extern int scullp_order;extern int scullp_qset;/* * Prototypes for shared functions */int scullp_trim(ScullP_Dev *dev);ScullP_Dev *scullp_follow(ScullP_Dev *dev, int n);#ifdef SCULLP_DEBUG# if LINUX_VERSION_CODE > VERSION_CODE(1,99,3) /* 1.99.4 exported the needed symbols */# define SCULLP_USE_PROC# endif#endif#ifndef min# define min(a,b) ((a)<(b) ? (a) : (b))#endif/* * Ioctl definitions *//* Use 'K' as magic number */#define SCULLP_IOC_MAGIC 'K'#define SCULLP_IOCRESET _IO(SCULLP_IOC_MAGIC, 0)/* * S means "Set" through a ptr, * T means "Tell" directly * G means "Get" (to a pointed var) * Q means "Query", response is on the return value * X means "eXchange": G and S atomically * H means "sHift": T and Q atomically */#define SCULLP_IOCSORDER _IOW(SCULLP_IOC_MAGIC, 1, scullp_order)#define SCULLP_IOCSQSET _IOW(SCULLP_IOC_MAGIC, 2, scullp_qset)#define SCULLP_IOCTORDER _IO(SCULLP_IOC_MAGIC, 3)#define SCULLP_IOCTQSET _IO(SCULLP_IOC_MAGIC, 4)#define SCULLP_IOCGORDER _IOR(SCULLP_IOC_MAGIC, 5, scullp_order)#define SCULLP_IOCGQSET _IOR(SCULLP_IOC_MAGIC, 6, scullp_qset)#define SCULLP_IOCQORDER _IO(SCULLP_IOC_MAGIC, 7)#define SCULLP_IOCQQSET _IO(SCULLP_IOC_MAGIC, 8)#define SCULLP_IOCXORDER _IOWR(SCULLP_IOC_MAGIC, 9, scullp_order)#define SCULLP_IOCXQSET _IOWR(SCULLP_IOC_MAGIC,10, scullp_qset)#define SCULLP_IOCHORDER _IO(SCULLP_IOC_MAGIC, 11)#define SCULLP_IOCHQSET _IO(SCULLP_IOC_MAGIC, 12)#define SCULLP_IOCHARDRESET _IO(SCULLP_IOC_MAGIC, 13) /* debugging tool */#define SCULLP_IOC_MAXNR 13
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -