pktcdvd.c (3f3942aca6da351a12543aa776467791b63b3a78) | pktcdvd.c (5657a819a8d94426c76be04dcedfad0f64cfff00) |
---|---|
1/* 2 * Copyright (C) 2000 Jens Axboe <axboe@suse.de> 3 * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com> 4 * Copyright (C) 2006 Thomas Maier <balagi@justmail.de> 5 * 6 * May be copied or modified under the terms of the GNU General Public 7 * License. See linux/COPYING for more information. 8 * --- 464 unchanged lines hidden (view full) --- 473static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) 474{ 475 if (!pkt_debugfs_root) 476 return; 477 pd->dfs_d_root = debugfs_create_dir(pd->name, pkt_debugfs_root); 478 if (!pd->dfs_d_root) 479 return; 480 | 1/* 2 * Copyright (C) 2000 Jens Axboe <axboe@suse.de> 3 * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com> 4 * Copyright (C) 2006 Thomas Maier <balagi@justmail.de> 5 * 6 * May be copied or modified under the terms of the GNU General Public 7 * License. See linux/COPYING for more information. 8 * --- 464 unchanged lines hidden (view full) --- 473static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) 474{ 475 if (!pkt_debugfs_root) 476 return; 477 pd->dfs_d_root = debugfs_create_dir(pd->name, pkt_debugfs_root); 478 if (!pd->dfs_d_root) 479 return; 480 |
481 pd->dfs_f_info = debugfs_create_file("info", S_IRUGO, 482 pd->dfs_d_root, pd, &debug_fops); | 481 pd->dfs_f_info = debugfs_create_file("info", 0444, 482 pd->dfs_d_root, pd, &debug_fops); |
483} 484 485static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd) 486{ 487 if (!pkt_debugfs_root) 488 return; 489 debugfs_remove(pd->dfs_f_info); 490 debugfs_remove(pd->dfs_d_root); --- 208 unchanged lines hidden (view full) --- 699 */ 700static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *cgc) 701{ 702 struct request_queue *q = bdev_get_queue(pd->bdev); 703 struct request *rq; 704 int ret = 0; 705 706 rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ? | 483} 484 485static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd) 486{ 487 if (!pkt_debugfs_root) 488 return; 489 debugfs_remove(pd->dfs_f_info); 490 debugfs_remove(pd->dfs_d_root); --- 208 unchanged lines hidden (view full) --- 699 */ 700static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *cgc) 701{ 702 struct request_queue *q = bdev_get_queue(pd->bdev); 703 struct request *rq; 704 int ret = 0; 705 706 rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ? |
707 REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); | 707 REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); |
708 if (IS_ERR(rq)) 709 return PTR_ERR(rq); 710 711 if (cgc->buflen) { 712 ret = blk_rq_map_kern(q, rq, cgc->buffer, cgc->buflen, | 708 if (IS_ERR(rq)) 709 return PTR_ERR(rq); 710 711 if (cgc->buflen) { 712 ret = blk_rq_map_kern(q, rq, cgc->buffer, cgc->buflen, |
713 __GFP_RECLAIM); | 713 GFP_NOIO); |
714 if (ret) 715 goto out; 716 } 717 718 scsi_req(rq)->cmd_len = COMMAND_SIZE(cgc->cmd[0]); 719 memcpy(scsi_req(rq)->cmd, cgc->cmd, CDROM_PACKET_SIZE); 720 721 rq->timeout = 60*HZ; --- 558 unchanged lines hidden (view full) --- 1280 BUG(); 1281 } 1282 pkt_dbg(2, pd, "vcnt=%d\n", pkt->w_bio->bi_vcnt); 1283 1284 /* 1285 * Fill-in bvec with data from orig_bios. 1286 */ 1287 spin_lock(&pkt->lock); | 714 if (ret) 715 goto out; 716 } 717 718 scsi_req(rq)->cmd_len = COMMAND_SIZE(cgc->cmd[0]); 719 memcpy(scsi_req(rq)->cmd, cgc->cmd, CDROM_PACKET_SIZE); 720 721 rq->timeout = 60*HZ; --- 558 unchanged lines hidden (view full) --- 1280 BUG(); 1281 } 1282 pkt_dbg(2, pd, "vcnt=%d\n", pkt->w_bio->bi_vcnt); 1283 1284 /* 1285 * Fill-in bvec with data from orig_bios. 1286 */ 1287 spin_lock(&pkt->lock); |
1288 bio_copy_data(pkt->w_bio, pkt->orig_bios.head); | 1288 bio_list_copy_data(pkt->w_bio, pkt->orig_bios.head); |
1289 1290 pkt_set_state(pkt, PACKET_WRITE_WAIT_STATE); 1291 spin_unlock(&pkt->lock); 1292 1293 pkt_dbg(2, pd, "Writing %d frames for zone %llx\n", 1294 pkt->write_size, (unsigned long long)pkt->sector); 1295 1296 if (test_bit(PACKET_MERGE_SEGS, &pd->flags) || (pkt->write_size < pkt->frames)) --- 1236 unchanged lines hidden (view full) --- 2533 states[0], states[1], states[2], states[3], states[4], states[5]); 2534 2535 seq_printf(m, "\twrite congestion marks:\toff=%d on=%d\n", 2536 pd->write_congestion_off, 2537 pd->write_congestion_on); 2538 return 0; 2539} 2540 | 1289 1290 pkt_set_state(pkt, PACKET_WRITE_WAIT_STATE); 1291 spin_unlock(&pkt->lock); 1292 1293 pkt_dbg(2, pd, "Writing %d frames for zone %llx\n", 1294 pkt->write_size, (unsigned long long)pkt->sector); 1295 1296 if (test_bit(PACKET_MERGE_SEGS, &pd->flags) || (pkt->write_size < pkt->frames)) --- 1236 unchanged lines hidden (view full) --- 2533 states[0], states[1], states[2], states[3], states[4], states[5]); 2534 2535 seq_printf(m, "\twrite congestion marks:\toff=%d on=%d\n", 2536 pd->write_congestion_off, 2537 pd->write_congestion_on); 2538 return 0; 2539} 2540 |
2541static int pkt_seq_open(struct inode *inode, struct file *file) 2542{ 2543 return single_open(file, pkt_seq_show, PDE_DATA(inode)); 2544} 2545 2546static const struct file_operations pkt_proc_fops = { 2547 .open = pkt_seq_open, 2548 .read = seq_read, 2549 .llseek = seq_lseek, 2550 .release = single_release 2551}; 2552 |
|
2541static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) 2542{ 2543 int i; 2544 int ret = 0; 2545 char b[BDEVNAME_SIZE]; 2546 struct block_device *bdev; 2547 2548 if (pd->pkt_dev == dev) { --- 38 unchanged lines hidden (view full) --- 2587 atomic_set(&pd->cdrw.pending_bios, 0); 2588 pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name); 2589 if (IS_ERR(pd->cdrw.thread)) { 2590 pkt_err(pd, "can't start kernel thread\n"); 2591 ret = -ENOMEM; 2592 goto out_mem; 2593 } 2594 | 2553static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) 2554{ 2555 int i; 2556 int ret = 0; 2557 char b[BDEVNAME_SIZE]; 2558 struct block_device *bdev; 2559 2560 if (pd->pkt_dev == dev) { --- 38 unchanged lines hidden (view full) --- 2599 atomic_set(&pd->cdrw.pending_bios, 0); 2600 pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name); 2601 if (IS_ERR(pd->cdrw.thread)) { 2602 pkt_err(pd, "can't start kernel thread\n"); 2603 ret = -ENOMEM; 2604 goto out_mem; 2605 } 2606 |
2595 proc_create_single_data(pd->name, 0, pkt_proc, pkt_seq_show, pd); | 2607 proc_create_data(pd->name, 0, pkt_proc, &pkt_proc_fops, pd); |
2596 pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); 2597 return 0; 2598 2599out_mem: 2600 blkdev_put(bdev, FMODE_READ | FMODE_NDELAY); 2601 /* This is safe: open() is still holding a reference. */ 2602 module_put(THIS_MODULE); 2603 return ret; --- 365 unchanged lines hidden --- | 2608 pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); 2609 return 0; 2610 2611out_mem: 2612 blkdev_put(bdev, FMODE_READ | FMODE_NDELAY); 2613 /* This is safe: open() is still holding a reference. */ 2614 module_put(THIS_MODULE); 2615 return ret; --- 365 unchanged lines hidden --- |