Am 14.02.2014 um 15:41 hat Jeff Cody geschrieben: > On Fri, Feb 14, 2014 at 03:21:28PM +0100, Stefan Hajnoczi wrote: > > On Tue, Feb 04, 2014 at 02:26:58PM -0500, Jeff Cody wrote: > > > @@ -291,23 +311,17 @@ static int qemu_gluster_open(BlockDriverState *bs, > > > QDict *options, > > > > > > filename = qemu_opt_get(opts, "filename"); > > > > > > + s->filename = g_strdup(filename); > > > > It's not obvious to me that copying the filename is necessary. > > block/raw-posix.c does this: > > > > raw_s->fd = qemu_open(state->bs->filename, raw_s->open_flags); > > > > Why didn't you use bs->filename? > > Back when the raw-posix reopen was implemented, the .bdrv_file_open > used the char * filename instead of options parameters. Now that the > filename is explicitly parsed via the options, I thought it made > logical sense to cache the filename into the protocol state variable, > for later use by reopen. > > That way if the bs->filename was changed in some manner, the protocol > would have the variable as originally intended to be passed to the > .bdrv_file_open() method. > > In reality, I should be able to just use bs->filename instead, as it > does not get modified; this just seemed to make a bit more sense.
FWIW, I think we want bs->filename to go away eventually and get it replaced by a callback (or perhaps two, a short summary one for humans and a complete one) so that the callers work with setups that are driven by options and don't have a filename. Kevin