Print this page
4846 HAL partition names don't match real partition names
*** 3,12 ****
--- 3,14 ----
* fsutils.c : filesystem utilities
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
+ * Copyright 2014 Andrew Stormont.
+ *
* Licensed under the Academic Free License version 2.1
*
*/
#ifdef HAVE_CONFIG_H
*** 31,56 ****
#include <libhal.h>
#include "fsutils.h"
/*
* Separates dos notation device spec into device and drive number
*/
boolean_t
dos_to_dev(char *path, char **devpath, int *num)
{
! char *p;
! if ((p = strrchr(path, ':')) == NULL) {
! return (B_FALSE);
}
! if ((*num = atoi(p + 1)) == 0) {
return (B_FALSE);
}
! p[0] = '\0';
! *devpath = strdup(path);
! p[0] = ':';
! return (*devpath != NULL);
}
char *
get_slice_name(char *devlink)
{
--- 33,67 ----
#include <libhal.h>
#include "fsutils.h"
/*
* Separates dos notation device spec into device and drive number
+ * pN partition names are rewritten to point to p0
+ * :N partition names are dropped
*/
boolean_t
dos_to_dev(char *path, char **devpath, int *num)
{
! int i;
! char *buf;
! boolean_t found = B_FALSE;
! for (i = strlen(path); i > 0; i--) {
! if (path[i] == 'p' || path[i] == ':') {
! found = B_TRUE;
! break;
}
! }
!
! if (found == B_FALSE || (*num = atoi(path + i + 1)) == 0 ||
! (buf = strdup(path)) == NULL) {
return (B_FALSE);
}
!
! (void) strcpy(buf + i, path[i] == 'p' ? "p0" : "");
! *devpath = buf;
! return (B_TRUE);
}
char *
get_slice_name(char *devlink)
{