Print this page
4846 HAL partition names don't match real partition names

@@ -2,10 +2,11 @@
  *
  * devinfo_storage.c : storage devices
  *
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2013 Garrett D'Amore <garrett@damore.org>
+ * Copyright 2014 Andrew Stormont.
  *
  * Licensed under the Academic Free License version 2.1
  *
  **************************************************************************/
 

@@ -700,15 +701,15 @@
         /* add volumes: one on main device and a few pcfs candidates */
         m = devinfo_storage_new_minor(minor_path, WHOLE_DISK, devlink, dev, -1);
         devinfo_volume_add (d, node, m);
         devinfo_storage_free_minor (m);
 
-        doslink = (char *)calloc (1, strlen (devlink) + sizeof (":NNN") + 1);
+        doslink = (char *)calloc (1, strlen (devlink) + sizeof ("pNN") + 1);
         if (doslink != NULL) {
                 for (i = 1; i < 16; i++) {
-                        snprintf(dospath, sizeof (dospath), WHOLE_DISK":%d", i);
-                        sprintf(doslink, "%s:%d", devlink, i);
+                        snprintf(dospath, sizeof (dospath), "p%d", i);
+                        sprintf(doslink, "%sp%d", devlink, i);
                         m = devinfo_storage_new_minor(minor_path, dospath, doslink, dev, i);
                         devinfo_volume_add (d, node, m);
                         devinfo_storage_free_minor (m);
                 }
                 free (doslink);

@@ -857,18 +858,10 @@
                         free (devlink);
                         di_devfs_path_free (minor_path);
                         continue;
                 }
 
-                /* ignore p1..N - we'll use p0:N instead */
-                if ((strlen (slice) > 1) && (slice[0] == 'p') && isdigit(slice[1]) &&
-                    ((atol(&slice[1])) > 0)) {
-                        free (devlink);
-                        di_devfs_path_free (minor_path);
-                        continue;
-                }
-
                 m = devinfo_storage_new_minor(minor_path, slice, devlink, dev, -1);
                 if (m == NULL) {
                         free (devlink);
                         di_devfs_path_free (minor_path);
                         continue;

@@ -913,15 +906,15 @@
                 devinfo_add_enqueue (parent, maindev_path, &devinfo_storage_handler);
         }
 
         /* add virtual dos volumes to enable pcfs probing */
         if (!is_cdrom) {
-                doslink_len = strlen (maindev->devlink) + sizeof (":NNN") + 1;
+                doslink_len = strlen (maindev->devlink) + sizeof ("pNN") + 1;
                 if ((doslink = (char *)calloc (1, doslink_len)) != NULL) {
                         for (i = 1; i < 16; i++) {
-                                snprintf(dospath, sizeof (dospath), "%s:%d", maindev->slice, i);
-                                snprintf(doslink, doslink_len, "%s:%d", maindev->devlink, i);
+                                snprintf(dospath, sizeof (dospath), "%sp%d", maindev->slice, i);
+                                snprintf(doslink, doslink_len, "%sp%d", maindev->devlink, i);
                                 m = devinfo_storage_new_minor(maindev_path, dospath, doslink, maindev->dev, i);
                                 g_queue_push_tail (mq, m);
                         }
                         free (doslink);
                 }

@@ -1401,30 +1394,30 @@
 static gboolean
 is_dos_path(char *path, int *partnum)
 {
         char *p;
 
-        if ((p = strrchr (path, ':')) == NULL) {
+        if ((p = strrchr (path, 'p')) == NULL) {
                 return (FALSE);
         }
         return ((*partnum = atoi(p + 1)) != 0);
 }
 
 static gboolean
 dos_to_dev(char *path, char **devpath, int *partnum)
 {
         char *p;
 
-        if ((p = strrchr (path, ':')) == NULL) {
+        if ((p = strrchr (path, 'p')) == NULL) {
                 return (FALSE);
         }
         if ((*partnum = atoi(p + 1)) == 0) {
                 return (FALSE);
         }
         p[0] = '\0';
         *devpath = strdup(path);
-        p[0] = ':';
+        p[0] = 'p';
         return (*devpath != NULL);
 }
 
 static void
 devinfo_storage_cleanup_mountpoint_cb (HalDevice *d, guint32 exit_type,