- rc = volume_id_probe(vid, ALL);
- if (rc != 0) {
- printf("error probing volume\n");
- exit(1);
+ if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0)
+ size = 0;
+
+ if (volume_id_probe_all(vid, 0, size) == 0)
+ goto print;
+
+ if (volume_id_probe_dasd(vid) == 0)
+ goto print;
+
+ printf("unknown volume type\n");
+ goto exit;
+
+
+print:
+ len = strnlen(vid->label, VOLUME_ID_LABEL_SIZE);
+
+ /* remove trailing spaces */
+ while (len > 0 && isspace(vid->label[len-1]))
+ len--;
+ name[len] = '\0';
+
+ /* substitute chars */
+ i = 0;
+ j = 0;
+ while (j < len) {
+ switch(vid->label[j]) {
+ case '/' :
+ break;
+ case ' ' :
+ name[i++] = '_';
+ break;
+ default :
+ name[i++] = vid->label[j];
+ }
+ j++;