On 12/06/2011 07:56 AM, Chunyan Liu wrote:

Currently, the nbd_setup needs parameters: device, srcpath, flags,
partition, dev_offset, nbdflags, sockpath, bindto, port, shared,
persistent, verbose, sigterm_rfd. More than 10 parameters. I still
didn't find a better way to reduce parameters. Making variables global
is a workaround to avoid nbd_setup taking too many parameters. Actually,
except for sigterm_rfd, all others are pared from command line options.

Reading again this patch, I am not sure why you are doing it this way.

There is no reason why bdrv_new/open/delete has to be redone for every /dev/nbdX we try (or if there is a reason, _that_ is what should be fixed first). Also the "tail" of nbd_setup, basically the select loop, should not be tried multiple times.

I do not understand why you cannot simply do it like this:

- in the server thread, do everything as it is now

- pass "device" to the client thread instead of opening it in main()

- in the client thread, either use "device" as it is or (if device == NULL, which implies find == 1) loop until nbd_init succeeds.

Am I just confused?

Paolo

Reply via email to