Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 257335
Collapse All | Expand All

(-)cowloop-3.0-gentoo/src/cowdev.c (-2 / +2 lines)
Lines 198-205 pairadd (char *rdopath, char *cowpath, c Link Here
198
	/*
198
	/*
199
	** fill structure info for ioctl COWMKPAIR
199
	** fill structure info for ioctl COWMKPAIR
200
	*/
200
	*/
201
	cowpair.rdofile		= rdopath;
201
	cowpair.rdofile		= (u_char*)rdopath;
202
	cowpair.cowfile		= cowpath;
202
	cowpair.cowfile		= (u_char*)cowpath;
203
203
204
	cowpair.rdoflen		= strlen(rdopath);
204
	cowpair.rdoflen		= strlen(rdopath);
205
	cowpair.cowflen		= strlen(cowpath);
205
	cowpair.cowflen		= strlen(cowpath);
(-)cowloop-3.0-gentoo/src/cowloop.c (-6 / +20 lines)
Lines 408-414 static long int cowlo_readcowraw (struct Link Here
408
static long int cowlo_writecow   (struct cowloop_device *, void *, int, loff_t);
411
static long int cowlo_writecow   (struct cowloop_device *, void *, int, loff_t);
409
static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t);
412
static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t);
410
413
411
static int      cowlo_ioctl      (struct inode *, struct file *,
414
static int      cowlo_ioctl      (struct block_device *, fmode_t,
412
           			 		unsigned int, unsigned long);
415
           			 		unsigned int, unsigned long);
413
416
414
static int	cowlo_makepair    (struct cowpair __user *);
417
static int	cowlo_makepair    (struct cowpair __user *);
Lines 434-441 static void cowlo_undo_opencow(struct co Link Here
434
**    < 0   - error value
437
**    < 0   - error value
435
*/
438
*/
436
static int
439
static int
437
cowlo_open(struct inode *inode, struct file *file)
440
cowlo_open(struct block_device *bdev, fmode_t mode)
438
{
441
{
442
	struct inode *inode = bdev->bd_inode;
443
439
	if (!inode)
444
	if (!inode)
440
		return -EINVAL;
445
		return -EINVAL;
441
446
Lines 474-483 cowlo_open(struct inode *inode, struct f Link Here
474
**    < 0   - error value
479
**    < 0   - error value
475
*/
480
*/
476
static int
481
static int
477
cowlo_release(struct inode *inode, struct file *file)
482
cowlo_release(struct gendisk *gd, fmode_t mode)
478
{
483
{
484
	struct block_device *bdev;
485
	struct inode *inode;
479
	int err = 0;
486
	int err = 0;
480
487
488
	bdev = bdget_disk(gd, 0);
489
	inode = bdev->bd_inode;
490
481
	if (!inode)
491
	if (!inode)
482
		return 0;
492
		return 0;
483
493
Lines 497-505 cowlo_release(struct inode *inode, struc Link Here
497
**    < 0   - error value
507
**    < 0   - error value
498
*/
508
*/
499
static int
509
static int
500
cowlo_ioctl(struct inode *inode, struct file *filp,
510
cowlo_ioctl(struct block_device *bdev, fmode_t mode,
501
            unsigned int cmd, unsigned long arg)
511
            unsigned int cmd, unsigned long arg)
502
{
512
{
513
	struct inode *inode = bdev->bd_inode;
503
	struct hd_geometry	geo;
514
	struct hd_geometry	geo;
504
515
505
	DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd);
516
	DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd);
Lines 2067-2073 cowlo_openrdo(struct cowloop_device *cow Link Here
2067
			cowdev->belowq = cowdev->belowgd->queue;
2086
			cowdev->belowq = cowdev->belowgd->queue;
2068
2087
2069
			if (cowdev->numblocks == 0)
2088
			if (cowdev->numblocks == 0)
2070
				cowdev->numblocks = cowdev->belowgd->capacity
2089
				cowdev->numblocks = get_capacity(cowdev->belowgd)
2071
                         					/ (MAPUNIT/512);
2090
                         					/ (MAPUNIT/512);
2072
		}
2091
		}
2073
2092
Lines 2639-2644 cowlo_init_module(void) Link Here
2639
{
2658
{
2640
	int	rv;
2659
	int	rv;
2641
	int	minor, uptocows;
2660
	int	minor, uptocows;
2661
	spinlock_t ilock;	/* Initial lock for the default queue assigned on load */
2642
2662
2643
        revision[sizeof revision - 3] = '\0';
2663
        revision[sizeof revision - 3] = '\0';
2644
2664
Lines 2748-2754 cowlo_init_module(void) Link Here
2748
	** allocate fake disk as control channel to handle the requests
2768
	** allocate fake disk as control channel to handle the requests
2749
	** to activate and deactivate cowdevices dynamically 
2769
	** to activate and deactivate cowdevices dynamically 
2750
	*/
2770
	*/
2751
	if ((cowctlgd = alloc_disk(1)) == NULL) {
2771
	if (!(cowctlgd = alloc_disk(1))) {
2752
		printk(KERN_WARNING
2772
		printk(KERN_WARNING
2753
		       "cowloop - unable to alloc_disk for cowctl\n");
2773
		       "cowloop - unable to alloc_disk for cowctl\n");
2754
2774
Lines 2759-2769 cowlo_init_module(void) Link Here
2759
		goto error_out;
2779
		goto error_out;
2760
	}
2780
	}
2761
2781
2782
	spin_lock_init(&ilock);
2783
2762
	cowctlgd->major        = COWMAJOR;
2784
	cowctlgd->major        = COWMAJOR;
2763
	cowctlgd->first_minor  = COWCTL;
2785
	cowctlgd->first_minor  = COWCTL;
2764
	cowctlgd->minors       = 1;
2786
	cowctlgd->minors       = 1;
2765
	cowctlgd->fops         = &cowlo_fops;
2787
	cowctlgd->fops         = &cowlo_fops;
2766
	cowctlgd->private_data = NULL;
2788
	cowctlgd->private_data = NULL;
2789
	/* The device is of capacity 0, so there won't be any queue request */
2790
	cowctlgd->queue        = blk_init_queue(NULL, &ilock);
2767
	sprintf(cowctlgd->disk_name, "cowctl");
2791
	sprintf(cowctlgd->disk_name, "cowctl");
2768
	set_capacity(cowctlgd, 0);
2792
	set_capacity(cowctlgd, 0);
2769
2793
Lines 2817-2822 cowlo_cleanup_module(void) Link Here
2817
	}
2845
	}
2818
	kfree(cowdevall);
2846
	kfree(cowdevall);
2819
2847
2848
	blk_cleanup_queue(cowctlgd->queue); /* cleanup the empty queue */
2820
	del_gendisk(cowctlgd);  /* revert the alloc_disk() */
2849
	del_gendisk(cowctlgd);  /* revert the alloc_disk() */
2821
	put_disk   (cowctlgd);  /* revert the add_disk()   */
2850
	put_disk   (cowctlgd);  /* revert the add_disk()   */
2822
2851

Return to bug 257335