[haiku-commits] haiku: hrev52985 - in src/system/kernel: debug messaging slab

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 10 Mar 2019 16:41:09 -0400 (EDT)

hrev52985 adds 2 changesets to branch 'master'
old head: 6ff7e25bd03c0ac0ea219d36c87e1d5e85101b32
new head: 810071751d7d7f6a33046dd5b7926af99d73d467
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=810071751d7d+%5E6ff7e25bd03c

----------------------------------------------------------------------------

fb7498fe2e3b: system profiler: revert use of BytePointer.
  
  This went through review way too fast once again. I did warn that these
  changes were completely untested, and indeed this one was broken. Be
  very careful when pressing the submit button, please!
  
  Change-Id: I6e0230efe94830033f5427451f67fe6ce29a28e6
  Reviewed-on: https://review.haiku-os.org/c/1184
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

810071751d7d: BytePointer: address Axel's post-merge comments
  
  These changes had been on review on Gerrit for a few weeks, why do the
  comment come only after they were merged?
  
  Change-Id: I54064973e08b8b4dc0624f4c09c7cafb7f04e437
  Reviewed-on: https://review.haiku-os.org/c/1185
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 11 insertions(+), 8 deletions(-)
src/system/kernel/debug/system_profiler.cpp      | 8 ++++----
src/system/kernel/messaging/MessagingService.cpp | 6 ++++--
src/system/kernel/slab/SmallObjectCache.cpp      | 5 +++--

############################################################################

Commit:      fb7498fe2e3b3d07a50d01cfb9721e4cdf5c61c0
URL:         https://git.haiku-os.org/haiku/commit/?id=fb7498fe2e3b
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Mar 10 07:32:01 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Mar 10 20:41:03 2019 UTC

system profiler: revert use of BytePointer.

This went through review way too fast once again. I did warn that these
changes were completely untested, and indeed this one was broken. Be
very careful when pressing the submit button, please!

Change-Id: I6e0230efe94830033f5427451f67fe6ce29a28e6
Reviewed-on: https://review.haiku-os.org/c/1184
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/system/kernel/debug/system_profiler.cpp 
b/src/system/kernel/debug/system_profiler.cpp
index de5af8583a..4902ec7d95 100644
--- a/src/system/kernel/debug/system_profiler.cpp
+++ b/src/system/kernel/debug/system_profiler.cpp
@@ -7,7 +7,6 @@
 #include <system_profiler.h>
 
 #include <AutoDeleter.h>
-#include <BytePointer.h>
 #include <Referenceable.h>
 
 #include <util/AutoLock.h>
@@ -1339,8 +1338,8 @@ SystemProfiler::_AllocateBuffer(size_t size, int event, 
int cpu, int count)
                // Buffer is wrapped or needs wrapping.
                if (end < fBufferCapacity) {
                        // not wrapped yet, but needed
-                       BytePointer<system_profiler_event_header> header(
-                               fBufferBase + end);
+                       system_profiler_event_header* header
+                               = (system_profiler_event_header*)(fBufferBase + 
end);
                        header->event = B_SYSTEM_PROFILER_BUFFER_END;
                        fBufferSize = fBufferCapacity - fBufferStart;
                        end = 0;
@@ -1353,7 +1352,8 @@ SystemProfiler::_AllocateBuffer(size_t size, int event, 
int cpu, int count)
                }
        }
 
-       BytePointer<system_profiler_event_header> header(fBufferBase + end);
+       system_profiler_event_header* header
+               = (system_profiler_event_header*)(fBufferBase + end);
        header->event = event;
        header->cpu = cpu;
        header->size = size - sizeof(system_profiler_event_header);

############################################################################

Revision:    hrev52985
Commit:      810071751d7d7f6a33046dd5b7926af99d73d467
URL:         https://git.haiku-os.org/haiku/commit/?id=810071751d7d
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Mar 10 07:35:55 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Mar 10 20:41:03 2019 UTC

BytePointer: address Axel's post-merge comments

These changes had been on review on Gerrit for a few weeks, why do the
comment come only after they were merged?

Change-Id: I54064973e08b8b4dc0624f4c09c7cafb7f04e437
Reviewed-on: https://review.haiku-os.org/c/1185
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/system/kernel/messaging/MessagingService.cpp 
b/src/system/kernel/messaging/MessagingService.cpp
index fe83fd3da0..e20b29e7d2 100644
--- a/src/system/kernel/messaging/MessagingService.cpp
+++ b/src/system/kernel/messaging/MessagingService.cpp
@@ -200,7 +200,8 @@ MessagingArea::AllocateCommand(uint32 commandWhat, int32 
dataSize,
        }
 
        // init the command
-       BytePointer<messaging_command> command((char*)fHeader + commandOffset);
+       BytePointer<messaging_command> command(fHeader);
+       command += commandOffset;
        command->next_command = 0;
        command->command = commandWhat;
        command->size = size;
@@ -243,7 +244,8 @@ MessagingArea::_CheckCommand(int32 offset, int32 &size)
        }
 
        // get and check size
-       BytePointer<messaging_command> command((char*)fHeader + offset);
+       BytePointer<messaging_command> command(fHeader);
+       command += offset;
        size = command->size;
        if (size < (int32)sizeof(messaging_command))
                return NULL;
diff --git a/src/system/kernel/slab/SmallObjectCache.cpp 
b/src/system/kernel/slab/SmallObjectCache.cpp
index 8e6df40f8f..73c82cf9c4 100644
--- a/src/system/kernel/slab/SmallObjectCache.cpp
+++ b/src/system/kernel/slab/SmallObjectCache.cpp
@@ -17,9 +17,10 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache)
 
 
 static inline slab *
-slab_in_pages(const void *pages, size_t slab_size)
+slab_in_pages(void *pages, size_t slab_size)
 {
-       BytePointer<slab> pointer(((uint8 *)pages) + slab_size - sizeof(slab));
+       BytePointer<slab> pointer(pages);
+       pointer += slab_size - sizeof(slab);
        return &pointer;
 }
 


Other related posts: