Skip to content

Commit

Permalink
v0.7.5: big overhaul of /proc/partitions parser #180
Browse files Browse the repository at this point in the history
  • Loading branch information
ryran committed Aug 18, 2015
1 parent 0fa1746 commit 3b3736f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions xsos
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# xsos v0.7.4 last mod 2015/07/18
# xsos v0.7.5 last mod 2015/08/18
# Latest version at <http://github.com/ryran/xsos>
# RPM packages available at <http://people.redhat.com/rsawhill/rpms>
# Copyright 2012-2015 Ryan Sawhill Aroha <[email protected]>
Expand Down Expand Up @@ -1842,9 +1842,20 @@ STORAGE() {
egrep -v "${scsi_blacklist%?}" "$partitions_input" |
gawk -vblacklisted=$bl -vblacklist_devcount=$(wc -w <<<"${scsi_blacklist//|/ }") -vcolor_grey="${c[DGREY]}" -vH_IMP="${c[Imp]}" -vH3="${c[H3]}" -vH2="${c[H2]}" -vH0="${c[0]}" '
# For starters, we search /proc/partitions for certain types of devices
# (These partition types are from devices.txt in the linux kernel documentation)
$4 ~ /^hd.$|^sd[[:alpha:]]+$|^md.$|^r+om.$|^r?flash.$|^rd\/c.{1,2}d.{1,2}$|^ida\/c.d.$|^i2o\/hd[[:alpha:]]+$|^amiraid\/ar.{1,2}$|cbd\/.$|^cciss\/c.d.{1,2}$|^iseries\/vd[[:alpha:]]+$|^ataraid\/d.{1,2}$|^emd\/.{1,2}$|^carmel\/.{1,2}$|^mmcblk.$|^ub.$|^xvd[[:alpha:]]+$|^vd[[:alpha:]]+$|^dasd[[:alpha:]]+$/ {
# These block types are from devices.txt in the linux kernel documentation
# Updated 2015/08/18 from kernel-doc-3.10.0-229.7.2.el7
BEGIN {
blkdevs = "^(" \
"(vd|hd|sd|mfm|ad|ftl|pd|i2o/hd|nftl|dasd|inftl|ubd|cbd/|iseries/vd|ub|xvd|rfd|ssfdc)[[:alpha:]]+" \
"|" \
"(ramdisk|ram|loop|md|rr?om|r?flash|nb|ppdd|amiraid/ar|ataraid/d|nwfs/v|umem/d|drbd|etherd/|emd/|carmel/|mmcblk|blockrom)[0-9]+" \
"|" \
"(rd|ida|cciss)/c[0-9]+d[0-9]+" \
"|" \
"vx/dsk/.*/.*|vx/dmp/.*" \
")$"
}
$4 ~ blkdevs {
# For each thing found, increment the total number of disks
numdisks ++
Expand Down

0 comments on commit 3b3736f

Please sign in to comment.