int strcmp_cpuid_str(constchar *mapcpuid, constchar *id)
{
regex_t re;
regmatch_t pmatch[1]; int match; bool full_mapcpuid = is_full_cpuid(mapcpuid); bool full_cpuid = is_full_cpuid(id);
/* * Full CPUID format is required to identify a platform. * Error out if the cpuid string is incomplete.
*/ if (full_mapcpuid && !full_cpuid) {
pr_info("Invalid CPUID %s. Full CPUID is required, " "vendor-family-model-stepping\n", id); return 1;
}
if (regcomp(&re, mapcpuid, REG_EXTENDED) != 0) { /* Warn unable to generate match particular string. */
pr_info("Invalid regular expression %s\n", mapcpuid); return 1;
}
match = !regexec(&re, id, 1, pmatch, 0);
regfree(&re); if (match) {
size_t match_len = (pmatch[0].rm_eo - pmatch[0].rm_so);
size_t cpuid_len;
/* If the full CPUID format isn't required, * ignoring the stepping.
*/ if (!full_mapcpuid && full_cpuid)
cpuid_len = strrchr(id, '-') - id; else
cpuid_len = strlen(id);
/* Verify the entire string matched. */ if (match_len == cpuid_len) return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.