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

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Jan 20 03:08:34 CET 2012

On Thu, 19 Jan 2012 12:01:11 +0000
"Alexander Nezhinsky" <nezhinsky at gmail.com> wrote:

> 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

Yeah, we need helper functions to handle FILE* internally. So mgmt.c
doesn't need to handle FILE* directly. That's what you suggest below,

Can you send a new patch for only mgmt.c with the modified concat_buf

> 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.

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