2011/12/3 Paolo Bonzini <pbonz...@redhat.com> > On 12/02/2011 04:27 PM, Chunyan Liu wrote: > >> @@ -42,6 +42,18 @@ static int verbose; >> static char *device; >> static char *srcpath; >> static char *sockpath; >> +static int is_sockpath_option; >> +static int sigterm_fd[2]; >> +static off_t dev_offset; >> +static uint32_t nbdflags; >> +static bool disconnect; >> +static const char *bindto = "0.0.0.0"; >> +static int port = NBD_DEFAULT_PORT; >> +static int li; >> +static int flags = BDRV_O_RDWR; >> +static int partition = -1; >> +static int shared = 1; >> +static int persistent; >> > > A lot of statics... "li" seems unused. >
Using these statics simply because most of them are global parameters getting from command line options, will be used later. Otherwise, the nbd_setup() function should take many parameters. Ahh, "li" could be defined in main(). After getting parameters from option, later places can use "port". case 'p': li = strtol(optarg, &end, 0); if (*end) { errx(EXIT_FAILURE, "Invalid port `%s'", optarg); } if (li < 1 || li > 65535) { errx(EXIT_FAILURE, "Port out of range `%s'", optarg); } port = (uint16_t)li; > I took patch 1/3 in my tree > (git://github.com/bonzini/**qemu.git<http://github.com/bonzini/qemu.git>branch > nbd-server). I'll post it together with my patches next week. > > Paolo > >