Home
last modified time | relevance | path

Searched hist:"65 a9bb25d6b7a4bb41edb102fa0363d81800b417" (Results 1 – 2 of 2) sorted by relevance

/openbmc/qemu/include/block/
H A Dblock.hdiff 65a9bb25d6b7a4bb41edb102fa0363d81800b417 Thu Jun 26 06:23:17 CDT 2014 Markus Armbruster <armbru@redhat.com> block: New bdrv_nb_sectors()

A call to retrieve the image size converts between bytes and sectors
several times:

* BlockDriver method bdrv_getlength() returns bytes.

* refresh_total_sectors() converts to sectors, rounding up, and stores
in total_sectors.

* bdrv_getlength() converts total_sectors back to bytes (now rounded
up to a multiple of the sector size).

* Callers wanting sectors rather bytes convert it right back.
Example: bdrv_get_geometry().

bdrv_nb_sectors() provides a way to omit the last two conversions.
It's exactly bdrv_getlength() with the conversion to bytes omitted.
It's functionally like bdrv_get_geometry() without its odd error
handling.

Reimplement bdrv_getlength() and bdrv_get_geometry() on top of
bdrv_nb_sectors().

The next patches will convert some users of bdrv_getlength() to
bdrv_nb_sectors().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
/openbmc/qemu/
H A Dblock.cdiff 65a9bb25d6b7a4bb41edb102fa0363d81800b417 Thu Jun 26 06:23:17 CDT 2014 Markus Armbruster <armbru@redhat.com> block: New bdrv_nb_sectors()

A call to retrieve the image size converts between bytes and sectors
several times:

* BlockDriver method bdrv_getlength() returns bytes.

* refresh_total_sectors() converts to sectors, rounding up, and stores
in total_sectors.

* bdrv_getlength() converts total_sectors back to bytes (now rounded
up to a multiple of the sector size).

* Callers wanting sectors rather bytes convert it right back.
Example: bdrv_get_geometry().

bdrv_nb_sectors() provides a way to omit the last two conversions.
It's exactly bdrv_getlength() with the conversion to bytes omitted.
It's functionally like bdrv_get_geometry() without its odd error
handling.

Reimplement bdrv_getlength() and bdrv_get_geometry() on top of
bdrv_nb_sectors().

The next patches will convert some users of bdrv_getlength() to
bdrv_nb_sectors().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>