New kcompat headers depend on urcu's arch.h and arch_atomic.h
[ust.git] / libust / relay.h
index 7d582a8802e13c70cced7ea3e1bfbbe93e56c005..3df1275375ce12d2c528a7f63db67ff84d2b827e 100644 (file)
 //ust// #include <linux/kref.h>
 //ust// #include <linux/mm.h>
 //ust// #include <linux/ltt-core.h>
+#include <assert.h>
 #include "kref.h"
 //#include "list.h"
 #include "channels.h"
+#include "buffer.h"
 
 /* Needs a _much_ better name... */
 #define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
@@ -290,13 +292,16 @@ static inline int ltt_relay_write(struct rchan_buf *buf, size_t offset,
 //ust//                _ltt_relay_write(buf, offset, src, len, page, pagecpy);
 //ust//        return len;
 
-
        size_t cpy;
-       cpy = min_t(size_t, len, buf->buf_size - offset);
-       ltt_relay_do_copy(buf->buf_data + offset, src, cpy);
+       size_t buf_offset = BUFFER_OFFSET(offset, buf->chan);
+
+       assert(buf_offset < buf->chan->subbuf_size*buf->chan->n_subbufs);
+
+       cpy = min_t(size_t, len, buf->buf_size - buf_offset);
+       ltt_relay_do_copy(buf->buf_data + buf_offset, src, cpy);
        
        if (unlikely(len != cpy))
-               _ltt_relay_write(buf, offset, src, len, cpy);
+               _ltt_relay_write(buf, buf_offset, src, len, cpy);
        return len;
 }
 
This page took 0.023307 seconds and 4 git commands to generate.