Revision 2c7989a9 nbd.c
b/nbd.c | ||
---|---|---|
202 | 202 |
memcpy(buf, "NBDMAGIC", 8); |
203 | 203 |
cpu_to_be64w((uint64_t*)(buf + 8), 0x00420281861253LL); |
204 | 204 |
cpu_to_be64w((uint64_t*)(buf + 16), size); |
205 |
cpu_to_be32w((uint32_t*)(buf + 24), flags | NBD_FLAG_HAS_FLAGS); |
|
205 |
cpu_to_be32w((uint32_t*)(buf + 24), |
|
206 |
flags | NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_FUA); |
|
206 | 207 |
memset(buf + 28, 0, 124); |
207 | 208 |
|
208 | 209 |
if (write_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { |
... | ... | |
630 | 631 |
reply.handle = request.handle; |
631 | 632 |
reply.error = 0; |
632 | 633 |
|
633 |
switch (request.type) { |
|
634 |
switch (request.type & NBD_CMD_MASK_COMMAND) {
|
|
634 | 635 |
case NBD_CMD_READ: |
635 | 636 |
TRACE("Request type is READ"); |
636 | 637 |
|
... | ... | |
692 | 693 |
} |
693 | 694 |
|
694 | 695 |
*offset += request.len; |
696 |
|
|
697 |
if (request.type & NBD_CMD_FLAG_FUA) { |
|
698 |
ret = bdrv_flush(bs); |
|
699 |
if (ret < 0) { |
|
700 |
LOG("flush failed"); |
|
701 |
reply.error = -ret; |
|
702 |
} |
|
703 |
} |
|
695 | 704 |
} |
696 | 705 |
|
697 | 706 |
if (nbd_send_reply(csock, &reply) == -1) |
Also available in: Unified diff