On Mon 20 Jun 2016 06:24:30 PM CEST, Max Reitz wrote: >> Currently the way to look for a specific block job is to iterate the >> list manually using block_job_next(). >> >> Since we want to be able to identify a job primarily by its ID it >> makes sense to have a function that does just that. >> >> Signed-off-by: Alberto Garcia <[email protected]> >> --- >> blockjob.c | 13 +++++++++++++ >> include/block/blockjob.h | 10 ++++++++++ >> 2 files changed, 23 insertions(+) > > Reviewed-by: Max Reitz <[email protected]> > > Just to throw out a suggestion, I'm not sure how useful it will be > after the rest of the series: > > Would it make sense to prevent name clashes between block job IDs and > device IDs (i.e. BlockBackend names)? If we did that, this function > could be used to identify a block job both based on its name and its > device.
I considered that. Apart from the reasons that have been mentioned, there's also the problem that the user doesn't have control over the device name when creating jobs, so for example you could not start a new job on a device with the same name as an existing job, or two jobs on the same device. These two cases are a bit far-fetched (the latter is anyway not supported yet), but they hinted me that it's better to make the use of the job ID explicit and leave the device name for older clients. Berto
