* Ensure the expected number of FDs is received, * close all FDs and return an error if this is not the case. */
| 88 | * close all FDs and return an error if this is not the case. |
| 89 | */ |
| 90 | static int |
| 91 | validate_msg_fds(struct virtio_net *dev, struct vhu_msg_context *ctx, int expected_fds) |
| 92 | { |
| 93 | if (ctx->fd_num == expected_fds) |
| 94 | return 0; |
| 95 | |
| 96 | VHOST_LOG_CONFIG(dev->ifname, ERR, |
| 97 | "expect %d FDs for request %s, received %d\n", |
| 98 | expected_fds, vhost_message_handlers[ctx->msg.request.frontend].description, |
| 99 | ctx->fd_num); |
| 100 | |
| 101 | close_msg_fds(ctx); |
| 102 | |
| 103 | return -1; |
| 104 | } |
| 105 | |
| 106 | static uint64_t |
| 107 | get_blk_size(int fd) |
no test coverage detected