dasd_int.h

来自「linux-2.4.29操作系统的源码」· C头文件 代码 · 共 502 行 · 第 1/2 页

H
502
字号
/*  * File...........: linux/drivers/s390/block/dasd_int.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> *                  Horst Hummel <Horst.Hummel@de.ibm.com>  * Bugreports.to..: <Linux390@de.ibm.com> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * * $Revision: 1.36 $ * * History of changes (starts July 2000) * 02/01/01 added dynamic registration of ioctls */#ifndef DASD_INT_H#define DASD_INT_H#include <asm/dasd.h>#define CONFIG_DASD_DYNAMICtypedef int(*dasd_ioctl_fn_t) (void *inp, int no, long args);int dasd_ioctl_no_register(struct module *, int no, dasd_ioctl_fn_t handler);int dasd_ioctl_no_unregister(struct module *, int no, dasd_ioctl_fn_t handler);#define DASD_NAME "dasd"#define DASD_PER_MAJOR ( 1U<<(MINORBITS-DASD_PARTN_BITS))#define DASD_FORMAT_INTENS_WRITE_RECZERO 0x01#define DASD_FORMAT_INTENS_WRITE_HOMEADR 0x02#define DASD_STATE_DEL   -1     /* "unknown" */#define DASD_STATE_NEW    0     /* memory for dasd_device_t and lowmem ccw/idals allocated */  #define DASD_STATE_BOXED  1     /* boxed dasd could not be analysed "plugged" */#define DASD_STATE_KNOWN  2     /* major_info/devinfo/discipline/devfs-'device'/gendisk - "detected" */#define DASD_STATE_ACCEPT 3     /* irq requested - "accepted" */#define DASD_STATE_INIT   4     /* init_cqr started - "busy" */#define DASD_STATE_READY  5     /* init finished  - "fenced(plugged)" */#define DASD_STATE_ONLINE 6     /* unplugged "active" */#define DASD_HOTPLUG_EVENT_ADD        0#define DASD_HOTPLUG_EVENT_REMOVE     1#define DASD_HOTPLUG_EVENT_PARTCHK    2#define DASD_HOTPLUG_EVENT_PARTREMOVE 3#define DASD_FORMAT_INTENS_WRITE_RECZERO 0x01#define DASD_FORMAT_INTENS_WRITE_HOMEADR 0x02#define DASD_FORMAT_INTENS_INVALIDATE    0x04#define DASD_FORMAT_INTENS_CDL 0x08#ifdef __KERNEL__#include <linux/module.h>#include <linux/version.h>#include <linux/major.h>#include <linux/wait.h>#include <linux/blk.h> #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))#include <linux/blkdev.h> #include <linux/devfs_fs_kernel.h>#endif#include <linux/genhd.h>#include <linux/hdreg.h>#include <linux/compatmac.h>#include <asm/ccwcache.h>#include <asm/irq.h>#include <asm/s390dyn.h>#include <asm/todclk.h>#include <asm/debug.h>/******************************************************************************** * SECTION: Kernel Version Compatibility section  ********************************************************************************/#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))typedef struct request *request_queue_t;#define block_device_operations file_operations#define __setup(x,y) struct dasd_device_t#define devfs_register_blkdev(major,name,ops) register_blkdev(major,name,ops)#define register_disk(dd,dev,partn,ops,size) \do { \	dd->sizes[MINOR(dev)] = size >> 1; \	resetup_one_dev(dd,MINOR(dev)>>DASD_PARTN_BITS); \} while(0)#define init_waitqueue_head(x) do { *x = NULL; } while(0)#define blk_cleanup_queue(x) do {} while(0)#define blk_init_queue(x...) do {} while(0)#define blk_queue_headactive(x...) do {} while(0)#define blk_queue_make_request(x) do {} while(0)#define list_empty(x) (0)#define INIT_BLK_DEV(d_major,d_request_fn,d_queue_fn,d_current) \do { \        blk_dev[d_major].request_fn = d_request_fn; \        blk_dev[d_major].queue = d_queue_fn; \        blk_dev[d_major].current_request = d_current; \} while(0)#define INIT_GENDISK(D_MAJOR,D_NAME,D_PARTN_BITS,D_PER_MAJOR) \	major:D_MAJOR, \	major_name:D_NAME, \	minor_shift:D_PARTN_BITS, \	max_p:1 << D_PARTN_BITS, \	max_nr:D_PER_MAJOR, \	nr_real:D_PER_MAJOR,static inline struct request * dasd_next_request( request_queue_t *queue ) {    return *queue;}static inline void dasd_dequeue_request( request_queue_t * q, struct request *req ){        *q = req->next;        req->next = NULL;}#else#define INIT_BLK_DEV(d_major,d_request_fn,d_queue_fn,d_current) \do { \        blk_dev[d_major].queue = d_queue_fn; \} while(0)#define INIT_GENDISK(D_MAJOR,D_NAME,D_PARTN_BITS,D_PER_MAJOR) \	major:D_MAJOR, \	major_name:D_NAME, \	minor_shift:D_PARTN_BITS, \	max_p:1 << D_PARTN_BITS, \	nr_real:D_PER_MAJOR, \        fops:&dasd_device_operations, static inline struct request * dasd_next_request( request_queue_t *queue ) {        return blkdev_entry_next_request(&queue->queue_head);}static inline void dasd_dequeue_request( request_queue_t * q, struct request *req ){        blkdev_dequeue_request (req);}#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98)) *//******************************************************************************** * SECTION: Type definitions ********************************************************************************/typedef struct dasd_devreg_t {        devreg_t devreg; /* the devreg itself */        /* build a linked list of devregs, needed for cleanup */        struct list_head list;} dasd_devreg_t;typedef struct {	struct list_head list;	struct module *owner;	int no;	dasd_ioctl_fn_t handler;} dasd_ioctl_list_t;typedef enum {	dasd_era_fatal = -1,	/* no chance to recover              */	dasd_era_none = 0,	/* don't recover, everything alright */	dasd_era_msg = 1,	/* don't recover, just report...     */	dasd_era_recover = 2	/* recovery action recommended       */} dasd_era_t;/* BIT DEFINITIONS FOR SENSE DATA */#define DASD_SENSE_BIT_0 0x80#define DASD_SENSE_BIT_1 0x40#define DASD_SENSE_BIT_2 0x20#define DASD_SENSE_BIT_3 0x10/*  * struct dasd_sizes_t * represents all data needed to access dasd with properly set up sectors */typedefstruct dasd_sizes_t {	unsigned long blocks; /* size of volume in blocks */	unsigned int bp_block; /* bytes per block */	unsigned int s2b_shift; /* log2 (bp_block/512) */        unsigned int pt_block; /* from which block to read the partn table */} dasd_sizes_t;/*  * struct dasd_chanq_t  * represents a queue of channel programs related to a single device */typedefstruct dasd_chanq_t {	ccw_req_t *head;	ccw_req_t *tail;} dasd_chanq_t;/*  * struct dasd_lowmem_t  * represents a queue of pages for lowmem request */typedef struct {        struct list_head list;} dasd_lowmem_t;#define DASD_LOWMEM_PAGES 2     /* # of lowmem pages per device (min 2) *//******************************************************************************** * SECTION: MACROS ********************************************************************************//* * CHECK_THEN_SET * * Change 'where' value from 'from' to 'to'. ' BUG if the 'from' value doesn't match. */#define check_then_set(where,from,to) \do { \        if ((*(where)) != (from) ) { \                printk (KERN_ERR PRINTK_HEADER "was %d\n", *(where)); \                BUG(); \        } \        (*(where)) = (to); \} while(0)/******************************************************************************** * SECION: MACROs for klogd and s390 debug feature (dbf) ********************************************************************************/#define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \do { \        if (d_device->debug_area != NULL) \                debug_sprintf_event(d_device->debug_area, \                                    d_level, \                                    d_str "\n", \                                    d_data); \} while(0)#define DBF_DEV_EXC(d_level, d_device, d_str, d_data...) \do { \        if (d_device->debug_area != NULL) \                debug_sprintf_exception(d_device->debug_area, \                                        d_level, \                                        d_str "\n", \                                        d_data); \} while(0)#define DBF_EVENT(d_level, d_str, d_data...)\do { \        if (dasd_debug_area != NULL) \                debug_sprintf_event(dasd_debug_area, \                                    d_level,\                                    d_str "\n", \                                    d_data); \} while(0)#define DBF_EXC(d_level, d_str, d_data...)\

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?