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 |
|
} |
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 |
|
} |