Skip to content
Commit b6cd31e1 authored by Ed Tanous's avatar Ed Tanous Committed by Ed Tanous
Browse files

Simplify message registry to save binary size

Internally to bmcweb, we actually store two copies of every string in
the base privilege registry.  As history played out, the
error_messages.cpp was created first, then when logging was added, we
needed more fine grained programatic lookups into the message
registries, so we invented the constexpr array.  Previously, it was
thought that xz basically deduplicated the duplicated strings.  While
this is true to some extent, it using the actual processing code seems
to be a win on binary size.

This is also a -500 line diff, so it's reducing the amount of code we
have at the same time.

Note, the "InvalidUpload" message is incorrect per the standard, which
this patchset sort of teases out, as it's the only one that can't be
updated.  This patchset leaves it as-written.

Tested:
xz compressed bmcweb went from 1174632 bytes, down to 1157040 bytes, or
a 1.4% (17592 bytes) reduction in compressed binary size.

curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar


{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type #Chassis.v1_16_0.Chassis named 'foobar' was not found.",
        "MessageArgs": [
          "#Chassis.v1_16_0.Chassis",
          "foobar"
        ],
        "MessageId": "Base.1.11.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.11.0.ResourceNotFound",
    "message": "The requested resource of type #Chassis.v1_16_0.Chassis named 'foobar' was not found."
  }
}

Note, the MessageId property has changed its version from Base.1.8 to
Base.1.11.  This is correct and matches the version of the registry we
use.  Also, the second argument is now quoted, as the ResourceNotFound
schema requires.

Signed-off-by: default avatarEd Tanous <edtanous@google.com>
Change-Id: Ifd0bd71a26eebeba8ba89704a1eca425f0776aa8
parent 93c0202a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment