[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Question about total_sectors in block/vpc.c
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] Question about total_sectors in block/vpc.c |
Date: |
Sat, 9 Apr 2011 21:05:41 +0100 |
On Sat, Apr 9, 2011 at 5:51 PM, Lyu Mitnick <address@hidden> wrote:
> Hell all,
> I have take a look of block/vpc.c and meet a question in vpc_create(). At
> the line
> 550, the code is:
> total_sectors = options->value.n / 512;
> I am wondering whether the size between total_sectors * 512
> and options->value.n
> would be discard.
Yes, it rounds down. This reflects the assumption that a block device
cannot be addressed below 512 byte sectors. Because of this block
devices size must be a multiple of 512 bytes.
I think a reasonable protection would be to have block.c:bdrv_create()
fail if size is not a multiple of BDRV_SECTOR_SIZE. This way other
image formats are protected too.
Stefan
- [Qemu-devel] Question about total_sectors in block/vpc.c, Lyu Mitnick, 2011/04/09
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c,
Stefan Hajnoczi <=
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Lyu Mitnick, 2011/04/10
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Stefan Hajnoczi, 2011/04/11
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Lyu Mitnick, 2011/04/13
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Kevin Wolf, 2011/04/14
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Lyu Mitnick, 2011/04/15
- Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Kevin Wolf, 2011/04/18
Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Christoph Hellwig, 2011/04/11