]>
Commit | Line | Data |
---|---|---|
a6316ce4 MT |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include <string.h> | |
4 | #include <unistd.h> | |
5 | #include <fcntl.h> | |
6 | #include <dirent.h> | |
7 | #include <sys/stat.h> | |
8 | #include <sys/types.h> | |
9 | ||
10 | #include "hd.h" | |
11 | #include "hd_int.h" | |
12 | #include "veth.h" | |
13 | ||
14 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
15 | * iSeries veth devices | |
16 | * | |
17 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
18 | */ | |
19 | ||
20 | #if defined(__PPC__) | |
21 | ||
22 | void hd_scan_veth(hd_data_t *hd_data) | |
23 | { | |
24 | unsigned u; | |
25 | hd_t *hd; | |
26 | DIR *dir; | |
27 | struct dirent *de; | |
28 | ||
29 | if(!hd_probe_feature(hd_data, pr_veth)) return; | |
30 | ||
31 | hd_data->module = mod_veth; | |
32 | ||
33 | /* some clean-up */ | |
34 | remove_hd_entries(hd_data); | |
35 | ||
36 | PROGRESS(1, 0, "read data"); | |
37 | ||
38 | if((dir = opendir(PROC_ISERIES_VETH))) { | |
39 | while((de = readdir(dir))) { | |
40 | if(sscanf(de->d_name, "veth%u", &u) == 1) { | |
41 | hd = add_hd_entry(hd_data, __LINE__, 0); | |
42 | hd->base_class.id = bc_network; | |
43 | hd->slot = u; | |
44 | hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6001); // IBM | |
45 | hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1000); | |
46 | str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot); | |
47 | } | |
48 | } | |
49 | closedir(dir); | |
50 | return; | |
51 | } | |
52 | if((dir = opendir(PROC_ISERIES))) { | |
53 | hd = add_hd_entry(hd_data, __LINE__, 0); | |
54 | hd->base_class.id = bc_network; | |
55 | hd->slot = 0; | |
56 | hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6001); // IBM | |
57 | hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1000); | |
58 | str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot); | |
59 | } | |
60 | ||
61 | } | |
62 | ||
63 | #endif /* __PPC__ */ |