~ubuntu-branches/ubuntu/wily/hwinfo/wily

« back to all changes in this revision

Viewing changes to src/hd/s390.c

  • Committer: Bazaar Package Importer
  • Author(s): William Vera
  • Date: 2009-06-08 22:18:36 UTC
  • mfrom: (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090608221836-1ss2hutt4xhq414c
Tags: 16.0-1
* New upstream release
* Renamed libhd15 to libhd16 according to new soname.
* Updated the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
    
173
173
    if(res->io.range > 1) {
174
174
      sprintf(attrname, "/sys/bus/" BUSNAME "/devices/%s/group_device", curdev->d_name);
 
175
      //fprintf(stderr,"trying %s\n",attrname);
175
176
      memset(linkname,0,128);
176
177
      if(readlink(attrname, linkname, 127) == -1) {
177
178
        sprintf(attrname, "/sys/bus/" BUSNAME "/devices/%s", curdev->d_name);
178
 
        linkstrip = 6;
179
 
      } else linkstrip = 9;
 
179
        //fprintf(stderr,"not read link -> %s (+6)\n",attrname);
 
180
        linkstrip = 6;
 
181
      } else {
 
182
        sprintf(attrname, "/sys/devices/%s", linkname + 9);
 
183
        //fprintf(stderr,"read link, setting to %s\n",attrname);
 
184
        linkstrip = 6;
 
185
      }
180
186
    } else {
181
187
      linkstrip = 6;
182
188
      sprintf(attrname, "/sys/bus/" BUSNAME "/devices/%s", curdev->d_name);
 
189
      //fprintf(stderr,"no group dev -> %s (+6)\n",attrname);
183
190
    }
184
191
 
185
192
    hd=add_hd_entry(hd_data,__LINE__,0);
193
200
       is consistent with earlier versions of this code. in the grouped device case it is necessary to obtain a sysfs id that
194
201
       is consistent with net.c which resolves /sys/class/net/<ifname>/device. */
195
202
    memset(linkname, 0, 128);
196
 
    if(readlink(attrname,linkname,127) == -1)
 
203
    if(readlink(attrname,linkname,127) == -1) {
 
204
      //fprintf(stderr,"eins %s\n",attrname);
197
205
      hd->sysfs_device_link = new_str(hd_sysfs_id(attrname));
198
 
    else
 
206
    }
 
207
    else {
 
208
      //fprintf(stderr,"zwei %s, %s\n",linkname,linkname+linkstrip);
199
209
      hd->sysfs_device_link = new_str(hd_sysfs_id(linkname+linkstrip));
 
210
    }
200
211
    
201
212
    hd->sysfs_id = new_str(hd->sysfs_device_link);
202
213
    hd->sysfs_bus_id = new_str(curdev->d_name);
218
229
    hd->detail->ccw.data->cu_model=cumod;
219
230
    hd->detail->ccw.data->dev_model=devmod;
220
231
    hd->detail->ccw.data->lcss=(strtol(curdev->d_name,0,16) << 8) + strtol(curdev->d_name+2,0,16);
 
232
 
 
233
    /* OSA Express devices with more than one port are not detectable, so we
 
234
       have to set dualport for all OSA Express network interfaces */
 
235
    if(cutype == 0x1731 && cumod == 1) hd->is.dualport = 1;
 
236
 
221
237
    hddb_add_info(hd_data,hd);
222
238
  }
223
239
  closedir(bus);
256
272
            hd->sysfs_device_link = new_str(hd_sysfs_id(attrname));
257
273
            hd->sysfs_id = new_str(hd->sysfs_device_link);
258
274
            hd->sysfs_bus_id = new_str(strrchr(attrname,'/')+1);
 
275
            
 
276
            /* try to determine the network IF name */
 
277
            strcat(attrname, "/net");
 
278
            DIR* netdevdir = opendir(attrname);
 
279
            if(netdevdir) {
 
280
              struct dirent* nd;
 
281
              while((nd = readdir(netdevdir))) {
 
282
                if(nd->d_name[0] == '.') continue;
 
283
                hd->unix_dev_name = new_str(nd->d_name);
 
284
                break;
 
285
              }
 
286
              closedir(netdevdir);
 
287
            }
259
288
            hddb_add_info(hd_data,hd);
260
289
          }
261
290
          closedir(bus);