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
*
**************************************************************************/
@@ -79,12 +80,11 @@
const gchar *devinfo_volume_get_prober (HalDevice *d, int *timeout);
const gchar *devinfo_storage_get_prober (HalDevice *d, int *timeout);
static char *devinfo_scsi_dtype2str(int dtype);
static char *devinfo_volume_get_slice_name (char *devlink);
-static gboolean dos_to_dev(char *path, char **devpath, int *partnum);
-static gboolean is_dos_path(char *path, int *partnum);
+static boolean_t is_dos_slice(const char *slice, int *partnum);
static void devinfo_storage_set_nicknames (HalDevice *d);
DevinfoDevHandler devinfo_ide_handler = {
devinfo_ide_add,
@@ -857,18 +857,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;
@@ -911,24 +903,10 @@
hal_device_property_set_bool (parent, "block.is_volume", FALSE);
hal_device_property_set_string (parent, "solaris.devfs_path", maindev_path);
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;
- 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);
- m = devinfo_storage_new_minor(maindev_path, dospath, doslink, maindev->dev, i);
- g_queue_push_tail (mq, m);
- }
- free (doslink);
- }
- }
-
maindev_is_d0 = (strcmp (maindev->slice, "d0") == 0);
/* enqueue all volumes */
while (!g_queue_is_empty (mq)) {
m = g_queue_pop_head (mq);
@@ -1075,11 +1053,11 @@
}
whole_disk = hal_device_has_capability (storage_d,
"storage.cdrom") ? "s2" : WHOLE_DISK;
- if (is_dos_path(block_device, &dos_num)) {
+ if (is_dos_slice(slice, &dos_num)) {
/* don't probe more dos volumes than probe-storage found */
if ((hal_device_property_get_bool (storage_d, "storage.no_partitions_hint") ||
(dos_num > hal_device_property_get_int (storage_d, "storage.solaris.num_dos_partitions")))) {
HAL_INFO (("%d > %d %s", dos_num, hal_device_property_get_int (storage_d,
"storage.solaris.num_dos_partitions"), hal_device_get_udi (storage_d)));
@@ -1396,36 +1374,21 @@
} else {
return ("");
}
}
-static gboolean
-is_dos_path(char *path, int *partnum)
+static boolean_t
+is_dos_slice(const char *slice, int *partnum)
{
char *p;
- if ((p = strrchr (path, ':')) == NULL) {
- return (FALSE);
+ if ((p = strrchr(slice, 'p')) == NULL &&
+ (p = strrchr(slice, ':')) == NULL) {
+ return (B_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) {
- return (FALSE);
- }
- if ((*partnum = atoi(p + 1)) == 0) {
- return (FALSE);
- }
- p[0] = '\0';
- *devpath = strdup(path);
- p[0] = ':';
- return (*devpath != NULL);
+ return ((*partnum = atoi(p + 1)) != 0);
}
static void
devinfo_storage_cleanup_mountpoint_cb (HalDevice *d, guint32 exit_type,
gint return_code, gchar **error,