[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/41] hd-geometry: Switch to uint32_t to match Bloc
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 17/41] hd-geometry: Switch to uint32_t to match BlockConf |
Date: |
Tue, 17 Jul 2012 18:00:14 +0200 |
From: Markus Armbruster <address@hidden>
Best to use the same type, to avoid unwanted truncation or sign
extension.
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>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/block-common.h | 2 +-
hw/hd-geometry.c | 4 ++--
hw/ide/core.c | 2 +-
hw/scsi-disk.c | 2 +-
hw/virtio-blk.c | 2 +-
trace-events | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/block-common.h b/hw/block-common.h
index bba817a..2f65186 100644
--- a/hw/block-common.h
+++ b/hw/block-common.h
@@ -16,7 +16,7 @@
/* 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 4d746b7..7626cbb 100644
--- a/hw/hd-geometry.c
+++ b/hw/hd-geometry.c
@@ -98,7 +98,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;
@@ -117,7 +117,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 7f5ad07..f1966e3 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1927,7 +1927,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 fc077f5..c881acf 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -968,7 +968,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 d2709a7..4344e28 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -590,7 +590,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;
diff --git a/trace-events b/trace-events
index 5f27f1a..8b1fb24 100644
--- a/trace-events
+++ b/trace-events
@@ -143,7 +143,7 @@ ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read
diagnostic %"PRId64"= %02x
# hw/hd-geometry.c
hd_geometry_lchs_guess(void *bs, int cyls, int heads, int secs) "bs %p LCHS %d
%d %d"
-hd_geometry_guess(void *bs, int cyls, int heads, int secs, int trans) "bs %p
CHS %d %d %d trans %d"
+hd_geometry_guess(void *bs, uint32_t cyls, uint32_t heads, uint32_t secs, int
trans) "bs %p CHS %u %u %u trans %d"
# hw/jazz-led.c
jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x"
--
1.7.6.5
- [Qemu-devel] [PATCH 25/41] qtest: Cover qdev property for BIOS CHS translation, (continued)
- [Qemu-devel] [PATCH 25/41] qtest: Cover qdev property for BIOS CHS translation, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 18/41] scsi-hd: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 26/41] block: Geometry and translation hints are now useless, purge them, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 32/41] hw/block-common: Move BlockConf & friends from block.h, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 38/41] qemu-iotests: Valgrind support, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 28/41] qtest: Test we don't put hard disk info into CMOS for a CD-ROM, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 34/41] blockdev: Don't limit DriveInfo serial to 20 characters, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 12/41] hd-geometry: Clean up confusing use of prior translation hint, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 21/41] qtest: Cover qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 23/41] qdev: New property type chs-translation, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 17/41] hd-geometry: Switch to uint32_t to match BlockConf,
Kevin Wolf <=
- [Qemu-devel] [PATCH 40/41] fdc-test: introduce test_relative_seek, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 36/41] qemu-io: Fix memory leaks, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 19/41] virtio-blk: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 20/41] ide: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 39/41] fdc: fix relative seek, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 35/41] hw/block-common: Factor out fall back to legacy -drive cyls=..., Kevin Wolf, 2012/07/17