- char bus_dev_name[SYSFS_PATH_MAX];
- char bus_id[SYSFS_NAME_LEN];
- struct stat stat_buf;
- ino_t dev_inode;
-
- dprintf("%s\n", sysfs_path);
-
- if (sysfs_get_name_from_path(sysfs_path, bus_id, SYSFS_NAME_LEN))
- return -1;
-
- snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path,
- SYSFS_BUS_NAME, bus, SYSFS_DEVICES_NAME, bus_id);
-
- if (stat(sysfs_path, &stat_buf))
- return -1;
- dev_inode = stat_buf.st_ino;
-
- if (stat(bus_dev_name, &stat_buf)) {
- if (errno == ENOENT)
- return 0;
- else
- return -1;
+ int type_num;
+ char *eptr;
+ char *type = "generic";
+
+ type_num = strtoul(from, &eptr, 0);
+ if (eptr != from) {
+ switch (type_num) {
+ case 0:
+ type = "disk";
+ break;
+ case 1:
+ type = "tape";
+ break;
+ case 4:
+ type = "optical";
+ break;
+ case 5:
+ type = "cd";
+ break;
+ case 7:
+ type = "optical";
+ break;
+ case 0xe:
+ type = "disk";
+ break;
+ case 0xf:
+ type = "optical";
+ break;
+ default:
+ break;
+ }