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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/hal/hald/solaris/devinfo_storage.c
          +++ new/usr/src/cmd/hal/hald/solaris/devinfo_storage.c
   1    1  /***************************************************************************
   2    2   *
   3    3   * devinfo_storage.c : storage devices
   4    4   *
   5    5   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
   6    6   * Copyright 2013 Garrett D'Amore <garrett@damore.org>
        7 + * Copyright 2014 Andrew Stormont.
   7    8   *
   8    9   * Licensed under the Academic Free License version 2.1
   9   10   *
  10   11   **************************************************************************/
  11   12  
  12   13  #ifdef HAVE_CONFIG_H
  13   14  #  include <config.h>
  14   15  #endif
  15   16  
  16   17  #include <stdio.h>
↓ open down ↓ 678 lines elided ↑ open up ↑
 695  696          free (raw);
 696  697          hal_device_property_set_bool (d, "block.is_volume", FALSE);
 697  698  
 698  699          devinfo_add_enqueue (d, minor_path, &devinfo_storage_handler);
 699  700  
 700  701          /* add volumes: one on main device and a few pcfs candidates */
 701  702          m = devinfo_storage_new_minor(minor_path, WHOLE_DISK, devlink, dev, -1);
 702  703          devinfo_volume_add (d, node, m);
 703  704          devinfo_storage_free_minor (m);
 704  705  
 705      -        doslink = (char *)calloc (1, strlen (devlink) + sizeof (":NNN") + 1);
      706 +        doslink = (char *)calloc (1, strlen (devlink) + sizeof ("pNN") + 1);
 706  707          if (doslink != NULL) {
 707  708                  for (i = 1; i < 16; i++) {
 708      -                        snprintf(dospath, sizeof (dospath), WHOLE_DISK":%d", i);
 709      -                        sprintf(doslink, "%s:%d", devlink, i);
      709 +                        snprintf(dospath, sizeof (dospath), "p%d", i);
      710 +                        sprintf(doslink, "%sp%d", devlink, i);
 710  711                          m = devinfo_storage_new_minor(minor_path, dospath, doslink, dev, i);
 711  712                          devinfo_volume_add (d, node, m);
 712  713                          devinfo_storage_free_minor (m);
 713  714                  }
 714  715                  free (doslink);
 715  716          }
 716  717  }
 717  718  
 718  719  void
 719  720  devinfo_lofi_remove_minor(char *parent_devfs_path, char *name)
↓ open down ↓ 132 lines elided ↑ open up ↑
 852  853                          continue;
 853  854                  }
 854  855  
 855  856                  slice = devinfo_volume_get_slice_name (devlink);
 856  857                  if (strlen (slice) < 2) {
 857  858                          free (devlink);
 858  859                          di_devfs_path_free (minor_path);
 859  860                          continue;
 860  861                  }
 861  862  
 862      -                /* ignore p1..N - we'll use p0:N instead */
 863      -                if ((strlen (slice) > 1) && (slice[0] == 'p') && isdigit(slice[1]) &&
 864      -                    ((atol(&slice[1])) > 0)) {
 865      -                        free (devlink);
 866      -                        di_devfs_path_free (minor_path);
 867      -                        continue;
 868      -                }
 869      -
 870  863                  m = devinfo_storage_new_minor(minor_path, slice, devlink, dev, -1);
 871  864                  if (m == NULL) {
 872  865                          free (devlink);
 873  866                          di_devfs_path_free (minor_path);
 874  867                          continue;
 875  868                  }
 876  869  
 877  870                  /* main device is either s2/p0 or d0, the latter taking precedence */
 878  871                  if ((strcmp (slice, "d0") == 0) ||
 879  872                      (((strcmp (slice, whole_disk) == 0) && (maindev == NULL)))) {
↓ open down ↓ 28 lines elided ↑ open up ↑
 908  901                  raw = dsk_to_rdsk (maindev->devlink);
 909  902                  hal_device_property_set_string (parent, "block.solaris.raw_device", raw);
 910  903                  free (raw);
 911  904                  hal_device_property_set_bool (parent, "block.is_volume", FALSE);
 912  905                  hal_device_property_set_string (parent, "solaris.devfs_path", maindev_path);
 913  906                  devinfo_add_enqueue (parent, maindev_path, &devinfo_storage_handler);
 914  907          }
 915  908  
 916  909          /* add virtual dos volumes to enable pcfs probing */
 917  910          if (!is_cdrom) {
 918      -                doslink_len = strlen (maindev->devlink) + sizeof (":NNN") + 1;
      911 +                doslink_len = strlen (maindev->devlink) + sizeof ("pNN") + 1;
 919  912                  if ((doslink = (char *)calloc (1, doslink_len)) != NULL) {
 920  913                          for (i = 1; i < 16; i++) {
 921      -                                snprintf(dospath, sizeof (dospath), "%s:%d", maindev->slice, i);
 922      -                                snprintf(doslink, doslink_len, "%s:%d", maindev->devlink, i);
      914 +                                snprintf(dospath, sizeof (dospath), "%sp%d", maindev->slice, i);
      915 +                                snprintf(doslink, doslink_len, "%sp%d", maindev->devlink, i);
 923  916                                  m = devinfo_storage_new_minor(maindev_path, dospath, doslink, maindev->dev, i);
 924  917                                  g_queue_push_tail (mq, m);
 925  918                          }
 926  919                          free (doslink);
 927  920                  }
 928  921          }
 929  922  
 930  923          maindev_is_d0 = (strcmp (maindev->slice, "d0") == 0);
 931  924  
 932  925          /* enqueue all volumes */
↓ open down ↓ 463 lines elided ↑ open up ↑
1396 1389          } else {
1397 1390                  return ("");
1398 1391          }
1399 1392  }
1400 1393  
1401 1394  static gboolean
1402 1395  is_dos_path(char *path, int *partnum)
1403 1396  {
1404 1397          char *p;
1405 1398  
1406      -        if ((p = strrchr (path, ':')) == NULL) {
     1399 +        if ((p = strrchr (path, 'p')) == NULL) {
1407 1400                  return (FALSE);
1408 1401          }
1409 1402          return ((*partnum = atoi(p + 1)) != 0);
1410 1403  }
1411 1404  
1412 1405  static gboolean
1413 1406  dos_to_dev(char *path, char **devpath, int *partnum)
1414 1407  {
1415 1408          char *p;
1416 1409  
1417      -        if ((p = strrchr (path, ':')) == NULL) {
     1410 +        if ((p = strrchr (path, 'p')) == NULL) {
1418 1411                  return (FALSE);
1419 1412          }
1420 1413          if ((*partnum = atoi(p + 1)) == 0) {
1421 1414                  return (FALSE);
1422 1415          }
1423 1416          p[0] = '\0';
1424 1417          *devpath = strdup(path);
1425      -        p[0] = ':';
     1418 +        p[0] = 'p';
1426 1419          return (*devpath != NULL);
1427 1420  }
1428 1421  
1429 1422  static void
1430 1423  devinfo_storage_cleanup_mountpoint_cb (HalDevice *d, guint32 exit_type, 
1431 1424                         gint return_code, gchar **error,
1432 1425                         gpointer data1, gpointer data2)
1433 1426  {
1434 1427          char *mount_point = (char *) data1;
1435 1428  
↓ open down ↓ 296 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX