Revision 75818250 qemu-nbd.c

b/qemu-nbd.c
56 56
"  -c, --connect=DEV    connect FILE to the local NBD device DEV\n"
57 57
"  -d, --disconnect     disconnect the specified device\n"
58 58
"  -e, --shared=NUM     device can be shared by NUM clients (default '1')\n"
59
"  -t, --persistent     don't exit on the last connection\n"
59 60
"  -v, --verbose        display extra debugging information\n"
60 61
"  -h, --help           display this help and exit\n"
61 62
"  -V, --version        output version information and exit\n"
......
189 190
    char *device = NULL;
190 191
    char *socket = NULL;
191 192
    char sockpath[128];
192
    const char *sopt = "hVbo:p:rsnP:c:dvk:e:";
193
    const char *sopt = "hVbo:p:rsnP:c:dvk:e:t";
193 194
    struct option lopt[] = {
194 195
        { "help", 0, 0, 'h' },
195 196
        { "version", 0, 0, 'V' },
......
204 205
        { "snapshot", 0, 0, 's' },
205 206
        { "nocache", 0, 0, 'n' },
206 207
        { "shared", 1, 0, 'e' },
208
        { "persistent", 0, 0, 't' },
207 209
        { "verbose", 0, 0, 'v' },
208 210
        { NULL, 0, 0, 0 }
209 211
    };
......
222 224
    int i;
223 225
    int nb_fds = 0;
224 226
    int max_fd;
227
    int persistent = 0;
225 228

  
226 229
    while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
227 230
        switch (ch) {
......
283 286
                errx(EINVAL, "Shared device number must be greater than 0\n");
284 287
            }
285 288
            break;
289
	case 't':
290
	    persistent = 1;
291
	    break;
286 292
        case 'v':
287 293
            verbose = 1;
288 294
            break;
......
459 465
                }
460 466
            }
461 467
        }
462
    } while (nb_fds > 1);
468
    } while (persistent || nb_fds > 1);
463 469
    qemu_free(data);
464 470

  
465 471
    close(sharing_fds[0]);

Also available in: Unified diff