X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Ffastbuf.h;h=4f0d99d3190be67c6fad8ae22e4e11a46760167d;hb=92b3bd34e6024ec20c67e3c1285f3a442fe6f326;hp=aeda6da2e63e451a34d0fa83d9873825f338601a;hpb=c2b6e2fa0eb287e4eb6c7bab1489efc6b41dba3d;p=libucw.git diff --git a/ucw/fastbuf.h b/ucw/fastbuf.h index aeda6da2..4f0d99d3 100644 --- a/ucw/fastbuf.h +++ b/ucw/fastbuf.h @@ -488,15 +488,37 @@ static inline void fbatomic_commit(struct fastbuf *b) * * This backend is seekable iff all of the supplied fastbufs are seekable. * - * Please note that no cleanup of underlying fastbufs is provided. + * You aren't allowed to do anything with the underlying buffers while these + * are connected into fbmulti. * - * Also, please be aware of direct operations on the underlying buffers. The - * fbmulti backend doesn't expect it. + * The fbmulti is inited by @fbmulti_create(). It returns an empty fbmulti. + * Then you call @fbmulti_append() for each fbmulti. * - * The last parameter must be NULL. + * If @bclose() is called on fbmulti, all the underlying buffers get closed + * recursively. + * + * If you want to keep an underlying fastbuf open after @bclose, just remove it + * by @fbmulti_remove where the second parameter is a pointer to the removed + * fastbuf. If you pass NULL, all the underlying fastbufs are removed. + * + * After @fbmulti_remove, the state of the fbmulti is undefined. The only allowed + * operation is either another @fbmulti_remove or @bclose on the fbmulti. ***/ -struct fastbuf* fbmulti_create(uns bufsize, ...) SENTINEL_CHECK; +/** + * Create an empty fbmulti + **/ +struct fastbuf *fbmulti_create(void); + +/** + * Append a fb to fbmulti + **/ +void fbmulti_append(struct fastbuf *f, struct fastbuf *fb); + +/** + * Remove a fb from fbmulti + **/ +void fbmulti_remove(struct fastbuf *f, struct fastbuf *fb); /*** === Configuring stream parameters [[bconfig]] ***/