]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fastbuf.h
Build: Added link path to libraries installed to non-standard path.
[libucw.git] / ucw / fastbuf.h
index d2904433afc6c3dbf31a1d66d3433a46e500a8d6..99a9dd47285f04f5adb0c458370ced1c359a2dff 100644 (file)
@@ -3,6 +3,7 @@
  *
  *     (c) 1997--2011 Martin Mares <mj@ucw.cz>
  *     (c) 2004 Robert Spalek <robert@ucw.cz>
+ *     (c) 2014 Pavel Charvat <pchar@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
@@ -73,6 +74,9 @@
 #define fbmulti_append ucw_fbmulti_append
 #define fbmulti_create ucw_fbmulti_create
 #define fbmulti_remove ucw_fbmulti_remove
+#define fbnull_open ucw_fbnull_open
+#define fbnull_start ucw_fbnull_start
+#define fbnull_test ucw_fbnull_test
 #define fbpar_cf ucw_fbpar_cf
 #define fbpar_def ucw_fbpar_def
 #define fbpool_end ucw_fbpool_end
@@ -542,6 +546,25 @@ static inline void fbatomic_commit(struct fastbuf *b)
     fbatomic_internal_write(b);
 }
 
+/*** === Null fastbufs ***/
+
+/**
+ * Creates a new "/dev/null"-like  fastbuf.
+ * Any read attempt returns an EOF, any write attempt is silently ignored.
+ **/
+struct fastbuf *fbnull_open(uns bufsize);
+
+/**
+ * Can be used by any back-end to switch it to the null mode.
+ * You need to provide at least one byte long buffer for writing.
+ **/
+void fbnull_start(struct fastbuf *b, byte *buf, uns bufsize);
+
+/**
+ * Checks whether a fastbuf has been switched to the null mode.
+ **/
+bool fbnull_test(struct fastbuf *b);
+
 /***
  * === Fastbufs atop other fastbufs [[fbmulti]]
  *