- // Free the list entry
- kfree(read_entry, (sizeof(struct oslog_stream_buf_entry_s) + read_entry->size));
- break;
- }
- /* Handle log messages */
- case oslog_stream_link_type_log:
- {
- /* ensure that the correct read entry was dequeued */
- assert(read_entry->offset == oslog_streambufp->msg_bufr);
- rec_length = read_entry->size;
-
- // If the next log line is contiguous in the buffer, copy it out.
- if(read_entry->offset + rec_length <= oslog_streambufp->msg_size) {
- memcpy(logline + logpos,
- oslog_streambufp->msg_bufc + read_entry->offset, rec_length);
-
- oslog_streambufp->msg_bufr += rec_length;
- if (oslog_streambufp->msg_bufr == oslog_streambufp->msg_size) {
- oslog_streambufp->msg_bufr = 0;
- }
- logpos += rec_length;
- } else {
- // Otherwise, copy until the end of the buffer, and
- // copy the remaining bytes starting at index 0.
- int bytes_left = oslog_streambufp->msg_size - read_entry->offset;
- memcpy(logline + logpos,
- oslog_streambufp->msg_bufc + read_entry->offset, bytes_left);
- logpos += bytes_left;
- rec_length -= bytes_left;
-
- memcpy(logline + logpos, (const void *)oslog_streambufp->msg_bufc,
- rec_length);
- oslog_streambufp->msg_bufr = rec_length;
- logpos += rec_length;
- }
- assert(oslog_streambufp->msg_bufr < oslog_streambufp->msg_size);
- STAILQ_INSERT_TAIL(&oslog_stream_free_head, read_entry, buf_entries);
+ // Free the list entry
+ kfree(read_entry, (sizeof(struct oslog_stream_buf_entry_s) + read_entry->size));
+ break;
+ }
+ /* Handle log messages */
+ case oslog_stream_link_type_log:
+ {
+ /* ensure that the correct read entry was dequeued */
+ assert(read_entry->offset == oslog_streambufp->msg_bufr);
+ rec_length = read_entry->size;
+
+ // If the next log line is contiguous in the buffer, copy it out.
+ if (read_entry->offset + rec_length <= oslog_streambufp->msg_size) {
+ memcpy(logline + logpos,
+ oslog_streambufp->msg_bufc + read_entry->offset, rec_length);