Changeset 4830 for lm-sensors/branches/lm-sensors-3.0.0/lib/access.c
- Timestamp:
- 09/23/07 13:59:51 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/lib/access.c
r4796 r4830 90 90 Do not modify the struct the return value points to! Returns NULL if 91 91 not found.*/ 92 const sensors_ chip_feature*sensors_lookup_feature_nr(const sensors_chip_name *chip,92 const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip, 93 93 int feature) 94 94 { … … 108 108 Do not modify the struct the return value points to! Returns NULL if 109 109 not found.*/ 110 static const sensors_ chip_feature*110 static const sensors_feature_data * 111 111 sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) 112 112 { 113 113 int i, j; 114 const sensors_ chip_feature*features;114 const sensors_feature_data *features; 115 115 116 116 for (i = 0; i < sensors_proc_chips_count; i++) … … 118 118 features = sensors_proc_chips[i].feature; 119 119 for (j = 0; j < sensors_proc_chips[i].feature_count; j++) 120 if (!strcmp(features[j]. data.name, feature))120 if (!strcmp(features[j].name, feature)) 121 121 return features + j; 122 122 } … … 146 146 char *label; 147 147 const sensors_chip *chip; 148 const sensors_ chip_feature*featureptr;148 const sensors_feature_data *featureptr; 149 149 char buf[128], path[PATH_MAX]; 150 150 FILE *f; … … 158 158 for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) 159 159 for (i = 0; i < chip->labels_count; i++) 160 if (!strcmp(featureptr-> data.name, chip->labels[i].name)) {160 if (!strcmp(featureptr->name, chip->labels[i].name)) { 161 161 label = strdup(chip->labels[i].value); 162 162 goto sensors_get_label_exit; … … 165 165 /* No user specified label, check for a _label sysfs file */ 166 166 snprintf(path, PATH_MAX, "%s/%s_label", name->path, 167 featureptr-> data.name);167 featureptr->name); 168 168 169 169 if ((f = fopen(path, "r"))) { … … 179 179 180 180 /* No label, return the feature name instead */ 181 label = strdup(featureptr-> data.name);181 label = strdup(featureptr->name); 182 182 183 183 sensors_get_label_exit: … … 192 192 mappings into account. */ 193 193 static int sensors_get_ignored(const sensors_chip_name *name, 194 const sensors_ chip_feature*feature)194 const sensors_feature_data *feature) 195 195 { 196 196 const sensors_chip *chip; … … 198 198 int i; 199 199 200 if (feature-> data.mapping == SENSORS_NO_MAPPING)200 if (feature->mapping == SENSORS_NO_MAPPING) 201 201 main_feature_name = NULL; 202 202 else 203 203 main_feature_name = sensors_lookup_feature_nr(name, 204 feature-> data.mapping)->data.name;204 feature->mapping)->name; 205 205 206 206 for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) 207 207 for (i = 0; i < chip->ignores_count; i++) 208 if (!strcmp(feature-> data.name, chip->ignores[i].name) ||208 if (!strcmp(feature->name, chip->ignores[i].name) || 209 209 (main_feature_name && 210 210 !strcmp(main_feature_name, chip->ignores[i].name))) … … 219 219 double *result) 220 220 { 221 const sensors_ chip_feature*main_feature;222 const sensors_ chip_feature*alt_feature;221 const sensors_feature_data *main_feature; 222 const sensors_feature_data *alt_feature; 223 223 const sensors_chip *chip; 224 224 const sensors_expr *expr = NULL; … … 232 232 return -SENSORS_ERR_NO_ENTRY; 233 233 234 if (main_feature-> data.flags & SENSORS_COMPUTE_MAPPING)234 if (main_feature->flags & SENSORS_COMPUTE_MAPPING) 235 235 alt_feature = sensors_lookup_feature_nr(name, 236 main_feature-> data.mapping);236 main_feature->mapping); 237 237 else 238 238 alt_feature = NULL; 239 239 240 if (!(main_feature-> data.flags & SENSORS_MODE_R))240 if (!(main_feature->flags & SENSORS_MODE_R)) 241 241 return -SENSORS_ERR_ACCESS_R; 242 242 for (chip = NULL; 243 243 !expr && (chip = sensors_for_all_config_chips(name, chip));) 244 244 for (i = 0; !final_expr && (i < chip->computes_count); i++) { 245 if (!strcmp(main_feature-> data.name, chip->computes[i].name)) {245 if (!strcmp(main_feature->name, chip->computes[i].name)) { 246 246 expr = chip->computes[i].from_proc; 247 247 final_expr = 1; 248 } else if (alt_feature && !strcmp(alt_feature-> data.name,248 } else if (alt_feature && !strcmp(alt_feature->name, 249 249 chip->computes[i].name)) { 250 250 expr = chip->computes[i].from_proc; … … 266 266 double value) 267 267 { 268 const sensors_ chip_feature*main_feature;269 const sensors_ chip_feature*alt_feature;268 const sensors_feature_data *main_feature; 269 const sensors_feature_data *alt_feature; 270 270 const sensors_chip *chip; 271 271 const sensors_expr *expr = NULL; … … 279 279 return -SENSORS_ERR_NO_ENTRY; 280 280 281 if (main_feature-> data.flags & SENSORS_COMPUTE_MAPPING)281 if (main_feature->flags & SENSORS_COMPUTE_MAPPING) 282 282 alt_feature = sensors_lookup_feature_nr(name, 283 main_feature-> data.mapping);283 main_feature->mapping); 284 284 else 285 285 alt_feature = NULL; 286 286 287 if (!(main_feature-> data.flags & SENSORS_MODE_W))287 if (!(main_feature->flags & SENSORS_MODE_W)) 288 288 return -SENSORS_ERR_ACCESS_W; 289 289 for (chip = NULL; 290 290 !expr && (chip = sensors_for_all_config_chips(name, chip));) 291 291 for (i = 0; !final_expr && (i < chip->computes_count); i++) 292 if (!strcmp(main_feature-> data.name, chip->computes[i].name)) {292 if (!strcmp(main_feature->name, chip->computes[i].name)) { 293 293 expr = chip->computes->to_proc; 294 294 final_expr = 1; 295 } else if (alt_feature && !strcmp(alt_feature-> data.name,295 } else if (alt_feature && !strcmp(alt_feature->name, 296 296 chip->computes[i].name)) { 297 297 expr = chip->computes[i].to_proc; … … 348 348 int *nr) 349 349 { 350 sensors_ chip_feature*feature_list;350 sensors_feature_data *feature_list; 351 351 int i; 352 352 … … 359 359 if (*nr == sensors_proc_chips[i].feature_count) 360 360 return NULL; 361 return &feature_list[(*nr)++] .data;361 return &feature_list[(*nr)++]; 362 362 } 363 363 return NULL; … … 371 371 double res1, res2; 372 372 int res; 373 const sensors_ chip_feature*feature;373 const sensors_feature_data *feature; 374 374 375 375 if (expr->kind == sensors_kind_val) { … … 385 385 expr->data.var))) 386 386 return SENSORS_ERR_NO_ENTRY; 387 if (!(res = sensors_get_value(name, feature-> data.number, result)))387 if (!(res = sensors_get_value(name, feature->number, result))) 388 388 return res; 389 389 return 0; … … 433 433 int i, j; 434 434 int err = 0, res; 435 const sensors_ chip_feature*feature;435 const sensors_feature_data *feature; 436 436 int *feature_list = NULL; 437 437 int feature_count = 0; … … 449 449 continue; 450 450 } 451 feature_nr = feature-> data.number;451 feature_nr = feature->number; 452 452 453 453 /* Check whether we already set this feature */
