summaryrefslogtreecommitdiff
path: root/sysdeps/linux/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/linux/disk.c')
-rw-r--r--sysdeps/linux/disk.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/sysdeps/linux/disk.c b/sysdeps/linux/disk.c
index dbd46dff..c2d341f6 100644
--- a/sysdeps/linux/disk.c
+++ b/sysdeps/linux/disk.c
@@ -51,7 +51,7 @@ void
find_primary_part (partition_info *primary_part, const char *m)
{
int n = 0, tlvl = 0;
- char name[256]="", type[256]="";
+ char name[256]="",type[256]="";
primary_part->max = 0;
@@ -92,12 +92,18 @@ find_primary_part (partition_info *primary_part, const char *m)
n--;
}
- else if ((strcmp (type, "lvm") == 0) || (strncmp (type, "raid", 4) == 0)) {
+ else if ((strcmp (type, "lvm") == 0)) {
tlvl = 2;
primary_part->max++;
}
+ else if ((strncmp (type, "raid", 4) == 0)) {
+
+ tlvl = 2;
+ primary_part->max++;
+
+ }
}
else if( tlvl == 2){
@@ -109,14 +115,23 @@ find_primary_part (partition_info *primary_part, const char *m)
primary_part->max++;
}
- else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0) ||
- (strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
+ else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0)) {
+
+ n--;
+
+ }
+ else if ((strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
n--;
}
- else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0) ||
- (strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
+ else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0)) {
+
+ n--;
+ tlvl = 1;
+
+ }
+ else if ((strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
n--;
tlvl = 1;
@@ -156,7 +171,6 @@ find_primary_part (partition_info *primary_part, const char *m)
tlvl = 1;
}
-
}
@@ -181,12 +195,11 @@ is_virtual_drive (partition_info *primary_part, const char *p)
int i;
char name[256];
int test = 1;
-
sscanf (p, "%s", name);
if (*p) {
- for (i=0; i < primary_part->max; i++) {
+ for (i=0; i<primary_part->max; i++) {
if (strcmp (primary_part[i].name, name) == 0) {