buf->flags = BF_EMPTY;
buf->r = buf->lr = buf->w = buf->data;
buf->max_len = BUFSIZE;
+#if defined(CONFIG_HAP_LINUX_SPLICE)
+ buf->splice.prod = buf->splice.cons = -1; /* closed */
+#endif
}
/* returns 1 if the buffer is empty, 0 otherwise */
#define BF_HIJACK 0x040000 /* the producer is temporarily replaced by ->hijacker */
#define BF_ANA_TIMEOUT 0x080000 /* the analyser timeout has expired */
#define BF_READ_ATTACHED 0x100000 /* the read side is attached for the first time */
+#define BF_KERN_SPLICING 0x200000 /* kernel splicing desired for this buffer */
/* Use these masks to clear the flags before going back to lower layers */
#define BF_CLEAR_READ (~(BF_READ_NULL|BF_READ_PARTIAL|BF_READ_ERROR|BF_READ_ATTACHED))
unsigned long long total; /* total data read */
struct stream_interface *prod; /* producer attached to this buffer */
struct stream_interface *cons; /* consumer attached to this buffer */
+ struct {
+#if defined(CONFIG_HAP_LINUX_SPLICE)
+ int prod; /* -1 or fd of the pipe's end towards the producer */
+ int cons; /* -1 or fd of the pipe's end towards the consumer */
+#endif
+ } splice;
char data[BUFSIZE];
};
sess_change_server(s, NULL);
}
+#if defined(CONFIG_HAP_LINUX_SPLICE)
+ if (s->req->splice.prod >= 0)
+ close(s->req->splice.prod);
+ if (s->req->splice.cons >= 0)
+ close(s->req->splice.cons);
+
+ if (s->req->splice.prod >= 0 || s->req->splice.cons >= 0)
+ usedpipes--;
+
+ if (s->rep->splice.prod >= 0)
+ close(s->rep->splice.prod);
+ if (s->rep->splice.cons >= 0)
+ close(s->rep->splice.cons);
+
+ if (s->rep->splice.prod >= 0 || s->rep->splice.cons >= 0)
+ usedpipes--;
+#endif
+
pool_free2(pool2_buffer, s->req);
pool_free2(pool2_buffer, s->rep);