summaryrefslogtreecommitdiff
path: root/block/raw-posix.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-06-21 17:10:19 +0300
committerAvi Kivity <avi@redhat.com>2010-06-21 17:10:19 +0300
commita854bebad983e109d9597591f2c170f80b0e5ebf (patch)
treea75cf6d1aa2a929db4ad5f7cd3b127a15c554d40 /block/raw-posix.c
parent8e34dc4b2c36c85624756e2444d1604acbb6db8d (diff)
parentf274776028ddb026f8891cabaf59bd58dbfc31bd (diff)
Merge commit 'f274776028ddb026f8891cabaf59bd58dbfc31bd' into upstream-merge
* commit 'f274776028ddb026f8891cabaf59bd58dbfc31bd': blockdev: Belatedly remove driveopts blockdev: Belatedly remove MAX_DRIVES qemu-io: Fix error messages Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512 Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512 Cleanup: bdrv_open() no need to shift total_size just to shift back. Conflicts: sysemu.h vl.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r--block/raw-posix.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 1515ca902..b14347975 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -394,8 +394,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;
}
@@ -482,8 +483,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;
}
@@ -496,7 +498,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;
}
}
@@ -705,7 +707,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++;
}
@@ -715,7 +717,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) {
@@ -978,7 +980,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++;
}
@@ -991,7 +993,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);