ia64/xen-unstable

changeset 11981:1c985a2e47ea

[LINUX] PV-on-HVM: Implement HDIO_GETGEO ioctl on kernels before
2.6.16.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
author Ian Campbell <ian.campbell@xensource.com>
date Wed Oct 25 13:58:30 2006 +0100 (2006-10-25)
parents a0919d3f7d50
children db23596992f9
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Oct 25 13:58:30 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Oct 25 13:58:30 2006 +0100
     1.3 @@ -468,6 +468,27 @@ int blkif_ioctl(struct inode *inode, str
     1.4  		      command, (long)argument, inode->i_rdev);
     1.5  
     1.6  	switch (command) {
     1.7 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
     1.8 +	case HDIO_GETGEO: {
     1.9 +		struct block_device *bd = inode->i_bdev;
    1.10 +		struct hd_geometry geo;
    1.11 +		int ret;
    1.12 +
    1.13 +                if (!argument)
    1.14 +                        return -EINVAL;
    1.15 +
    1.16 +		geo.start = get_start_sect(bd);
    1.17 +		ret = blkif_getgeo(bd, &geo);
    1.18 +		if (ret)
    1.19 +			return ret;
    1.20 +
    1.21 +		if (copy_to_user((struct hd_geometry __user *)argument, &geo,
    1.22 +				 sizeof(geo)))
    1.23 +                        return -EFAULT;
    1.24 +
    1.25 +                return 0;
    1.26 +	}
    1.27 +#endif
    1.28  	case CDROMMULTISESSION:
    1.29  		DPRINTK("FIXME: support multisession CDs later\n");
    1.30  		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Wed Oct 25 13:58:30 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Wed Oct 25 13:58:30 2006 +0100
     2.3 @@ -91,7 +91,9 @@ static struct block_device_operations xl
     2.4  	.open = blkif_open,
     2.5  	.release = blkif_release,
     2.6  	.ioctl  = blkif_ioctl,
     2.7 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
     2.8  	.getgeo = blkif_getgeo
     2.9 +#endif
    2.10  };
    2.11  
    2.12  DEFINE_SPINLOCK(blkif_io_lock);