ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.21 by ats, Sat Jan 10 15:28:03 2004 UTC vs.
Revision 1.22 by pajs, Thu Jan 15 22:21:37 2004 UTC

# Line 187 | Line 187 | int get_alias(char *alias){
187          return 0;
188   }
189  
190 +
191 + #define BIG_ENOUGH 512
192   int build_mapping(){
193 <        char device_name[512];
193 >        char device_name[BIG_ENOUGH];
194          int x;
195          kstat_ctl_t *kc;
196          kstat_t *ksp;
197          kstat_io_t kios;
198  
199 +        char driver_list[BIG_ENOUGH][BIG_ENOUGH];
200 +        int list_entries = 0;
201 +        int found;
202 +
203          if ((kc = kstat_open()) == NULL) {
204                  return;
205          }
# Line 210 | Line 216 | int build_mapping(){
216                          }
217                          if(x == sizeof device_name) x--;
218                          device_name[x] = '\0';
219 <                        if((get_alias(device_name)) != 0){
220 <                                return 1;
219 >
220 >                        /* Check if we've not already looked it up */
221 >                        found = 0;
222 >                        for(x=0;x<list_entries;x++){
223 >                                if (x>=BIG_ENOUGH){
224 >                                        /* We've got bigger than we thought was massive */
225 >                                        /* If we hit this.. Make big enough bigger */
226 >                                        return 1;
227 >                                }
228 >                                if( !strncmp(driver_list[x], device_name, BIG_ENOUGH)){
229 >                                        found = 1;
230 >                                        break;
231 >                                }
232 >                        }
233 >
234 >                        if(!found){
235 >                                if((get_alias(device_name)) != 0){
236 >                                        return 1;
237 >                                }
238 >                                strncpy(driver_list[x], device_name, BIG_ENOUGH);
239 >                                list_entries++;
240                          }
241                  }
242          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines