Changeset 4743

Show
Ignore:
Timestamp:
09/02/07 13:09:16 (6 years ago)
Author:
khali
Message:

Use the feature type rather than the feature name to figure out whether
we need to add "_input" to get the correct sysfs file name. This is
much faster. This is still a ugly hack I'd like to get rid of, but at
least now the slowdown is acceptable.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c

    r4742 r4743  
    412412        char n[NAME_MAX]; 
    413413        FILE *f; 
    414         int dummy; 
    415         char check; 
    416414        const char *suffix = ""; 
    417415 
     
    420418 
    421419        /* REVISIT: this is a ugly hack */ 
    422         if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 
    423          || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 
    424          || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) 
     420        if (the_feature->data.type == SENSORS_FEATURE_IN 
     421         || the_feature->data.type == SENSORS_FEATURE_FAN 
     422         || the_feature->data.type == SENSORS_FEATURE_TEMP) 
    425423                suffix = "_input"; 
    426424 
     
    447445        char n[NAME_MAX]; 
    448446        FILE *f; 
    449         int dummy; 
    450         char check; 
    451447        const char *suffix = ""; 
    452448 
     
    455451 
    456452        /* REVISIT: this is a ugly hack */ 
    457         if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 
    458          || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 
    459          || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) 
     453        if (the_feature->data.type == SENSORS_FEATURE_IN 
     454         || the_feature->data.type == SENSORS_FEATURE_FAN 
     455         || the_feature->data.type == SENSORS_FEATURE_TEMP) 
    460456                suffix = "_input"; 
    461457