kdump-lib.sh: fix arithmetic operation syntax
upstream: fedora
resolves: bz2003832
conflict: none
commit c0edb80b8f
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 13:31:31 2021 +0800
kdump-lib.sh: fix arithmetic operation syntax
Get rid of let, and remove useless '$' on arithmetic variables.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
parent
6dbf7c2e6c
commit
d8f8b09fa0
@ -768,7 +768,7 @@ get_system_size()
|
|||||||
# replace '-' with '+0x' and '+' with '-0x'
|
# replace '-' with '+0x' and '+' with '-0x'
|
||||||
sum=$( echo $result | sed -e 's/-/K0x/g' | sed -e 's/+/-0x/g' | sed -e 's/K/+/g' )
|
sum=$( echo $result | sed -e 's/-/K0x/g' | sed -e 's/+/-0x/g' | sed -e 's/K/+/g' )
|
||||||
size=$(printf "%d\n" $(($sum)))
|
size=$(printf "%d\n" $(($sum)))
|
||||||
let size=$size/1024/1024/1024
|
size=$((size / 1024 / 1024 / 1024))
|
||||||
|
|
||||||
echo $size
|
echo $size
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ get_recommend_size()
|
|||||||
size=${end: : -1}
|
size=${end: : -1}
|
||||||
unit=${end: -1}
|
unit=${end: -1}
|
||||||
if [[ $unit == 'T' ]]; then
|
if [[ $unit == 'T' ]]; then
|
||||||
let size=$size*1024
|
size=$((size * 1024))
|
||||||
fi
|
fi
|
||||||
if [[ $mem_size -lt $size ]]; then
|
if [[ $mem_size -lt $size ]]; then
|
||||||
echo $recommend
|
echo $recommend
|
||||||
@ -890,7 +890,7 @@ get_vmlinux_size()
|
|||||||
local size=0
|
local size=0
|
||||||
|
|
||||||
while read _type _offset _virtaddr _physaddr _fsize _msize _flg _aln; do
|
while read _type _offset _virtaddr _physaddr _fsize _msize _flg _aln; do
|
||||||
size=$(( $size + $_msize ))
|
size=$(( size + _msize ))
|
||||||
done <<< $(readelf -l -W $1 | grep "^ LOAD" 2>/dev/stderr)
|
done <<< $(readelf -l -W $1 | grep "^ LOAD" 2>/dev/stderr)
|
||||||
|
|
||||||
echo $size
|
echo $size
|
||||||
@ -945,7 +945,7 @@ get_kernel_size()
|
|||||||
# Fallback to use iomem
|
# Fallback to use iomem
|
||||||
local _size=0
|
local _size=0
|
||||||
for _seg in $(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1); do
|
for _seg in $(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1); do
|
||||||
_size=$(( $_size + 0x${_seg#*-} - 0x${_seg%-*} ))
|
_size=$(( _size + 0x${_seg#*-} - 0x${_seg%-*} ))
|
||||||
done
|
done
|
||||||
echo $_size
|
echo $_size
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user