mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
Don't run xfsdb if we're not root.
This commit is contained in:
+18
-15
@@ -73,7 +73,7 @@ use File::Basename;
|
|||||||
chomp($os = `uname`);
|
chomp($os = `uname`);
|
||||||
|
|
||||||
#
|
#
|
||||||
# fsinfo: get filesystem info put it into the global namespace, assigns:
|
# fsinfo: get filesystem info put it into the global namespace, initialises:
|
||||||
# $dev, $type, $blocks, $used, $avail, $cap, $mnt, $mnt_options
|
# $dev, $type, $blocks, $used, $avail, $cap, $mnt, $mnt_options
|
||||||
# $fsblocks, $fsblocksize, $agblocks, $agcount, $imax_pct, $logblocks
|
# $fsblocks, $fsblocksize, $agblocks, $agcount, $imax_pct, $logblocks
|
||||||
# $logstart, $internal
|
# $logstart, $internal
|
||||||
@@ -101,20 +101,22 @@ sub fsinfo {
|
|||||||
@mtab = split(/ +/);
|
@mtab = split(/ +/);
|
||||||
$mnt_options = $mtab[3];
|
$mnt_options = $mtab[3];
|
||||||
|
|
||||||
# xfs_db: read only, use the default superblock, print everything
|
# if we're running as root run xfs_db on the filesystem
|
||||||
die("Error: $progname: can't read device: \"$dev\"\n") if (! -r $dev);
|
if ($> == 0) {
|
||||||
$_=`xfs_db -r -c sb -c p $dev`;
|
# xfs_db: read only, use the default superblock, print everything
|
||||||
# multiline matching ^$ refers to individual lines...
|
die("Error: $progname: can't read device: \"$dev\"\n") if (! -r $dev);
|
||||||
/^dblocks = (\d+)$/m; $fsblocks=$1;
|
$_=`xfs_db -r -c sb -c p $dev`;
|
||||||
/^blocksize = (\d+)$/m; $fsblocksize=$1;
|
# multiline matching ^$ refers to individual lines...
|
||||||
/^agblocks = (\d+)$/m; $agblocks=$1;
|
/^dblocks = (\d+)$/m; $fsblocks=$1;
|
||||||
/^agcount = (\d+)$/m; $agcount=$1;
|
/^blocksize = (\d+)$/m; $fsblocksize=$1;
|
||||||
/^imax_pct = (\d+)$/m; $imax_pct=$1;
|
/^agblocks = (\d+)$/m; $agblocks=$1;
|
||||||
/^logblocks = (\d+)$/m; $logblocks=$1;
|
/^agcount = (\d+)$/m; $agcount=$1;
|
||||||
/^logstart = (\d+)$/m; $logstart=$1;
|
/^imax_pct = (\d+)$/m; $imax_pct=$1;
|
||||||
$internal = $logstart > 0 ? " (internal)" : "";
|
/^logblocks = (\d+)$/m; $logblocks=$1;
|
||||||
|
/^logstart = (\d+)$/m; $logstart=$1;
|
||||||
$verbose && print STDERR <<"EOF"
|
$internal = $logstart > 0 ? " (internal)" : "";
|
||||||
|
|
||||||
|
$verbose && print STDERR <<"EOF"
|
||||||
Filesystem information:
|
Filesystem information:
|
||||||
type=$type; device=$dev
|
type=$type; device=$dev
|
||||||
mount point=$mnt; mount options=$mnt_options
|
mount point=$mnt; mount options=$mnt_options
|
||||||
@@ -122,6 +124,7 @@ Filesystem information:
|
|||||||
total filesystem size (fs blocks)=$fsblocks; fs block size=$fsblocksize; imax_pct=$imax_pct
|
total filesystem size (fs blocks)=$fsblocks; fs block size=$fsblocksize; imax_pct=$imax_pct
|
||||||
agcount=$agcount; agblocks=$agblocks; logblocks=$logblocks; logstart=$logstart$internal
|
agcount=$agcount; agblocks=$agblocks; logblocks=$logblocks; logstart=$logstart$internal
|
||||||
EOF
|
EOF
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user