lib/s390x/sclp: Clarify that the CPUEntry array could be at a different spot
PATCH 1/1 lib/s390x/sclp: Clarify that the CPUEntry array could be at a different spot
The "struct CPUEntry entries[0]" in the ReadInfo structure is misleading since the entries could be add a completely different spot. Replace it by a proper comment instead.
--- lib/s390x/sclp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/s390x/sclp.h +7 -2
@@ -131,10 +131,15 @@ typedef struct ReadInfo {uint16_t highest_cpu;uint8_t _reserved5[124 -122 ];/* 122-123 */ uint32_t hmfai; -uint8_t reserved7[134 -128 ]; +uint8_t reserved7[134 -128 ];/* 128-133 */ uint8_t byte_134_diag318 : 1; uint8_t : 7; -struct CPUEntry entries[0 ]; +/* +* At the end of the ReadInfo, there are also the CPU entries (see +* struct CPUEntry). When the Extended-Length SCCB (ELS) feature is +* enabled, the start of the CPU entries array begins at an offset +* denoted by the offset_cpu field, otherwise it's at offset 128. +*/ } __attribute__((packed)) ReadInfo; typedef struct ReadCpuInfo {
Signature · 1 line
2.27.0
Quoted 2 lines · On Thu, 21 Jan 2021 07:57:03 +0100 Thomas Huth <[email protected]> wrote:
The "struct CPUEntry entries[0]" in the ReadInfo structure is misleading since the entries could be add a completely different spot. Replace it
s/add/at/
Quoted 16 lines
by a proper comment instead.
Signed-off-by Thomas Huth <[email protected]>--- lib/s390x/sclp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)lib/s390x/sclp.h +0
-1@@ -131,10 +131,15 @@ typedef struct ReadInfo {uint16_t highest_cpu;uint8_t _reserved5[124 -122 ];/* 122-123 */ uint32_t hmfai; -uint8_t reserved7[134 -128 ];
lib/s390x/sclp.h typedef struct ReadInfo { · line 142
Quoted 10 lines
lib/s390x/sclp.h +7
-1+uint8_t reserved7[134 -128 ];/* 128-133 */ uint8_t byte_134_diag318 : 1; uint8_t : 7; -struct CPUEntry entries[0 ]; +/* +* At the end of the ReadInfo, there are also the CPU entries (see +* struct CPUEntry). When the Extended-Length SCCB (ELS) feature is +* enabled, the start of the CPU entries array begins at an offset +* denoted by the offset_cpu field, otherwise it's at offset 128. +*/
This comment is really helpful, as the difference for ELS had actually slipped my mind again...
lib/s390x/sclp.h typedef struct ReadInfo { · line 145
Quoted 3 lines
lib/s390x/sclp.h +0
-0} __attribute__((packed)) ReadInfo; typedef struct ReadCpuInfo {
Quoted 22 lines · Thomas Huth
The "struct CPUEntry entries[0]" in the ReadInfo structure is misleading since the entries could be add a completely different spot. Replace it by a proper comment instead.
Signed-off-by Thomas Huth <[email protected]>--- lib/s390x/sclp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)lib/s390x/sclp.h +1
-1@@ -131,10 +131,15 @@ typedef struct ReadInfo {uint16_t highest_cpu;uint8_t _reserved5[124 -122 ];/* 122-123 */ uint32_t hmfai; -uint8_t reserved7[134 -128 ]; +uint8_t reserved7[134 -128 ];/* 128-133 */ uint8_t byte_134_diag318 : 1; uint8_t : 7;
lib/s390x/sclp.h typedef struct ReadInfo { · line 145
Quoted 10 lines
lib/s390x/sclp.h +6
-1-struct CPUEntry entries[0 ]; +/* +* At the end of the ReadInfo, there are also the CPU entries (see +* struct CPUEntry). When the Extended-Length SCCB (ELS) feature is +* enabled, the start of the CPU entries array begins at an offset +* denoted by the offset_cpu field, otherwise it's at offset 128. +*/ } __attribute__((packed)) ReadInfo; typedef struct ReadCpuInfo {
Signature · 3 lines
Thanks, David / dhildenb
Quoted 5 lines · Thomas Huth
The "struct CPUEntry entries[0]" in the ReadInfo structure is misleading since the entries could be add a completely different spot. Replace it by a proper comment instead.
Signed-off-by Thomas Huth <[email protected]>
Thanks, picked.
I'll fix up Conny's comment.
Quoted 27 lines
--- lib/s390x/sclp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)lib/s390x/sclp.h +7
-2@@ -131,10 +131,15 @@ typedef struct ReadInfo {uint16_t highest_cpu;uint8_t _reserved5[124 -122 ];/* 122-123 */ uint32_t hmfai; -uint8_t reserved7[134 -128 ]; +uint8_t reserved7[134 -128 ];/* 128-133 */ uint8_t byte_134_diag318 : 1; uint8_t : 7; -struct CPUEntry entries[0 ]; +/* +* At the end of the ReadInfo, there are also the CPU entries (see +* struct CPUEntry). When the Extended-Length SCCB (ELS) feature is +* enabled, the start of the CPU entries array begins at an offset +* denoted by the offset_cpu field, otherwise it's at offset 128. +*/ } __attribute__((packed)) ReadInfo; typedef struct ReadCpuInfo {