[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 18/32] hd-geometry: Switch to uint32_t to match
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH 18/32] hd-geometry: Switch to uint32_t to match BlockConf |
Date: |
Fri, 29 Jun 2012 20:34:55 +0000 |
On Fri, Jun 29, 2012 at 3:34 PM, Markus Armbruster <address@hidden> wrote:
> Best to use the same type, to avoid unwanted truncation or sign
> extension.
Awesome patch! :-)
>
> BlockConf can't use plain int for cyls, heads and secs, because
> integer properties require an exact width.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> blockdev.h | 2 +-
> hw/hd-geometry.c | 4 ++--
> hw/ide/core.c | 2 +-
> hw/scsi-disk.c | 2 +-
> hw/virtio-blk.c | 2 +-
> 5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/blockdev.h b/blockdev.h
> index 5288cc8..4f29c8b 100644
> --- a/blockdev.h
> +++ b/blockdev.h
> @@ -66,7 +66,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject
> **ret_data);
>
> /* Hard disk geometry */
> void hd_geometry_guess(BlockDriverState *bs,
> - int *pcyls, int *pheads, int *psecs,
> + uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs,
> int *ptrans);
>
> #endif
> diff --git a/hw/hd-geometry.c b/hw/hd-geometry.c
> index 208cb42..6dd5713 100644
> --- a/hw/hd-geometry.c
> +++ b/hw/hd-geometry.c
> @@ -89,7 +89,7 @@ static int guess_disk_lchs(BlockDriverState *bs,
> }
>
> static void guess_chs_for_size(BlockDriverState *bs,
> - int *pcyls, int *pheads, int *psecs)
> + uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs)
> {
> uint64_t nb_sectors;
> int cylinders;
> @@ -108,7 +108,7 @@ static void guess_chs_for_size(BlockDriverState *bs,
> }
>
> void hd_geometry_guess(BlockDriverState *bs,
> - int *pcyls, int *pheads, int *psecs,
> + uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs,
> int *ptrans)
> {
> int cylinders, heads, secs, translation;
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 4a54833..d8cd2a6 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -1926,7 +1926,7 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
> IDEDriveKind kind,
> const char *version, const char *serial, const char *model,
> uint64_t wwn)
> {
> - int cylinders, heads, secs;
> + uint32_t cylinders, heads, secs;
> uint64_t nb_sectors;
>
> s->bs = bs;
> diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
> index 7a75e15..e9efcd6 100644
> --- a/hw/scsi-disk.c
> +++ b/hw/scsi-disk.c
> @@ -926,7 +926,7 @@ static int mode_sense_page(SCSIDiskState *s, int page,
> uint8_t **p_outbuf,
> };
>
> BlockDriverState *bdrv = s->qdev.conf.bs;
> - int cylinders, heads, secs;
> + uint32_t cylinders, heads, secs;
> uint8_t *p = *p_outbuf;
>
> if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index e4f9906..854739d 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -589,7 +589,7 @@ static const BlockDevOps virtio_block_ops = {
> VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk)
> {
> VirtIOBlock *s;
> - int cylinders, heads, secs;
> + uint32_t cylinders, heads, secs;
> static int virtio_blk_id;
> DriveInfo *dinfo;
>
> --
> 1.7.6.5
>
>
- [Qemu-devel] [PATCH 20/32] virtio-blk: qdev properties for disk geometry, (continued)
- [Qemu-devel] [PATCH 20/32] virtio-blk: qdev properties for disk geometry, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 17/32] qdev: Introduce block geometry properties, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 27/32] block: Geometry and translation hints are now useless, purge them, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 08/32] hd-geometry: Move disk geometry guessing back from block.c, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 26/32] qtest: Cover qdev property for BIOS CHS translation, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 32/32] Relax IDE CHS limits from 16383, 16, 63 to 65535, 16, 255, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 23/32] qdev: Collect private helpers in one place, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 25/32] ide: qdev property for BIOS CHS translation, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 18/32] hd-geometry: Switch to uint32_t to match BlockConf, Markus Armbruster, 2012/06/29
- Re: [Qemu-devel] [PATCH 18/32] hd-geometry: Switch to uint32_t to match BlockConf,
Blue Swirl <=
- [Qemu-devel] [PATCH 24/32] qdev: New property type chs-translation, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 22/32] qtest: Cover qdev properties for disk geometry, Markus Armbruster, 2012/06/29