[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Creating partitions on domain U
> > even that doesn't work: maybe they partition the device (after heavily > > complaining about unsupportet ioctls; maybe it's the > > get-geometry ioctl that > > isn't correctly implemented, because also "sfdisk -g /dev/hda" fails). > > Looking at drivers/xen/blkfron/blkfront.c it looks like blkif_ioctl has > been fixed for 2.4 but not for 2.6. I don't see why this isn't in common > code. It turns out that there are a few changes between 2.4 and 2.6 which make sharing the function a bit messy. Please can you give the attached completely untested patch a go. If it works, I'll apply it to 2.0-testing. Thanks, Ian --- a/linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c 2005-01-17 08:11:29.000000000 +0000 +++ b/linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c 2005-01-19 12:32:51.000000000 +0000 @@ -219,27 +219,113 @@ return 0; } - int blkif_ioctl(struct inode *inode, struct file *filep, unsigned command, unsigned long argument) { - /* struct gendisk *gd = inode->i_bdev->bd_disk; */ + dev_t dev = inode->i_rdev; + struct hd_geometry *geo = (struct hd_geometry *)argument; + struct gendisk *gd; + struct hd_struct *part; + int i, dpart; + unsigned short cylinders; + byte heads, sectors; + /* NB. No need to check permissions. That is done for us. */ + DPRINTK_IOCTL("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n", - command, (long)argument, inode->i_rdev); + command, (long) argument, dev); - switch (command) { + gd = get_gendisk(dev,&dpart); + part = gd->part[MINOR(dev)]; + + switch ( command ) + { + case BLKGETSIZE: + DPRINTK_IOCTL(" BLKGETSIZE: %x %lx\n", BLKGETSIZE, part->nr_sects); + return put_user(part->nr_sects, (unsigned long *) argument); + + case BLKGETSIZE64: + DPRINTK_IOCTL(" BLKGETSIZE64: %x %llx\n", BLKGETSIZE64, + (u64)part->nr_sects * 512); + return put_user((u64)part->nr_sects * 512, (u64 *) argument); + + case BLKRRPART: /* re-read partition table */ + DPRINTK_IOCTL(" BLKRRPART: %x\n", BLKRRPART); + return blkif_revalidate(dev); + + case BLKSSZGET: + /* return hardsect_size[MAJOR(dev)][MINOR(dev)]; FIX ME */ + break; + + case BLKBSZGET: /* get block size */ + DPRINTK_IOCTL(" BLKBSZGET: %x\n", BLKBSZGET); + break; + + case BLKBSZSET: /* set block size */ + DPRINTK_IOCTL(" BLKBSZSET: %x\n", BLKBSZSET); + break; + + case BLKRASET: /* set read-ahead */ + DPRINTK_IOCTL(" BLKRASET: %x\n", BLKRASET); + break; + + case BLKRAGET: /* get read-ahead */ + DPRINTK_IOCTL(" BLKRAFET: %x\n", BLKRAGET); + break; case HDIO_GETGEO: - /* return ENOSYS to use defaults */ + DPRINTK_IOCTL(" HDIO_GETGEO: %x\n", HDIO_GETGEO); + if (!argument) return -EINVAL; + + /* We don't have real geometry info, but let's at least return + values consistent with the size of the device */ + + heads = 0xff; + sectors = 0x3f; + cylinders = part->nr_sects / (heads * sectors); + + if (put_user(0x00, (unsigned long *) &geo->start)) return -EFAULT; + if (put_user(heads, (byte *)&geo->heads)) return -EFAULT; + if (put_user(sectors, (byte *)&geo->sectors)) return -EFAULT; + if (put_user(cylinders, (unsigned short *)&geo->cylinders)) return -EFAULT; + + return 0; + +#if 0 /* This is no longer used in 2.6 */ + case HDIO_GETGEO_BIG: + DPRINTK_IOCTL(" HDIO_GETGEO_BIG: %x\n", HDIO_GETGEO_BIG); + if (!argument) return -EINVAL; + + /* We don't have real geometry info, but let's at least return + values consistent with the size of the device */ + + heads = 0xff; + sectors = 0x3f; + cylinders = part->nr_sects / (heads * sectors); + + if (put_user(0x00, (unsigned long *) &geo->start)) return -EFAULT; + if (put_user(heads, (byte *)&geo->heads)) return -EFAULT; + if (put_user(sectors, (byte *)&geo->sectors)) return -EFAULT; + if (put_user(cylinders, (unsigned int *) &geo->cylinders)) return -EFAULT; + + return 0; +#endif + + case CDROMMULTISESSION: + DPRINTK("FIXME: support multisession CDs later\n"); + for ( i = 0; i < sizeof(struct cdrom_multisession); i++ ) + if ( put_user(0, (byte *)(argument + i)) ) return -EFAULT; + return 0; + + case SCSI_IOCTL_GET_BUS_NUMBER: + DPRINTK("FIXME: SCSI_IOCTL_GET_BUS_NUMBER ioctl in XL blkif"); return -ENOSYS; default: - printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", - command); + printk(KERN_ALERT "ioctl %08x not supported by XL blkif\n", command); return -ENOSYS; } - + return 0; } ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |