All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: Pascal Bouchareine <pascal@gandi.net>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] blkfront: ioctls/geometry, 2.6
Date: Tue, 16 May 2006 09:49:07 +0200	[thread overview]
Message-ID: <4469A013.76E4.0078.0@novell.com> (raw)
In-Reply-To: <20060516073523.GA6987@bar.gandi.net>

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

Attaching our patch. Jan

>>> Pascal Bouchareine <pascal@gandi.net> 16.05.06 09:35 >>>
On Tue, May 16, 2006 at 09:18:39AM +0200, Jan Beulich wrote:
> We did a similar patch recently here (not submitted, yet) - so I immediately see some concerns with your patch:

Thanks for your reply. When do you plan to submit the said patch ?

Understood for the 3 cons, I can remove the odd calls if required,
just let me know if a modified patch is needed.

Regards,
Pascal

-- 
\o/   Pascal Bouchareine - Gandi 
 g    0170393757           15, place de la Nation - 75011 Paris      

[-- Attachment #2: xenlinux-blkfront-getgeo.patch --]
[-- Type: text/plain, Size: 2682 bytes --]

Add backing support for HDIO_GETGEO ioctl to blkfront.

Inspired by an earlier patch from Charles Coffing.

Signed-Off-By: Jan Beulich <jbeulich@novell.com>

Index: head-2006-05-11/drivers/xen/blkfront/blkfront.c
===================================================================
--- head-2006-05-11.orig/drivers/xen/blkfront/blkfront.c	2006-05-12 09:39:21.000000000 +0200
+++ head-2006-05-11/drivers/xen/blkfront/blkfront.c	2006-05-15 09:59:52.000000000 +0200
@@ -452,10 +452,6 @@ int blkif_ioctl(struct inode *inode, str
 		      command, (long)argument, inode->i_rdev);
 
 	switch (command) {
-	case HDIO_GETGEO:
-		/* return ENOSYS to use defaults */
-		return -ENOSYS;
-
 	case CDROMMULTISESSION:
 		DPRINTK("FIXME: support multisession CDs later\n");
 		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
@@ -473,6 +469,23 @@ int blkif_ioctl(struct inode *inode, str
 }
 
 
+int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
+{
+	/* We don't have real geometry info, but let's at least return
+	   values consistent with the size of the device */
+	sector_t nsect = get_capacity(bd->bd_disk);
+	sector_t cylinders = nsect;
+
+	hg->heads = 0xff;
+	hg->sectors = 0x3f;
+	sector_div(cylinders, hg->heads * hg->sectors);
+	hg->cylinders = cylinders;
+	if ((sector_t)(hg->cylinders + 1) * hg->heads * hg->sectors < nsect)
+		hg->cylinders = 0xffff;
+	return 0;
+}
+
+
 /*
  * blkif_queue_request
  *
Index: head-2006-05-11/drivers/xen/blkfront/block.h
===================================================================
--- head-2006-05-11.orig/drivers/xen/blkfront/block.h	2006-05-12 09:39:21.000000000 +0200
+++ head-2006-05-11/drivers/xen/blkfront/block.h	2006-05-10 11:06:51.000000000 +0200
@@ -140,6 +140,7 @@ extern int blkif_open(struct inode *inod
 extern int blkif_release(struct inode *inode, struct file *filep);
 extern int blkif_ioctl(struct inode *inode, struct file *filep,
                        unsigned command, unsigned long argument);
+extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
 extern int blkif_check(dev_t dev);
 extern int blkif_revalidate(dev_t dev);
 extern void do_blkif_request (request_queue_t *rq);
Index: head-2006-05-11/drivers/xen/blkfront/vbd.c
===================================================================
--- head-2006-05-11.orig/drivers/xen/blkfront/vbd.c	2006-05-12 09:39:21.000000000 +0200
+++ head-2006-05-11/drivers/xen/blkfront/vbd.c	2006-05-10 11:07:16.000000000 +0200
@@ -91,6 +91,7 @@ static struct block_device_operations xl
 	.open = blkif_open,
 	.release = blkif_release,
 	.ioctl  = blkif_ioctl,
+	.getgeo = blkif_getgeo
 };
 
 spinlock_t blkif_io_lock = SPIN_LOCK_UNLOCKED;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

      reply	other threads:[~2006-05-16  7:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-15 18:15 [PATCH] blkfront: ioctls/geometry, 2.6 Pascal Bouchareine
2006-05-16  7:18 ` Jan Beulich
2006-05-16  7:35   ` Pascal Bouchareine
2006-05-16  7:49     ` Jan Beulich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4469A013.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=pascal@gandi.net \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.