Changeset 4666

Show
Ignore:
Timestamp:
08/13/07 22:16:03 (7 years ago)
Author:
khali
Message:

Change the libsensors API so that all structures are passed by
reference. This is more efficient that way.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r4661 r4666  
    2020           No longer export sensors_chip_name_has_wildcards() 
    2121           Delete sensors_do_all_sets(), unused 
     22           Pass structures by reference 
    2223  Makefile: Drop the package and version targets 
    2324  Man page sensors.conf.5: Update the chip statement section 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/access.c

    r4648 r4666  
    3434/* Compare two chips name descriptions, to see whether they could match. 
    3535   Return 0 if it does not match, return 1 if it does match. */ 
    36 int sensors_match_chip(sensors_chip_name chip1, sensors_chip_name chip2) 
    37 { 
    38         if ((chip1.prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && 
    39             (chip2.prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && 
    40             strcasecmp(chip1.prefix, chip2.prefix)) 
    41                 return 0; 
    42  
    43         if ((chip1.bus != SENSORS_CHIP_NAME_BUS_ANY) && 
    44             (chip2.bus != SENSORS_CHIP_NAME_BUS_ANY) && 
    45             (chip1.bus != chip2.bus)) { 
    46  
    47                 if ((chip1.bus == SENSORS_CHIP_NAME_BUS_ISA) || 
    48                     (chip2.bus == SENSORS_CHIP_NAME_BUS_ISA)) 
     36int sensors_match_chip(const sensors_chip_name *chip1, 
     37                       const sensors_chip_name *chip2) 
     38{ 
     39        if ((chip1->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && 
     40            (chip2->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && 
     41            strcasecmp(chip1->prefix, chip2->prefix)) 
     42                return 0; 
     43 
     44        if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY) && 
     45            (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY) && 
     46            (chip1->bus != chip2->bus)) { 
     47 
     48                if ((chip1->bus == SENSORS_CHIP_NAME_BUS_ISA) || 
     49                    (chip2->bus == SENSORS_CHIP_NAME_BUS_ISA)) 
    4950                        return 0; 
    5051 
    51                 if ((chip1.bus == SENSORS_CHIP_NAME_BUS_PCI) || 
    52                     (chip2.bus == SENSORS_CHIP_NAME_BUS_PCI)) 
     52                if ((chip1->bus == SENSORS_CHIP_NAME_BUS_PCI) || 
     53                    (chip2->bus == SENSORS_CHIP_NAME_BUS_PCI)) 
    5354                        return 0; 
    5455 
    55                 if ((chip1.bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) && 
    56                     (chip2.bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) 
     56                if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) && 
     57                    (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) 
    5758                        return 0; 
    5859        } 
    5960 
    60         if ((chip1.addr != chip2.addr) && 
    61             (chip1.addr != SENSORS_CHIP_NAME_ADDR_ANY) && 
    62             (chip2.addr != SENSORS_CHIP_NAME_ADDR_ANY)) 
     61        if ((chip1->addr != chip2->addr) && 
     62            (chip1->addr != SENSORS_CHIP_NAME_ADDR_ANY) && 
     63            (chip2->addr != SENSORS_CHIP_NAME_ADDR_ANY)) 
    6364                return 0; 
    6465 
     
    8586                chips = sensors_config_chips[nr].chips; 
    8687                for (i = 0; i < chips.fits_count; i++) { 
    87                         if (sensors_match_chip(chips.fits[i], chip_name)) 
     88                        if (sensors_match_chip(&chips.fits[i], &chip_name)) 
    8889                                return sensors_config_chips + nr; 
    8990                } 
     
    102103 
    103104        for (i = 0; i < sensors_proc_chips_count; i++) 
    104                 if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { 
     105                if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { 
    105106                        features = sensors_proc_chips[i].feature; 
    106107                        for (j = 0; features[j].data.name; j++) 
     
    121122 
    122123        for (i = 0; i < sensors_proc_chips_count; i++) 
    123                 if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { 
     124                if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { 
    124125                        features = sensors_proc_chips[i].feature; 
    125126                        for (j = 0; features[j].data.name; j++) 
     
    148149   This function will return 0 on success, and <0 on failure. 
    149150   If no label exists for this feature, its name is returned itself. */ 
    150 int sensors_get_label(sensors_chip_name name, int feature, char **result) 
     151int sensors_get_label(const sensors_chip_name *name, int feature, char **result) 
    151152{ 
    152153        const sensors_chip *chip; 
     
    157158 
    158159        *result = NULL; 
    159         if (sensors_chip_name_has_wildcards(name)) 
     160        if (sensors_chip_name_has_wildcards(*name)) 
    160161                return -SENSORS_ERR_WILDCARDS; 
    161         if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) 
     162        if (!(featureptr = sensors_lookup_feature_nr(name, feature))) 
    162163                return -SENSORS_ERR_NO_ENTRY; 
    163164 
    164         for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) 
     165        for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));) 
    165166                for (i = 0; i < chip->labels_count; i++) 
    166167                        if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ 
     
    170171 
    171172        /* No user specified label, check for a _label sysfs file */ 
    172         snprintf(path, PATH_MAX, "%s/%s_label", name.busname, 
     173        snprintf(path, PATH_MAX, "%s/%s_label", name->busname, 
    173174                featureptr->data.name); 
    174175         
     
    222223   contain wildcard values! This function will return 0 on success, and <0 
    223224   on failure. */ 
    224 int sensors_get_feature(sensors_chip_name name, int feature, double *result) 
     225int sensors_get_feature(const sensors_chip_name *name, int feature, 
     226                        double *result) 
    225227{ 
    226228        const sensors_chip_feature *main_feature; 
     
    232234        int final_expr = 0; 
    233235 
    234         if (sensors_chip_name_has_wildcards(name)) 
     236        if (sensors_chip_name_has_wildcards(*name)) 
    235237                return -SENSORS_ERR_WILDCARDS; 
    236         if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) 
     238        if (!(main_feature = sensors_lookup_feature_nr(name, feature))) 
    237239                return -SENSORS_ERR_NO_ENTRY; 
    238240        if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) 
    239241                alt_feature = NULL; 
    240         else if (!(alt_feature = sensors_lookup_feature_nr(&name, 
     242        else if (!(alt_feature = sensors_lookup_feature_nr(name, 
    241243                                        main_feature->data.compute_mapping))) 
    242244                return -SENSORS_ERR_NO_ENTRY; 
     
    244246                return -SENSORS_ERR_ACCESS_R; 
    245247        for (chip = NULL; 
    246              !expr && (chip = sensors_for_all_config_chips(name, chip));) 
     248             !expr && (chip = sensors_for_all_config_chips(*name, chip));) 
    247249                for (i = 0; !final_expr && (i < chip->computes_count); i++) { 
    248250                        if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { 
     
    254256                        } 
    255257                } 
    256         if (sensors_read_sysfs_attr(name, feature, &val)) 
     258        if (sensors_read_sysfs_attr(*name, feature, &val)) 
    257259                return -SENSORS_ERR_PROC; 
    258260        if (!expr) 
    259261                *result = val; 
    260         else if ((res = sensors_eval_expr(name, expr, val, result))) 
     262        else if ((res = sensors_eval_expr(*name, expr, val, result))) 
    261263                return res; 
    262264        return 0; 
     
    266268   contain wildcard values! This function will return 0 on success, and <0 
    267269   on failure. */ 
    268 int sensors_set_feature(sensors_chip_name name, int feature, double value) 
     270int sensors_set_feature(const sensors_chip_name *name, int feature, 
     271                        double value) 
    269272{ 
    270273        const sensors_chip_feature *main_feature; 
     
    276279        double to_write; 
    277280 
    278         if (sensors_chip_name_has_wildcards(name)) 
     281        if (sensors_chip_name_has_wildcards(*name)) 
    279282                return -SENSORS_ERR_WILDCARDS; 
    280         if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) 
     283        if (!(main_feature = sensors_lookup_feature_nr(name, feature))) 
    281284                return -SENSORS_ERR_NO_ENTRY; 
    282285        if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) 
    283286                alt_feature = NULL; 
    284         else if (!(alt_feature = sensors_lookup_feature_nr(&name, 
     287        else if (!(alt_feature = sensors_lookup_feature_nr(name, 
    285288                                             main_feature->data.compute_mapping))) 
    286289                return -SENSORS_ERR_NO_ENTRY; 
     
    288291                return -SENSORS_ERR_ACCESS_W; 
    289292        for (chip = NULL; 
    290              !expr && (chip = sensors_for_all_config_chips(name, chip));) 
     293             !expr && (chip = sensors_for_all_config_chips(*name, chip));) 
    291294                for (i = 0; !final_expr && (i < chip->computes_count); i++) 
    292295                        if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { 
     
    300303        to_write = value; 
    301304        if (expr) 
    302                 if ((res = sensors_eval_expr(name, expr, value, &to_write))) 
     305                if ((res = sensors_eval_expr(*name, expr, value, &to_write))) 
    303306                        return res; 
    304         if (sensors_write_sysfs_attr(name, feature, to_write)) 
     307        if (sensors_write_sysfs_attr(*name, feature, to_write)) 
    305308                return -SENSORS_ERR_PROC; 
    306309        return 0; 
     
    333336 
    334337/* nr-1 is the last feature returned */ 
    335 const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, 
     338const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name, 
    336339                                                     int *nr) 
    337340{ 
     
    340343 
    341344        for (i = 0; i < sensors_proc_chips_count; i++) 
    342                 if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { 
     345                if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { 
    343346                        feature_list = sensors_proc_chips[i].feature; 
    344347                        while (feature_list[*nr].data.name 
    345                             && sensors_get_ignored(&name, &feature_list[*nr])) 
     348                            && sensors_get_ignored(name, &feature_list[*nr])) 
    346349                                (*nr)++; 
    347350                        if (!feature_list[*nr].data.name) 
     
    372375                                                            expr->data.var))) 
    373376                        return SENSORS_ERR_NO_ENTRY; 
    374                 if (!(res = sensors_get_feature(chipname, feature->data.number, result))) 
     377                if (!(res = sensors_get_feature(&chipname, feature->data.number, result))) 
    375378                        return res; 
    376379                return 0; 
     
    456459                                continue; 
    457460                        } 
    458                         if ((res = sensors_set_feature(name, feature_nr, value))) { 
     461                        if ((res = sensors_set_feature(&name, feature_nr, value))) { 
    459462                                sensors_parse_error("Failed to set feature", 
    460463                                                chip->sets[i].lineno); 
     
    469472/* Execute all set statements for this particular chip. The chip may contain 
    470473   wildcards!  This function will return 0 on success, and <0 on failure. */ 
    471 int sensors_do_chip_sets(sensors_chip_name name) 
     474int sensors_do_chip_sets(const sensors_chip_name *name) 
    472475{ 
    473476        int nr, this_res; 
     
    476479 
    477480        for (nr = 0; (found_name = sensors_get_detected_chips(&nr));) 
    478                 if (sensors_match_chip(name, *found_name)) { 
     481                if (sensors_match_chip(name, found_name)) { 
    479482                        this_res = sensors_do_this_chip_sets(*found_name); 
    480483                        if (!res) 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/libsensors.3

    r4648 r4666  
    3636.B int sensors_parse_chip_name(const char *orig_name, 
    3737                            \fBsensors_chip_name *res);\fP 
    38 .B int sensors_match_chip(sensors_chip_name chip1,  
    39                        \fBsensors_chip_name chip2);\fP 
     38.B int sensors_match_chip(const sensors_chip_name *chip1, 
     39                       \fBconst sensors_chip_name *chip2);\fP 
    4040.B const char *sensors_get_adapter_name(int bus_nr); 
    41 .B int sensors_get_label(sensors_chip_name name, int feature,  
     41.B int sensors_get_label(const sensors_chip_name *name, int feature, 
    4242                      \fBchar **result);\fP 
    43 .B int sensors_get_feature(sensors_chip_name name, int feature, 
     43.B int sensors_get_feature(const sensors_chip_name *name, int feature, 
    4444                        \fBdouble *result);\fP 
    45 .B int sensors_set_feature(sensors_chip_name name, int feature, 
     45.B int sensors_set_feature(const sensors_chip_name *name, int feature, 
    4646                        \fBdouble value);\fP 
    47 .B int sensors_do_chip_sets(sensors_chip_name name); 
     47.B int sensors_do_chip_sets(const sensors_chip_name *name); 
    4848.B const sensors_chip_name *sensors_get_detected_chips(int *nr); 
    4949.B const sensors_feature_data *sensors_get_all_features  
    50              \fB(sensors_chip_name name, int *nr);\fP 
     50             \fB(const sensors_chip_name *name, int *nr);\fP 
    5151.B const char *libsensors_version; 
    5252.fi 
     
    6666Parse a chip name to the internal representation. Return 0 on succes, <0 on error. 
    6767 
    68 \fBint sensors_match_chip(sensors_chip_name chip1, 
    69                        sensors_chip_name chip2);\fP 
     68\fBint sensors_match_chip(const sensors_chip_name *chip1, 
     69                       const sensors_chip_name *chip2);\fP 
    7070.br 
    7171Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. 
     
    7676sensors_chip_name structure. If it could not be found, it returns NULL. 
    7777 
    78 \fBint sensors_get_label(sensors_chip_name name, int feature, 
     78\fBint sensors_get_label(const sensors_chip_name *name, int feature, 
    7979                      char **result);\fP 
    8080.br 
    8181Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. 
    8282 
    83 \fBint sensors_get_feature(sensors_chip_name name, 
     83\fBint sensors_get_feature(const sensors_chip_name *name, 
    8484                        int feature, double *result);\fP 
    8585.br 
    8686Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. 
    8787 
    88 \fBint sensors_set_feature(sensors_chip_name name, 
     88\fBint sensors_set_feature(const sensors_chip_name *name, 
    8989                        int feature, double value);\fP 
    9090.br 
    9191Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. 
    9292 
    93 .B int sensors_do_chip_sets(sensors_chip_name name); 
     93.B int sensors_do_chip_sets(const sensors_chip_name *name); 
    9494.br 
    9595Execute all set statements for this particular chip. The chip may contain wildcards!  This function will return 0 on success, and <0 on failure. 
     
    123123 
    124124\fBconst sensors_feature_data *sensors_get_all_features 
    125       (sensors_chip_name name, int *nr);\fP 
     125      (const sensors_chip_name *name, int *nr);\fP 
    126126.br 
    127127This returns all features of a specific chip. They are returned in bunches: 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h

    r4648 r4666  
    6464/* Compare two chips name descriptions, to see whether they could match. 
    6565   Return 0 if it does not match, return 1 if it does match. */ 
    66 extern int sensors_match_chip(sensors_chip_name chip1,  
    67                               sensors_chip_name chip2); 
     66extern int sensors_match_chip(const sensors_chip_name *chip1, 
     67                              const sensors_chip_name *chip2); 
    6868 
    6969/* This function returns the adapter name of a bus number, 
     
    7676   This function will return 0 on success, and <0 on failure.  This 
    7777   function takes logical mappings into account. */ 
    78 extern int sensors_get_label(sensors_chip_name name, int feature,  
     78extern int sensors_get_label(const sensors_chip_name *name, int feature, 
    7979                             char **result); 
    8080 
     
    8282   contain wildcard values! This function will return 0 on success, and <0 
    8383   on failure.  */ 
    84 extern int sensors_get_feature(sensors_chip_name name, int feature, 
     84extern int sensors_get_feature(const sensors_chip_name *name, int feature, 
    8585                               double *result); 
    8686 
     
    8888   contain wildcard values! This function will return 0 on success, and <0 
    8989   on failure. */ 
    90 extern int sensors_set_feature(sensors_chip_name name, int feature, 
     90extern int sensors_set_feature(const sensors_chip_name *name, int feature, 
    9191                               double value); 
    9292 
    9393/* Execute all set statements for this particular chip. The chip may contain 
    9494   wildcards!  This function will return 0 on success, and <0 on failure. */ 
    95 extern int sensors_do_chip_sets(sensors_chip_name name); 
     95extern int sensors_do_chip_sets(const sensors_chip_name *name); 
    9696 
    9797/* This function returns all detected chips, one by one. To start at the 
     
    172172   data structures. */ 
    173173extern const sensors_feature_data *sensors_get_all_features 
    174              (sensors_chip_name name, int *nr); 
     174             (const sensors_chip_name *name, int *nr); 
    175175 
    176176#ifdef __cplusplus 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensord/rrd.c

    r4157 r4666  
    142142  while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { 
    143143    for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { 
    144       if (sensors_match_chip (*chip, chipNames[j])) { 
     144      if (sensors_match_chip (chip, &chipNames[j])) { 
    145145        int index0, subindex, chipindex = -1; 
    146146        for (index0 = 0; knownChips[index0]; ++ index0) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensord/sense.c

    r4098 r4666  
    5050(sensors_chip_name name, int feature, char **label) { 
    5151  int err; 
    52   err = sensors_get_label (name, feature, label); 
     52  err = sensors_get_label (&name, feature, label); 
    5353  return err; 
    5454} 
     
    6060  int nr1 = 0, nr2 = 0, err = 0; 
    6161  do { 
    62     rawFeature = sensors_get_all_features (name, &nr1, &nr2); 
     62    rawFeature = sensors_get_all_features (&name, &nr1, &nr2); 
    6363  } while (rawFeature && (rawFeature->number != feature)); 
    6464  /* TODO: Ensure labels match RRD construct and are not repeated! */ 
     
    106106  ret = idChip (chip); 
    107107 
    108   while ((ret == 0) && ((sensor = sensors_get_all_features (*chip, &index0, &index1)) != NULL)) { 
     108  while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) { 
    109109    char *label = NULL; 
    110110    int valid = 0; 
     
    121121    } else if (!(sensor->mode & SENSORS_MODE_R)) { 
    122122      sensorLog (LOG_INFO, "%s: %s", sensor->name, label); 
    123     } else if ((ret = sensors_get_feature (*chip, sensor->number, &value))) { 
     123    } else if ((ret = sensors_get_feature (chip, sensor->number, &value))) { 
    124124      sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret)); 
    125125      ret = 22; 
     
    146146    ret = idChip (chip); 
    147147  if (!ret && descriptor->alarmNumber) { 
    148     if ((ret = sensors_get_feature (*chip, descriptor->alarmNumber, &tmp))) { 
     148    if ((ret = sensors_get_feature (chip, descriptor->alarmNumber, &tmp))) { 
    149149      sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->alarmNumber, sensors_strerror (ret)); 
    150150      ret = 20; 
     
    154154  } 
    155155  if (!ret && descriptor->beepNumber) { 
    156     if ((ret = sensors_get_feature (*chip, descriptor->beepNumber, &tmp))) { 
     156    if ((ret = sensors_get_feature (chip, descriptor->beepNumber, &tmp))) { 
    157157      sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->beepNumber, sensors_strerror (ret)); 
    158158      ret = 21; 
     
    181181 
    182182      for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) { 
    183         if ((ret = sensors_get_feature (*chip, feature->dataNumbers[subindex], values + subindex))) { 
     183        if ((ret = sensors_get_feature (chip, feature->dataNumbers[subindex], values + subindex))) { 
    184184          sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->dataNumbers[subindex], sensors_strerror (ret)); 
    185185          ret = 23; 
     
    216216  if ((ret = idChip (chip))) { 
    217217    sensorLog (LOG_ERR, "Error identifying chip: %s", chip->prefix); 
    218   } else if ((ret = sensors_do_chip_sets (*chip))) { 
     218  } else if ((ret = sensors_do_chip_sets (chip))) { 
    219219    sensorLog (LOG_ERR, "Error performing chip sets: %s: %s", chip->prefix, sensors_strerror (ret)); 
    220220    ret = 50; 
     
    253253  while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { 
    254254    for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { 
    255       if (sensors_match_chip (*chip, chipNames[j])) { 
     255      if (sensors_match_chip (chip, &chipNames[j])) { 
    256256        ret = doChip (chip, action); 
    257257      } 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips.c

    r4645 r4666  
    9292  double vid; 
    9393 
    94   if (!sensors_get_label(*name, f_vid, &label) 
    95       && !sensors_get_feature(*name,f_vid,&vid) ) { 
     94  if (!sensors_get_label(name, f_vid, &label) 
     95      && !sensors_get_feature(name, f_vid, &vid)) { 
    9696    print_label(label, label_size); 
    9797    printf("%+6.3f V\n", vid); 
     
    108108  
    109109  a = 0; 
    110   while((data=sensors_get_all_features(*name, &a))) { 
    111     if (sensors_get_label(*name, data->number, &label)) { 
     110  while((data=sensors_get_all_features(name, &a))) { 
     111    if (sensors_get_label(name, data->number, &label)) { 
    112112      printf("ERROR: Can't get feature `%s' data!\n",data->name); 
    113113      continue; 
    114114    } 
    115115    if (data->mode & SENSORS_MODE_R) { 
    116       if(sensors_get_feature(*name,data->number,&val)) { 
     116      if(sensors_get_feature(name, data->number, &val)) { 
    117117        printf("ERROR: Can't get feature `%s' data!\n",data->name); 
    118118        continue; 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips_generic.c

    r4645 r4666  
    3131                             double *val) 
    3232{ 
    33   return sensors_get_feature(*name, feature->number, val); 
     33  return sensors_get_feature(name, feature->number, val); 
    3434} 
    3535 
     
    4444  const sensors_feature_data *iter; 
    4545   
    46   while((iter = sensors_get_all_features(*name, &i)) && 
     46  while((iter = sensors_get_all_features(name, &i)) && 
    4747      iter->mapping == feature->number) { 
    4848    int indx; 
     
    6969 
    7070  i = 0; 
    71   while((iter = sensors_get_all_features(*name, &i))) { 
    72     if (!sensors_get_label(*name, iter->number, &label) && 
     71  while((iter = sensors_get_all_features(name, &i))) { 
     72    if (!sensors_get_label(name, iter->number, &label) && 
    7373        strlen(label) > max_size) 
    7474      max_size = strlen(label); 
     
    9999  double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; 
    100100   
    101   if (sensors_get_label(*name, feature->number, &label)) { 
     101  if (sensors_get_label(name, feature->number, &label)) { 
    102102    free(label); 
    103103    printf("ERROR: Can't get temperature label!\n"); 
     
    213213  char *label; 
    214214   
    215   if (sensors_get_label(*name, feature->number, &label)) { 
     215  if (sensors_get_label(name, feature->number, &label)) { 
    216216    free(label); 
    217217    printf("ERROR: Can't get in label!\n"); 
     
    276276  double val; 
    277277   
    278   if (sensors_get_label(*name, feature->number, &label)) { 
     278  if (sensors_get_label(name, feature->number, &label)) { 
    279279    printf("ERROR: Can't get fan label!\n"); 
    280280    free(label); 
     
    327327   
    328328  i = 0; 
    329   while((feature = sensors_get_all_features(*name, &i))) { 
     329  while((feature = sensors_get_all_features(name, &i))) { 
    330330    if (feature->mapping != SENSORS_NO_MAPPING) 
    331331      continue; 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/main.c

    r4602 r4666  
    260260  for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) 
    261261    for(i = 0; i < chips_count; i++) 
    262       if (sensors_match_chip(*chip,chips[i])) { 
     262      if (sensors_match_chip(chip, &chips[i])) { 
    263263        if(do_sets) { 
    264264          if (do_a_set(*chip)) 
     
    277277  int res; 
    278278 
    279   if ((res = sensors_do_chip_sets(name))) { 
     279  if ((res = sensors_do_chip_sets(&name))) { 
    280280    if (res == -SENSORS_ERR_PROC) { 
    281281      fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name),