Changeset 5646

Show
Ignore:
Timestamp:
02/15/09 18:19:03 (4 years ago)
Author:
khali
Message:

Make it possible to only substitute the bus number of a subset of the
chip entries. This is a prerequisite to add support for multiple
configuration files. Each configuration file can come with its own bus
statements and the bus number substitution should only affect chip
entries from the same configuration file.

Location:
lm-sensors/trunk/lib
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/lib/data.c

    r5593 r5646  
    22    data.c - Part of libsensors, a Linux library for reading sensor data. 
    33    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl> 
    4     Copyright (C) 2007        Jean Delvare <khali@linux-fr.org> 
     4    Copyright (C) 2007, 2009  Jean Delvare <khali@linux-fr.org> 
    55 
    66    This program is free software; you can redistribute it and/or modify 
     
    3636sensors_chip *sensors_config_chips = NULL; 
    3737int sensors_config_chips_count = 0; 
     38int sensors_config_chips_subst = 0; 
    3839int sensors_config_chips_max = 0; 
    3940 
     
    227228} 
    228229 
     230/* Bus substitution is on a per-configuration file basis, so we keep 
     231   memory (in sensors_config_chips_subst) of which chip entries have been 
     232   already substituted. */ 
    229233int sensors_substitute_busses(void) 
    230234{ 
     
    233237        int res = 0; 
    234238 
    235         for (i = 0; i < sensors_config_chips_count; i++) { 
     239        for (i = sensors_config_chips_subst; 
     240             i < sensors_config_chips_count; i++) { 
    236241                lineno = sensors_config_chips[i].lineno; 
    237242                chips = &sensors_config_chips[i].chips; 
     
    247252                } 
    248253        } 
     254        sensors_config_chips_subst = sensors_config_chips_count; 
    249255        return res; 
    250256} 
  • lm-sensors/trunk/lib/data.h

    r5642 r5646  
    22    data.h - Part of libsensors, a Linux library for reading sensor data. 
    33    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl> 
    4     Copyright (C) 2007        Jean Delvare <khali@linux-fr.org> 
     4    Copyright (C) 2007, 2009  Jean Delvare <khali@linux-fr.org> 
    55 
    66    This program is free software; you can redistribute it and/or modify 
     
    136136extern sensors_chip *sensors_config_chips; 
    137137extern int sensors_config_chips_count; 
     138extern int sensors_config_chips_subst; 
    138139extern int sensors_config_chips_max; 
    139140 
  • lm-sensors/trunk/lib/init.c

    r5645 r5646  
    241241        sensors_config_chips = NULL; 
    242242        sensors_config_chips_count = sensors_config_chips_max = 0; 
     243        sensors_config_chips_subst = 0; 
    243244 
    244245        for (i = 0; i < sensors_proc_bus_count; i++)