diff --git a/include/villas/advio.h b/include/villas/advio.h index e02fd2cc1..5c6d4d18a 100644 --- a/include/villas/advio.h +++ b/include/villas/advio.h @@ -25,8 +25,7 @@ #include enum advio_flags { - ADVIO_MEM = (1 << 0), /**< Instead of a real file, a memory backed stdio stream is used. */ - ADVIO_DIRTY = (1 << 1) /**< The file contents have been modified. We need to upload. */ + ADVIO_DIRTY = (1 << 0) /**< The file contents have been modified. We need to upload. */ }; struct advio { @@ -34,11 +33,7 @@ struct advio { CURL *curl; FILE *file; - - /* For use with ADVIO_MODE_MEM */ - char *buf; - size_t size; - + const char *uri; }; diff --git a/lib/advio.c b/lib/advio.c index db740ffdc..b2818beff 100644 --- a/lib/advio.c +++ b/lib/advio.c @@ -49,7 +49,6 @@ static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ul int dotz = round(frac * BAR_WIDTH); // create the "meter" - printf("%3.0f%% in %f s (%" CURL_FORMAT_CURL_OFF_T " / %" CURL_FORMAT_CURL_OFF_T ") [", frac * 100, curtime, dlnow, dltotal); // part that's full already @@ -71,14 +70,11 @@ static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ul AFILE * afopen(const char *uri, const char *mode, int flags) { CURLcode res; + long code; AFILE *af = alloc(sizeof(AFILE)); - if (flags & ADVIO_MEM) - af->file = open_memstream(&af->buf, &af->size); - else - af->file = tmpfile(); - + af->file = tmpfile(); if (!af->file) goto out2; @@ -157,12 +153,9 @@ int afflush(AFILE *af) CURLcode res; long pos; - /* Flushing a memory backed stream is sensless */ - if (!(af->flags & ADVIO_MEM)) { - ret = fflush(af->file); - if (ret) - return ret; - } + ret = fflush(af->file); + if (ret) + return ret; curl_easy_setopt(af->curl, CURLOPT_UPLOAD, 1L); curl_easy_setopt(af->curl, CURLOPT_READDATA, af->file); diff --git a/lib/super_node.c b/lib/super_node.c index e66df1366..1203e1489 100644 --- a/lib/super_node.c +++ b/lib/super_node.c @@ -103,7 +103,7 @@ int super_node_parse_uri(struct super_node *sn, const char *uri) } /* Use advio (libcurl) to fetch the config from a remote */ else { - af = afopen(uri, "r", ADVIO_MEM); + af = afopen(uri, "r", 0); f = af ? af->file : NULL; }