libust: fix problem in computation of offset in buffer
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 11 Jun 2009 18:02:21 +0000 (14:02 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 11 Jun 2009 18:02:21 +0000 (14:02 -0400)
libust/relay.h

index 7d582a8802e13c70cced7ea3e1bfbbe93e56c005..6b3a8b79692affb40781a66990b7279c18a49e09 100644 (file)
@@ -21,6 +21,8 @@
 //ust// #include <linux/kref.h>
 //ust// #include <linux/mm.h>
 //ust// #include <linux/ltt-core.h>
+#include <assert.h>
+#include "tracer.h"
 #include "kref.h"
 //#include "list.h"
 #include "channels.h"
@@ -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.027013 seconds and 4 git commands to generate.