diff -pur /tmp/cowloop-3.0/src/cowdev.c cowloop-3.0/src/cowdev.c --- /tmp/cowloop-3.0/src/cowdev.c 2006-12-12 10:28:17.000000000 +1100 +++ cowloop-3.0/src/cowdev.c 2009-02-02 23:04:45.000000000 +1100 @@ -198,8 +198,8 @@ pairadd (char *rdopath, char *cowpath, c /* ** fill structure info for ioctl COWMKPAIR */ - cowpair.rdofile = rdopath; - cowpair.cowfile = cowpath; + cowpair.rdofile = (u_char*) rdopath; + cowpair.cowfile = (u_char*) cowpath; cowpair.rdoflen = strlen(rdopath); cowpair.cowflen = strlen(cowpath); Only in cowloop-3.0/src: cowdev.c.orig Only in cowloop-3.0/src: cowdev.c.rej diff -pur /tmp/cowloop-3.0/src/cowloop.c cowloop-3.0/src/cowloop.c --- /tmp/cowloop-3.0/src/cowloop.c 2006-12-12 10:28:17.000000000 +1100 +++ cowloop-3.0/src/cowloop.c 2009-02-02 23:15:25.000000000 +1100 @@ -408,8 +408,13 @@ static long int cowlo_readcowraw (struct static long int cowlo_writecow (struct cowloop_device *, void *, int, loff_t); static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) static int cowlo_ioctl (struct inode *, struct file *, unsigned int, unsigned long); +#else +static int cowlo_ioctl (struct block_device *, fmode_t, + unsigned int, unsigned long); +#endif static int cowlo_makepair (struct cowpair __user *); static int cowlo_removepair (unsigned long __user *); @@ -434,8 +439,15 @@ static void cowlo_undo_opencow(struct co ** < 0 - error value */ static int +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) cowlo_open(struct inode *inode, struct file *file) -{ +#else +cowlo_open(struct block_device *bdev, fmode_t mode) +#endif +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + struct inode *inode = bdev->bd_inode; +#endif if (!inode) return -EINVAL; @@ -474,9 +486,20 @@ cowlo_open(struct inode *inode, struct f ** < 0 - error value */ static int +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) cowlo_release(struct inode *inode, struct file *file) +#else +cowlo_release(struct gendisk *gd, fmode_t mode) +#endif { int err = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + struct block_device *bdev; + struct inode *inode; + + bdev = bdget_disk(gd, 0); + inode = bdev->bd_inode; +#endif if (!inode) return 0; @@ -497,10 +520,18 @@ cowlo_release(struct inode *inode, struc ** < 0 - error value */ static int +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) cowlo_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) +#else +cowlo_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) +#endif { struct hd_geometry geo; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + struct inode *inode = bdev->bd_inode; +#endif DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd); @@ -2067,7 +2098,11 @@ cowlo_openrdo(struct cowloop_device *cow cowdev->belowq = cowdev->belowgd->queue; if (cowdev->numblocks == 0) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) cowdev->numblocks = cowdev->belowgd->capacity +#else + cowdev->numblocks = get_capacity(cowdev->belowgd) +#endif / (MAPUNIT/512); } @@ -2637,6 +2672,9 @@ cowlo_sync(void) static int __init cowlo_init_module(void) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + spinlock_t ilock; /* Initial lock for the default queue assigned on load */ +#endif int rv; int minor, uptocows; @@ -2748,7 +2786,7 @@ cowlo_init_module(void) ** allocate fake disk as control channel to handle the requests ** to activate and deactivate cowdevices dynamically */ - if ((cowctlgd = alloc_disk(1)) == NULL) { + if (!(cowctlgd = alloc_disk(1))) { printk(KERN_WARNING "cowloop - unable to alloc_disk for cowctl\n"); @@ -2759,11 +2797,19 @@ cowlo_init_module(void) goto error_out; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + spin_lock_init(&ilock); +#endif + cowctlgd->major = COWMAJOR; cowctlgd->first_minor = COWCTL; cowctlgd->minors = 1; cowctlgd->fops = &cowlo_fops; cowctlgd->private_data = NULL; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + /* The device is of capacity 0, so there won't be any queue request */ + cowctlgd->queue = blk_init_queue(NULL, &ilock); +#endif sprintf(cowctlgd->disk_name, "cowctl"); set_capacity(cowctlgd, 0); @@ -2816,7 +2862,9 @@ cowlo_cleanup_module(void) kfree(cowdevall[minor]); } kfree(cowdevall); - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) + blk_cleanup_queue(cowctlgd->queue); /* cleanup the empty queue */ +#endif del_gendisk(cowctlgd); /* revert the alloc_disk() */ put_disk (cowctlgd); /* revert the add_disk() */