[stgt] [PATCH 3/6] mgmt and concat_buf: using concat_buf in mgmt.c

Alexander Nezhinsky nezhinsky at gmail.com
Thu Jan 19 13:01:11 CET 2012


I agree that encapsulation of concat_buf in mtask is cleaner and simpler, but I think that exposing FILE* when writing to socket or using mechanisms like splice are an overkill, even more than exposing size in mgmt.c

Let's save the size internally in concat_buf and add a method for writing to a fd (in our case a socket). 
So in addition to concat_sprintf() there will be concat_write(struct concat_buf *b, int fd)
It will call fflush or fclose, as only then the buffer ptr and size are obtained, and write to the file.
Then rsp_buf is indeed killed as concat_buf replaces it and instead calling free(rsp_buf) we call a new func concat_buf_free(struct concat_buf *b).
Also no need in concat_finish(), as fclose() is called upon write.

Sounds better?
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list