On 01/19/2012 10:16 AM, Chunyan Liu wrote:
> Yes, that's true. He could have two definitions (SOCKET_PATH with %d and
> SOCKET_PATH_HELP without) so that the occurrences would stay close in the
> source code.
Not clear how it will use SOCKET_PATH and SOCKET_PATH_HELP.
SOCKET_PATH_HELP stores the abstract string of sock path? (e.g.
/var/lock/qemu-nbd-xxx)
Yes (s/xxx/PID/).
Yes, though actually ENOENT is an important special case that is worth
reporting to the user. It happens when the nbd module is not loaded.
If nbd module is not loaded, open device will fail, we can add error info:
fd = open(device, O_RDWR);
if (fd == -1) {
fprintf(stderr, "Failed to open %s\n", device);
continue;
}
And in next place, if using err instead of fprintf, it will print ENOENT error
message. Is that enough?
You do not need this fprintf. Otherwise, yes.
Please build your patch on top of git://github.com/bonzini/qemu.git,
branch nbd-next.
Thanks,
Paolo