hd-geometry: Cut out block layer translation middleman

hd_geometry_guess() picks geometry and translation.  Callers can get
the geometry directly, via parameters, but for translation they need
to go through the block layer.

Add a parameter for translation, so it can optionally be gotten just
like geometry.  In preparation of purging translation from the block
layer, which will happen later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2012-07-10 11:12:37 +02:00 committed by Kevin Wolf
parent dc28c0cd30
commit e2f3dc2b6a
5 changed files with 20 additions and 11 deletions

View file

@ -990,7 +990,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
break;
}
/* if a geometry hint is available, use it */
hd_geometry_guess(bdrv, &cylinders, &heads, &secs);
hd_geometry_guess(bdrv, &cylinders, &heads, &secs, NULL);
p[2] = (cylinders >> 16) & 0xff;
p[3] = (cylinders >> 8) & 0xff;
p[4] = cylinders & 0xff;
@ -1024,7 +1024,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
p[2] = 5000 >> 8;
p[3] = 5000 & 0xff;
/* if a geometry hint is available, use it */
hd_geometry_guess(bdrv, &cylinders, &heads, &secs);
hd_geometry_guess(bdrv, &cylinders, &heads, &secs, NULL);
p[4] = heads & 0xff;
p[5] = secs & 0xff;
p[6] = s->qdev.blocksize >> 8;