[ Pobierz całość w formacie PDF ]
.request_fn)) {printk(KERN_NOTICE "ll_rw_swap_file: trying to swap to"" nonexistent block-device\n");return;}max_req = NR_REQUEST;switch (rw) {case READ:break;case WRITE:max_req = (NR_REQUEST * 2) / 3;if (is_read_only(dev)) {printk(KERN_NOTICE"Can't swap to read-only device %s\n",kdevname(dev));return;}break;default:panic("ll_rw_swap: bad block dev cmd, must be R/W");}buffersize = PAGE_SIZE / nb;if (major == LOOP_MAJOR)max_req >>= 1;for (j=0, i=0; i<nb;){for (; j < 8 && i < nb; j++, i++, buf += buffersize){rdev = dev;rsector = (b[i] * buffersize) >> 9;#ifdef CONFIG_BLK_DEV_MDif (major==MD_MAJOR &&md_map (MINOR(dev), &rdev,&rsector, buffersize >> 9)) {printk (KERN_ERR"Bad md_map in ll_rw_swap_file\n");return;}#endifif (j == 0) {req[j] = get_request_wait(max_req, rdev);} else {cli();req[j] = get_request(max_req, rdev);sti();if (req[j] == NULL)break;}req[j]->cmd = rw;req[j]->errors = 0;req[j]->sector = rsector;req[j]->nr_sectors = buffersize >> 9;req[j]->current_nr_sectors = buffersize >> 9;req[j]->buffer = buf;req[j]->sem = &sem;req[j]->bh = NULL;req[j]->next = NULL;add_request(MAJOR(rdev)+blk_dev,req[j]);}run_task_queue(&tq_disk);while (j > 0) {j--;down(&sem);}}}int blk_dev_init(void){struct request * req;struct blk_dev_struct *dev;for (dev = blk_dev + MAX_BLKDEV; dev-- != blk_dev;) {dev->request_fn = NULL;dev->current_request = NULL;dev->plug.rq_status = RQ_INACTIVE;dev->plug.cmd = -1;dev->plug.next = NULL;dev->plug_tq.routine = &unplug_device;dev->plug_tq.data = dev;}req = all_requests + NR_REQUEST;while (--req >= all_requests) {req->rq_status = RQ_INACTIVE;req->next = NULL;}memset(ro_bits,0,sizeof(ro_bits));#ifdef CONFIG_BLK_DEV_RAMrd_init();#endif#ifdef CONFIG_BLK_DEV_LOOPloop_init();#endif#ifdef CONFIG_CDI_INITcdi_init(); /* this MUST precede ide_init */#endif CONFIG_CDI_INIT#ifdef CONFIG_BLK_DEV_IDEide_init(); /* this MUST precede hd_init */#endif#ifdef CONFIG_BLK_DEV_HDhd_init();#endif#ifdef CONFIG_BLK_DEV_XDxd_init();#endif#ifdef CONFIG_BLK_DEV_FDfloppy_init();#elseoutb_p(0xc, 0x3f2);#endif#ifdef CONFIG_CDU31Acdu31a_init();#endif CONFIG_CDU31A#ifdef CONFIG_MCDmcd_init();#endif CONFIG_MCD#ifdef CONFIG_MCDXmcdx_init();#endif CONFIG_MCDX#ifdef CONFIG_SBPCDsbpcd_init();#endif CONFIG_SBPCD#ifdef CONFIG_AZTCDaztcd_init();#endif CONFIG_AZTCD#ifdef CONFIG_CDU535sony535_init();#endif CONFIG_CDU535#ifdef CONFIG_GSCDgscd_init();#endif CONFIG_GSCD#ifdef CONFIG_CM206cm206_init();#endif#ifdef CONFIG_OPTCDoptcd_init();#endif CONFIG_OPTCD#ifdef CONFIG_SJCDsjcd_init();#endif CONFIG_SJCD#ifdef CONFIG_BLK_DEV_MDmd_init();#endif CONFIG_BLK_DEV_MDreturn 0;}
[ Pobierz całość w formacie PDF ]