| 29 | } |
| 30 | |
| 31 | int smbios_add_string(u8 *start, const char *str) |
| 32 | { |
| 33 | int i = 1; |
| 34 | char *p = (char *)start; |
| 35 | |
| 36 | /* |
| 37 | * Return 0 as required for empty strings. |
| 38 | * See Section 6.1.3 "Text Strings" of the SMBIOS specification. |
| 39 | */ |
| 40 | if (str == NULL || *str == '\0') |
| 41 | return 0; |
| 42 | |
| 43 | for (;;) { |
| 44 | if (!*p) { |
| 45 | strcpy(p, str); |
| 46 | p += strlen(str); |
| 47 | *p++ = '\0'; |
| 48 | *p++ = '\0'; |
| 49 | return i; |
| 50 | } |
| 51 | |
| 52 | if (!strcmp(p, str)) |
| 53 | return i; |
| 54 | |
| 55 | p += strlen(p)+1; |
| 56 | i++; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | int smbios_string_table_len(u8 *start) |
| 61 | { |
no test coverage detected