annotate toys/pending/nbd_client.c @ 1005:03f72b57a092

DHCP client and server, from Ashwini Sharma.
author Rob Landley <rob@landley.net>
date Wed, 14 Aug 2013 19:09:33 -0500
parents 6f5fed66c722
children e11684e3bbc5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set sw=4 ts=4:
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * nbd-client.c - network block device client
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * Copyright 2010 Rob Landley <rob@landley.net>
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 *
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 * Not in SUSv4.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
9 USE_NBD_CLIENT(NEWTOY(nbd_client, "<3>3ns", TOYFLAG_USR|TOYFLAG_BIN))
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 config NBD_CLIENT
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 bool "nbd-client"
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 default n
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 help
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
15 usage: nbd-client [-ns] HOST PORT DEVICE
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
16
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
17 -n Do not fork into background
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
18 -s nbd swap support (lock server into memory)
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
19 */
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
20
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
21 /*
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 Usage: nbd-client [-sSpn] [-b BLKSZ] [-t SECS] [-N name] HOST PORT DEVICE
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
23
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 -b block size
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 -t timeout in seconds
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 -S sdp
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 -p persist
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 -n nofork
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 -d DEVICE
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 -c DEVICE
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 */
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
32
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 #define FOR_nbd_client
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 #include "toys.h"
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
35 #include "toynet.h"
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
36
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
37 #define NBD_SET_SOCK _IO(0xab, 0)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 #define NBD_SET_BLKSIZE _IO(0xab, 1)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 #define NBD_SET_SIZE _IO(0xab, 2)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
40 #define NBD_DO_IT _IO(0xab, 3)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 #define NBD_CLEAR_SOCK _IO(0xab, 4)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 #define NBD_CLEAR_QUEUE _IO(0xab, 5)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 #define NBD_PRINT_DEBUG _IO(0xab, 6)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 #define NBD_SET_SIZE_BLOCKS _IO(0xab, 7)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 #define NBD_DISCONNECT _IO(0xab, 8)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 #define NBD_SET_TIMEOUT _IO(0xab, 9)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
47
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 void nbd_client_main(void)
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 {
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 int sock = -1, nbd, flags;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 unsigned long timeout = 0;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 struct addrinfo *addr, *p;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 char *host=toys.optargs[0], *port=toys.optargs[1], *device=toys.optargs[2];
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 uint64_t devsize;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
55
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 // Repeat until spanked
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
57
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
58 nbd = xopen(device, O_RDWR);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
59 for (;;) {
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
60 int temp;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 struct addrinfo hints;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
62
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
63 // Find and connect to server
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
64
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 memset(&hints, 0, sizeof(hints));
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 hints.ai_family = PF_UNSPEC;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 hints.ai_socktype = SOCK_STREAM;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 if (getaddrinfo(host, port, &hints, &addr)) addr = 0;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 for (p = addr; p; p = p->ai_next) {
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 if (-1 != connect(sock, p->ai_addr, p->ai_addrlen)) break;
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
72 close(sock);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 }
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 freeaddrinfo(addr);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
75
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
76 if (!p) perror_exit("%s:%s", host, port);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
77
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
78 temp = 1;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
79 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &temp, sizeof(int));
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
80
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
81 // Read login data
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
82
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
83 xreadall(sock, toybuf, 152);
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
84 if (memcmp(toybuf, "NBDMAGIC\x00\x00\x42\x02\x81\x86\x12\x53", 16))
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
85 error_exit("bad login %s:%s", host, port);
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
86 devsize = SWAP_BE64(*(uint64_t *)(toybuf+16));
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
87 flags = SWAP_BE32(*(int *)(toybuf+24));
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
88
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
89 // Set 4k block size. Everything uses that these days.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
90 ioctl(nbd, NBD_SET_BLKSIZE, 4096);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 ioctl(nbd, NBD_SET_SIZE_BLOCKS, devsize/4096);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
92 ioctl(nbd, NBD_CLEAR_SOCK);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
93
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 // If the sucker was exported read only, respect that locally.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 temp = (flags & 2) ? 1 : 0;
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
96 xioctl(nbd, BLKROSET, &temp);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
97
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 if (timeout && ioctl(nbd, NBD_SET_TIMEOUT, timeout)<0) break;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
99 if (ioctl(nbd, NBD_SET_SOCK, sock) < 0) break;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
100
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
101 if (toys.optflags & FLAG_s) mlockall(MCL_CURRENT|MCL_FUTURE);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
102
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
103 // Open the device to force reread of the partition table.
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
104 if ((toys.optflags & FLAG_n) || !fork()) {
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
105 char *s = strrchr(device, '/');
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
106 int i;
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
107
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
108 sprintf(toybuf, "/sys/block/%.32s/pid", s ? s+1 : device);
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
109 // Is it up yet? (Give it 10 seconds.)
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
110 for (i=0; i<100; i++) {
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
111 temp = open(toybuf, O_RDONLY);
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
112 if (temp == -1) msleep(100);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 else {
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
114 close(temp);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
115 break;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 }
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
117 }
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
118 close(open(device, O_RDONLY));
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
119 if (!(toys.optflags & FLAG_n)) exit(0);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
120 }
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
121
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
122 // Daemonize here.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
123
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
124 daemon(0,0);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
125
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
126 // Process NBD requests until further notice.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
127
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
128 if (ioctl(nbd, NBD_DO_IT)>=0 || errno==EBADR) break;
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
129 close(sock);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
130 }
893
6f5fed66c722 Some work I did over the weekend on nbd_client, not sure where I left off...
Rob Landley <rob@landley.net>
parents: 822
diff changeset
131 close(nbd);
822
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
132
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
133 // Flush queue and exit.
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
134
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
135 ioctl(nbd, NBD_CLEAR_QUEUE);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
136 ioctl(nbd, NBD_CLEAR_SOCK);
84959a5529e8 The old nbd-client I wrote in 2010. Needs cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 }