>>> On 28.03.19 at 14:56, <talons....@gmail.com> wrote: > Extend smbios type 2 struct to match specification, add support to > write it when customized string provided and no smbios passed in. > > Signed-off-by: Xin Li <xin...@citrix.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com> with one minor remaining remark: > @@ -518,8 +520,71 @@ smbios_type_2_init(void *start) > return (start + length); > } > > - /* Only present when passed in */ > - return start; > + memset(p, 0, sizeof(*p)); > + p->header.type = 2; > + p->header.length = sizeof(struct smbios_type_2); > + p->header.handle = SMBIOS_HANDLE_TYPE2; > + p->feature_flags = 0x09; /* Board is a hosting board and replaceable */ > + p->chassis_handle = SMBIOS_HANDLE_TYPE3; > + p->board_type = 0x0a; /* Motherboard */ > + start += sizeof(*p); > + > + s = xenstore_read(HVM_XS_BASEBOARD_MANUFACTURER, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->manufacturer_str = ++counter; > + } > + > + s = xenstore_read(HVM_XS_BASEBOARD_PRODUCT_NAME, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->product_name_str = ++counter; > + } > + > + s = xenstore_read(HVM_XS_BASEBOARD_VERSION, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->version_str = ++counter; > + } > + > + s = xenstore_read(HVM_XS_BASEBOARD_SERIAL_NUMBER, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->serial_number_str = ++counter; > + } > + > + s = xenstore_read(HVM_XS_BASEBOARD_ASSET_TAG, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->asset_tag_str = ++counter; > + } > + > + s = xenstore_read(HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS, NULL); > + if ( (s != NULL) && (*s != '\0') ) > + { > + strcpy(start, s); > + start += strlen(s) + 1; > + p->location_in_chassis_str = ++counter; > + } > + > + if ( counter ) > + { > + *((uint8_t *)start) = 0; There's another pair of unnecessary parentheses here. If I end up committing this I may take the liberty to drop them. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel