[ Pobierz całość w formacie PDF ]
.current_request)#endif#define CURRENT_DEV DEVICE_NR(CURRENT->rq_dev)#ifdef DEVICE_INTRstatic void (*DEVICE_INTR)(void) = NULL;#endif#ifdef DEVICE_TIMEOUT#define SET_TIMER \((timer_table[DEVICE_TIMEOUT].expires = jiffies + TIMEOUT_VALUE), \(timer_active |= 1<<DEVICE_TIMEOUT))#define CLEAR_TIMER \timer_active &= ~(1<<DEVICE_TIMEOUT)#define SET_INTR(x) \if ((DEVICE_INTR = (x)) != NULL) \SET_TIMER; \else \CLEAR_TIMER;#else#define SET_INTR(x) (DEVICE_INTR = (x))#endif /* DEVICE_TIMEOUT */static void (DEVICE_REQUEST)(void);#ifdef DEVICE_INTR#define CLEAR_INTR SET_INTR(NULL)#else#define CLEAR_INTR#endif#define INIT_REQUEST \if (!CURRENT) {\CLEAR_INTR; \return; \} \if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) \panic(DEVICE_NAME ": request list destroyed"); \if (CURRENT->bh) { \if (!buffer_locked(CURRENT->bh)) \panic(DEVICE_NAME ": block not locked"); \}#endif /* !defined(IDE_DRIVER) *//* end_request() - SCSI devices have their own version *//* - IDE drivers have their own copy too */#if ! SCSI_BLK_MAJOR(MAJOR_NR)#if defined(IDE_DRIVER) && !defined(_IDE_C) /* shared copy for IDE modules */void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup);#else#ifdef IDE_DRIVERvoid ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup) {struct request *req = hwgroup->rq;#elsestatic void end_request(int uptodate) {struct request *req = CURRENT;#endif /* IDE_DRIVER */struct buffer_head * bh;req->errors = 0;if (!uptodate) {printk("end_request: I/O error, dev %s, sector %lu\n",kdevname(req->rq_dev), req->sector);req->nr_sectors--;req->nr_sectors &= ~SECTOR_MASK;req->sector += (BLOCK_SIZE / 512);req->sector &= ~SECTOR_MASK;}if ((bh = req->bh) != NULL) {req->bh = bh->b_reqnext;bh->b_reqnext = NULL;mark_buffer_uptodate(bh, uptodate);unlock_buffer(bh);if ((bh = req->bh) != NULL) {req->current_nr_sectors = bh->b_size >> 9;if (req->nr_sectors < req->current_nr_sectors) {req->nr_sectors = req->current_nr_sectors;printk("end_request: buffer-list destroyed\n");}req->buffer = bh->b_data;return;}}#ifndef DEVICE_NO_RANDOMadd_blkdev_randomness(MAJOR(req->rq_dev));#endif#ifdef IDE_DRIVERblk_dev[MAJOR(req->rq_dev)].current_request = req->next;hwgroup->rq = NULL;#elseDEVICE_OFF(req->rq_dev);CURRENT = req->next;#endif /* IDE_DRIVER */if (req->sem != NULL)up(req->sem);req->rq_status = RQ_INACTIVE;wake_up(&wait_for_request);}#endif /* defined(IDE_DRIVER) && !defined(_IDE_C) */#endif /* ! SCSI_BLK_MAJOR(MAJOR_NR) */#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */#endif /* _BLK_H */
[ Pobierz całość w formacie PDF ]