| 100 | } |
| 101 | |
| 102 | void |
| 103 | memif_msg_enq_disconnect(struct memif_control_channel *cc, const char *reason, |
| 104 | int err_code) |
| 105 | { |
| 106 | struct memif_msg_queue_elt *e; |
| 107 | struct pmd_internals *pmd; |
| 108 | memif_msg_disconnect_t *d; |
| 109 | |
| 110 | if (cc == NULL) { |
| 111 | MIF_LOG(DEBUG, "Missing control channel."); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | e = memif_msg_enq(cc); |
| 116 | if (e == NULL) { |
| 117 | MIF_LOG(WARNING, "Failed to enqueue disconnect message."); |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | d = &e->msg.disconnect; |
| 122 | |
| 123 | e->msg.type = MEMIF_MSG_TYPE_DISCONNECT; |
| 124 | d->code = err_code; |
| 125 | |
| 126 | if (reason != NULL) { |
| 127 | strlcpy((char *)d->string, reason, sizeof(d->string)); |
| 128 | if (cc->dev != NULL) { |
| 129 | pmd = cc->dev->data->dev_private; |
| 130 | strlcpy(pmd->local_disc_string, reason, |
| 131 | sizeof(pmd->local_disc_string)); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | static int |
| 137 | memif_msg_enq_hello(struct memif_control_channel *cc) |
no test coverage detected