[Sheepdog] [PATCH] remove unused exec_reqs helper function
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Thu May 6 12:45:15 CEST 2010
Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
include/net.h | 5 ----
lib/net.c | 63 ---------------------------------------------------------
2 files changed, 0 insertions(+), 68 deletions(-)
diff --git a/include/net.h b/include/net.h
index 618d202..024276b 100644
--- a/include/net.h
+++ b/include/net.h
@@ -47,11 +47,6 @@ int remove_object(struct sheepdog_node_list_entry *e,
int nodes, uint32_t node_version,
uint64_t oid, int nr);
-int exec_reqs(struct sheepdog_node_list_entry *e,
- int nodes, uint32_t node_version, uint64_t oid, struct sd_req *hdr,
- char *data, unsigned int wdatalen, unsigned int rdatalen, int nr,
- int quorum);
-
int create_listen_ports(int port, int (*callback)(int fd, void *), void *data);
char *addr_to_str(char *str, int size, uint8_t *addr, uint16_t port);
diff --git a/lib/net.c b/lib/net.c
index 6c648e0..b7b5a4d 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -485,69 +485,6 @@ int remove_object(struct sheepdog_node_list_entry *e,
return 0;
}
-/* TODO: clean up with the above functions */
-int exec_reqs(struct sheepdog_node_list_entry *e,
- int nodes, uint32_t node_version, uint64_t oid, struct sd_req *hdr,
- char *data, unsigned int wdatalen, unsigned int rdatalen, int nr,
- int quorum)
-{
- char name[128];
- int i = 0, n, fd, ret;
- int success = 0;
- struct sd_req tmp;
- struct sd_rsp *rsp = (struct sd_rsp *)&tmp;
- unsigned wlen, rlen;
-
- for (i = 0; i < nr; i++) {
- wlen = wdatalen;
- rlen = rdatalen;
-
- n = obj_to_sheep(e, nodes, oid, i);
-
- addr_to_str(name, sizeof(name), e[n].addr, 0);
-
- fd = connect_to(name, e[n].port);
- if (fd < 0) {
- ((struct sd_rsp *) hdr)->result = SD_RES_EIO;
- return -1;
- }
-
- hdr->epoch = node_version;
- if (wdatalen) {
- hdr->flags |= SD_FLAG_CMD_WRITE;
- hdr->data_length = wdatalen;
- } else if (rdatalen) {
- hdr->flags &= ~SD_FLAG_CMD_WRITE;
- hdr->data_length = rdatalen;
- } else
- hdr->data_length = 0;
-
- memcpy(&tmp, hdr, sizeof(tmp));
- ret = exec_req(fd, &tmp, data, &wlen, &rlen);
- close(fd);
-
- rsp = (struct sd_rsp *)&tmp;
-
- if (!ret) {
- if (rsp->result == SD_RES_SUCCESS)
- success++;
- }
-
- if (success >= quorum)
- break;
- }
-
- memcpy(hdr, rsp, sizeof(*rsp));
-
- if (success < quorum)
- return -1;
-
- if (rdatalen)
- return rlen;
- else
- return wlen;
-}
-
/* TODO: support IPv6 */
char *addr_to_str(char *str, int size, uint8_t *addr, uint16_t port)
{
--
1.6.5
More information about the sheepdog
mailing list