/* * Return addr of desired type (MSGR2 or LEGACY) or error. * Make sure there is only one match. * * Assume encoding with MSG_ADDR2.
*/ int ceph_decode_entity_addrvec(void **p, void *end, bool msgr2, struct ceph_entity_addr *addr)
{
__le32 my_type = msgr2 ? CEPH_ENTITY_ADDR_TYPE_MSGR2 :
CEPH_ENTITY_ADDR_TYPE_LEGACY; struct ceph_entity_addr tmp_addr; int addr_cnt; bool found;
u8 marker; int ret; int i;
found = false; for (i = 0; i < addr_cnt; i++) {
ret = ceph_decode_entity_addr(p, end, &tmp_addr); if (ret) return ret;
dout("%s i %d addr %s\n", __func__, i, ceph_pr_addr(&tmp_addr)); if (tmp_addr.type == my_type) { if (found) {
pr_err("another match of type %d in addrvec\n",
le32_to_cpu(my_type)); return -EINVAL;
}
memcpy(addr, &tmp_addr, sizeof(*addr));
found = true;
}
}
if (found) return 0;
if (!addr_cnt) return 0; /* normal -- e.g. unused OSD id/slot */
if (addr_cnt == 1 && !memchr_inv(&tmp_addr, 0, sizeof(tmp_addr))) return 0; /* weird but effectively the same as !addr_cnt */
pr_err("no match of type %d in addrvec\n", le32_to_cpu(my_type)); return -ENOENT;
switch (family) { case AF_INET: returnsizeof(u.sin); case AF_INET6: returnsizeof(u.sin6); default: returnsizeof(u);
}
}
int ceph_entity_addr_encoding_len(conststruct ceph_entity_addr *addr)
{
sa_family_t family = get_unaligned(&addr->in_addr.ss_family); int addr_len = get_sockaddr_encoding_len(family);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.