From db9c31fcf57024abfdc7b35825409166f17d5aac Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 12 Apr 2019 07:55:04 +0530 Subject: tests: validate volfile grammar - strings in volfile * libglusterfs/graph-print: remove unused code updates: bz#1693692 Change-Id: Iae81bb6a3af5911c3da07ab8f1d8f58f27e06905 Signed-off-by: Amar Tumballi --- libglusterfs/src/graph-print.c | 59 ------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'libglusterfs/src/graph-print.c') diff --git a/libglusterfs/src/graph-print.c b/libglusterfs/src/graph-print.c index 6531308c659..595d74330a1 100644 --- a/libglusterfs/src/graph-print.c +++ b/libglusterfs/src/graph-print.c @@ -36,25 +36,6 @@ gp_write_file(struct gf_printer *gp, char *buf, size_t len) return len; } -static ssize_t -gp_write_buf(struct gf_printer *gp, char *buf, size_t len) -{ - struct iovec *iov = gp->priv; - - if (iov->iov_len < len) { - gf_msg("graph-print", GF_LOG_ERROR, 0, LG_MSG_BUFFER_FULL, - "buffer full"); - - return -1; - } - - memcpy(iov->iov_base, buf, len); - iov->iov_base += len; - iov->iov_len -= len; - - return len; -} - static int gpprintf(struct gf_printer *gp, const char *format, ...) { @@ -152,43 +133,3 @@ glusterfs_graph_print_file(FILE *file, glusterfs_graph_t *graph) return glusterfs_graph_print(&gp, graph); } - -char * -glusterfs_graph_print_buf(glusterfs_graph_t *graph) -{ - FILE *f = NULL; - struct iovec iov = { - 0, - }; - int len = 0; - char *buf = NULL; - struct gf_printer gp = {.write = gp_write_buf, .priv = &iov}; - - f = fopen("/dev/null", "a"); - if (!f) { - gf_msg("graph-print", GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED, - "cannot open /dev/null"); - - return NULL; - } - len = glusterfs_graph_print_file(f, graph); - fclose(f); - if (len == -1) - return NULL; - - buf = GF_CALLOC(1, len + 1, gf_common_mt_graph_buf); - if (!buf) { - return NULL; - } - iov.iov_base = buf; - iov.iov_len = len; - - len = glusterfs_graph_print(&gp, graph); - if (len == -1) { - GF_FREE(buf); - - return NULL; - } - - return buf; -} -- cgit