Ignore:
Timestamp:
Jan 6, 2009, 5:42:58 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Improve function truncate_to_drive_name to support returning full drives used as partitions (such as /dev/mapper/mapthx)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.8/mondo/src/common/libmondo-string.c

    r2052 r2105  
    863863    }
    864864    /* then see if it's a dm style device */
    865     if (c && strncmp(c, "/dm-", 5) == 0) {
     865    if (c && strncmp(c, "/dm-", 4) == 0) {
    866866        /* yup it's dm, return the full path */
    867867        return partition;
    868868    }
     869
    869870
    870871    for (i = strlen(partition); isdigit(partition[i - 1]); i--)
     
    872873    if (partition[i - 1] == 'p' && isdigit(partition[i - 2])) {
    873874        i--;
     875    } else {
     876        /* Some full devices like this /dev/mapper/mpath0
     877        * /dev/cciss/c0d0 may be used as partition names */
     878        if ((strstr(partition,"/dev/mapper/mpath") != NULL) ||
     879            (strstr(partition,"/dev/cciss/c") != NULL) ||
     880            (strstr(partition,"/dev/rd/") != NULL)) {
     881                return partition;
     882            }
    874883    }
    875884    partition[i] = '\0';
Note: See TracChangeset for help on using the changeset viewer.