summaryrefslogtreecommitdiff
path: root/sysdeps/linux/disk.c
diff options
context:
space:
mode:
authorJames Dominic P. Guana <guana.histark@gmail.com>2020-05-29 13:42:48 +0800
committerRobert Roth <robert.roth.off@gmail.com>2020-11-04 13:38:03 +0000
commite9da95977365731a8f921f2d23b943036bf8f3d5 (patch)
tree89395404f5006a3f485b3bbbb15474670efe23fb /sysdeps/linux/disk.c
parent7396970afe2290488fd072612a650353dd13a16d (diff)
downloadlibgtop-e9da95977365731a8f921f2d23b943036bf8f3d5.tar.gz
Updated config and added reference
Diffstat (limited to 'sysdeps/linux/disk.c')
-rw-r--r--sysdeps/linux/disk.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/sysdeps/linux/disk.c b/sysdeps/linux/disk.c
index c2d341f6..dbd46dff 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,18 +92,12 @@ find_primary_part (partition_info *primary_part, const char *m)
n--;
}
- else if ((strcmp (type, "lvm") == 0)) {
+ else if ((strcmp (type, "lvm") == 0) || (strncmp (type, "raid", 4) == 0)) {
tlvl = 2;
primary_part->max++;
}
- else if ((strncmp (type, "raid", 4) == 0)) {
-
- tlvl = 2;
- primary_part->max++;
-
- }
}
else if( tlvl == 2){
@@ -115,23 +109,14 @@ 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)) {
-
- n--;
-
- }
- else if ((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) ||
+ (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)) {
-
- n--;
- tlvl = 1;
-
- }
- else if ((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) ||
+ (strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
n--;
tlvl = 1;
@@ -171,6 +156,7 @@ find_primary_part (partition_info *primary_part, const char *m)
tlvl = 1;
}
+
}
@@ -195,11 +181,12 @@ 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) {