Message ID | 925addfddafe2c9c0c35a55d3de954ad1d0b0a5f.1347548248.git.jcody@redhat.com |
---|---|
State | New |
Headers | show |
On 09/13/2012 12:05 PM, Paolo Bonzini wrote: > Il 13/09/2012 17:49, Jeff Cody ha scritto: >> +/* We have nothing to do for raw reopen, stubs just return >> + * success */ >> +static int raw_reopen_prepare(BDRVReopenState *state, Error **errp) >> +{ >> + return 0; >> +} >> + >> +static void raw_reopen_commit(BDRVReopenState *state) >> +{ >> + return; >> +} >> + >> +static void raw_reopen_abort(BDRVReopenState *state) >> +{ >> + return; >> +} >> + >> + > > Commit and abort are optional, aren't they? > > BTW, vdi and vpc should also support reopen. > > Paolo > The commit and abort block driver handlers are indeed optional, prepare is the only required one. I kept the stubs for them for completeness, however (I can remove them if that causes heartburn for others). A quick look at the vdi and vpc block drivers seems to indicate that both of those can be supported via stubs as well; I'll add them to v3. Thanks, Jeff
Il 13/09/2012 19:02, Jeff Cody ha scritto: > I kept the stubs for them for completeness, > however (I can remove them if that causes heartburn for others). The point of making them optional is to avoid stubs, isn't it? ;) Paolo
On 09/13/2012 02:53 PM, Paolo Bonzini wrote: > Il 13/09/2012 19:02, Jeff Cody ha scritto: >> I kept the stubs for them for completeness, >> however (I can remove them if that causes heartburn for others). > > The point of making them optional is to avoid stubs, isn't it? ;) > > Paolo > Fair point - consider them removed for v3. :)
diff --git a/block/raw.c b/block/raw.c index ff34ea4..fa47ff1 100644 --- a/block/raw.c +++ b/block/raw.c @@ -9,6 +9,24 @@ static int raw_open(BlockDriverState *bs, int flags) return 0; } +/* We have nothing to do for raw reopen, stubs just return + * success */ +static int raw_reopen_prepare(BDRVReopenState *state, Error **errp) +{ + return 0; +} + +static void raw_reopen_commit(BDRVReopenState *state) +{ + return; +} + +static void raw_reopen_abort(BDRVReopenState *state) +{ + return; +} + + static int coroutine_fn raw_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { @@ -115,6 +133,10 @@ static BlockDriver bdrv_raw = { .bdrv_open = raw_open, .bdrv_close = raw_close, + .bdrv_reopen_prepare = raw_reopen_prepare, + .bdrv_reopen_commit = raw_reopen_commit, + .bdrv_reopen_abort = raw_reopen_abort, + .bdrv_co_readv = raw_co_readv, .bdrv_co_writev = raw_co_writev, .bdrv_co_is_allocated = raw_co_is_allocated,
These are the stubs for the file reopen drivers for the raw format. There is currently nothing that needs to be done by the raw driver in reopen. Signed-off-by: Jeff Cody <jcody@redhat.com> --- block/raw.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)