Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-18 Thread Kevin Wolf
Am 15.04.2011 22:40, schrieb Lyu Mitnick: > Hello Kevin, > > 2011/4/14 Kevin Wolf mailto:kw...@redhat.com>> > > Am 13.04.2011 22:59, schrieb Lyu Mitnick: > > Hello Stefan, > > > > I have a question about get_option_parameter(). I am wondering whether > > get_option_parameter

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-15 Thread Lyu Mitnick
Hello Kevin, 2011/4/14 Kevin Wolf > Am 13.04.2011 22:59, schrieb Lyu Mitnick: > > Hello Stefan, > > > > I have a question about get_option_parameter(). I am wondering whether > > get_option_parameter is suitable to use instead of doing the search by > > myself > > in the case like following: >

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-14 Thread Kevin Wolf
Am 13.04.2011 22:59, schrieb Lyu Mitnick: > Hello Stefan, > > I have a question about get_option_parameter(). I am wondering whether > get_option_parameter is suitable to use instead of doing the search by > myself > in the case like following: > > /* Read out options */ > while (options &

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-13 Thread Lyu Mitnick
Hello Stefan, I have a question about get_option_parameter(). I am wondering whether get_option_parameter is suitable to use instead of doing the search by myself in the case like following: /* Read out options */ while (options && options->name) { if (!strcmp(options->name, BLOCK_OP

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-11 Thread Christoph Hellwig
On Sat, Apr 09, 2011 at 09:05:41PM +0100, Stefan Hajnoczi wrote: > On Sat, Apr 9, 2011 at 5:51 PM, Lyu Mitnick 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

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-11 Thread Lyu Mitnick
Hello Christoph, Stefan I am wondering whether the problem occurred that value of BDRV_SECTOR_SIZE is a macro constant (defined at block.h). This problem could be fixed if we use variable instead of macro to implement BDRV_SECTOR_SIZE. Each block device may reassign the value if needed. Is it righ

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-11 Thread Stefan Hajnoczi
On Sun, Apr 10, 2011 at 05:02:20PM +0800, Lyu Mitnick wrote: > diff --git a/block.c b/block.c > index f731c7a..a80ec49 100644 > --- a/block.c > +++ b/block.c > @@ -239,6 +239,16 @@ int bdrv_create(BlockDriver *drv, const char* filename, > if (!drv->bdrv_create) > return -ENOTSUP; > > +

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-10 Thread Lyu Mitnick
Hello Stefan, Is it your means: There is an assumption that a block device cannot be addressed below 512 byte sectors. A reasonable protection in block.c:bdrv_create() to check whether size is a multiple of BDRV_SECTOR_SIZE. Signed-off-by: Mitnick Lyu --- block.c | 10 ++ 1 files cha

Re: [Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-09 Thread Stefan Hajnoczi
On Sat, Apr 9, 2011 at 5:51 PM, Lyu Mitnick 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 >

[Qemu-devel] Question about total_sectors in block/vpc.c

2011-04-09 Thread Lyu Mitnick
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. Thanks Mitnick