[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/27] Cleanup: raw-posix.c: Be more consistent usin
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 03/27] Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512 |
Date: |
Fri, 4 Jun 2010 18:32:51 +0200 |
From: Jes Sorensen <address@hidden>
Clean up raw-posix.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.
Signed-off-by: Jes Sorensen <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/raw-posix.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 7541ed2..3f0701b 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -392,8 +392,9 @@ static int raw_read(BlockDriverState *bs, int64_t
sector_num,
{
int ret;
- ret = raw_pread(bs, sector_num * 512, buf, nb_sectors * 512);
- if (ret == (nb_sectors * 512))
+ ret = raw_pread(bs, sector_num * BDRV_SECTOR_SIZE, buf,
+ nb_sectors * BDRV_SECTOR_SIZE);
+ if (ret == (nb_sectors * BDRV_SECTOR_SIZE))
ret = 0;
return ret;
}
@@ -480,8 +481,9 @@ static int raw_write(BlockDriverState *bs, int64_t
sector_num,
const uint8_t *buf, int nb_sectors)
{
int ret;
- ret = raw_pwrite(bs, sector_num * 512, buf, nb_sectors * 512);
- if (ret == (nb_sectors * 512))
+ ret = raw_pwrite(bs, sector_num * BDRV_SECTOR_SIZE, buf,
+ nb_sectors * BDRV_SECTOR_SIZE);
+ if (ret == (nb_sectors * BDRV_SECTOR_SIZE))
ret = 0;
return ret;
}
@@ -494,7 +496,7 @@ static int qiov_is_aligned(QEMUIOVector *qiov)
int i;
for (i = 0; i < qiov->niov; i++) {
- if ((uintptr_t) qiov->iov[i].iov_base % 512) {
+ if ((uintptr_t) qiov->iov[i].iov_base % BDRV_SECTOR_SIZE) {
return 0;
}
}
@@ -703,7 +705,7 @@ static int raw_create(const char *filename,
QEMUOptionParameter *options)
/* Read out options */
while (options && options->name) {
if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
- total_size = options->value.n / 512;
+ total_size = options->value.n / BDRV_SECTOR_SIZE;
}
options++;
}
@@ -713,7 +715,7 @@ static int raw_create(const char *filename,
QEMUOptionParameter *options)
if (fd < 0) {
result = -errno;
} else {
- if (ftruncate(fd, total_size * 512) != 0) {
+ if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) {
result = -errno;
}
if (close(fd) != 0) {
@@ -976,7 +978,7 @@ static int hdev_create(const char *filename,
QEMUOptionParameter *options)
/* Read out options */
while (options && options->name) {
if (!strcmp(options->name, "size")) {
- total_size = options->value.n / 512;
+ total_size = options->value.n / BDRV_SECTOR_SIZE;
}
options++;
}
@@ -989,7 +991,7 @@ static int hdev_create(const char *filename,
QEMUOptionParameter *options)
ret = -errno;
else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode))
ret = -ENODEV;
- else if (lseek(fd, 0, SEEK_END) < total_size * 512)
+ else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE)
ret = -ENOSPC;
close(fd);
--
1.6.6.1
- [Qemu-devel] [PATCH 01/27] Cleanup: bdrv_open() no need to shift total_size just to shift back., (continued)
- [Qemu-devel] [PATCH 01/27] Cleanup: bdrv_open() no need to shift total_size just to shift back., Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 11/27] ide: Split ide_init1() off ide_init2(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 02/27] Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 04/27] Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 05/27] qemu-io: Fix error messages, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 08/27] usb: Remove unused usb_device_add() parameter is_hotplug, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 14/27] qdev: New qdev_prop_set_string(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 13/27] ide: Split non-qdev code off ide_init2(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 10/27] ide: Remove redundant IDEState member conf, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 12/27] ide: Change ide_init_drive() to require valid dinfo argument, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 03/27] Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512,
Kevin Wolf <=
- [Qemu-devel] [PATCH 09/27] ide: Remove useless IDEDeviceInfo members unit, drive, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 17/27] ide: Fix info qtree for ide-drive.ver, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 18/27] scsi: Turn drive serial into a qdev property scsi-disk.serial, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 19/27] scsi: Fix info qtree for scsi-disk.ver, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 27/27] block: Fix serial number assignment, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 20/27] Fix error message in drive_init, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 24/27] blockdev: Hide QEMUMachine from drive_init(), Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 23/27] block: call the snapshot handlers of the protocol drivers, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 25/27] qdev: Move declaration of qdev_init_bdrv() into qdev.h, Kevin Wolf, 2010/06/04
- [Qemu-devel] [PATCH 22/27] close all the block drivers before the qemu process exits, Kevin Wolf, 2010/06/04