On Wed, Nov 23, 2011 at 10:14 AM, Chunyan Liu <cy...@suse.com> wrote: > V3: > Remove file lock in main(). > Try to find new free nbd device and connect to it if connecting to the first > first found free nbd device failed. > > Signed-off-by: Chunyan Liu <cy...@suse.com> > --- > qemu-nbd.c | 80 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 79 insertions(+), 1 deletions(-)
I not seeing the part where you adjusted the ioctl order. The /proc/partitions scanning is unnecessary since we can just loop over /dev/ndb%d and try to initialize. If a device is in use then init will fail and we need to try the next one. If a device is free we can continue with normal operation. I guess I'm saying that once you fix the ioctl order then there's no need for another mechanism to test whether or not a device is in use. Also please use QEMU coding style, you can run qemu/scripts/checkpatch.pl on your patches. Stefan