~ubuntu-branches/ubuntu/edgy/hwinfo/edgy

« back to all changes in this revision

Viewing changes to src/hd/veth.c

  • Committer: Bazaar Package Importer
  • Author(s): James Vega
  • Date: 2006-09-28 20:56:06 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060928205606-bgxl69hts04xbx51
Tags: 13.4-1
* New upstream version.
* Switch from dbs to quilt
  - Revamp debian/rules
  - Add quilt and remove dbs from Build-Depends in debian/control
* Remove reference to hwscan(8) from manpage. (closes: #388245)
* Re-wrote manpage from scratch.  Drop docbook-to-man from Build-Depends.
* Remove NEWS.Debian since it is no longer applicable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * @defgroup VETHint iSeries veth devices
 
16
 * @ingroup libhdDEVint
 
17
 * @brief iSeries veth device functions
 
18
 *
 
19
 * @{
 
20
 */
 
21
 
 
22
#if defined(__PPC__)
 
23
 
 
24
void hd_scan_veth(hd_data_t *hd_data)
 
25
{
 
26
  unsigned u;
 
27
  hd_t *hd;
 
28
  DIR *dir;
 
29
  struct dirent *de;
 
30
 
 
31
  if(!hd_probe_feature(hd_data, pr_veth)) return;
 
32
 
 
33
  hd_data->module = mod_veth;
 
34
 
 
35
  /* some clean-up */
 
36
  remove_hd_entries(hd_data);
 
37
 
 
38
  PROGRESS(1, 0, "read data");
 
39
 
 
40
  if((dir = opendir(PROC_ISERIES_VETH))) {
 
41
    while((de = readdir(dir))) {
 
42
      if(sscanf(de->d_name, "veth%u", &u) == 1) {
 
43
        hd = add_hd_entry(hd_data, __LINE__, 0);
 
44
        hd->base_class.id = bc_network;
 
45
        hd->slot = u;
 
46
        hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6001);   // IBM
 
47
        hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1000);
 
48
        str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot);
 
49
      }
 
50
    }
 
51
    closedir(dir);
 
52
    return;
 
53
  }
 
54
  if((dir = opendir(PROC_ISERIES))) {
 
55
    hd = add_hd_entry(hd_data, __LINE__, 0);
 
56
    hd->base_class.id = bc_network;
 
57
    hd->slot = 0;
 
58
    hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6001);       // IBM
 
59
    hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1000);
 
60
    str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot);
 
61
  }
 
62
 
 
63
}
 
64
 
 
65
#endif  /* __PPC__ */
 
66
 
 
67
/** @} */
 
68