kdump-lib.sh: introduce a helper to get all crypt dev used by kdump
Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
3423bbc17f
commit
1c70cf51c7
21
kdump-lib.sh
21
kdump-lib.sh
@ -975,3 +975,24 @@ get_luks_crypt_dev()
|
|||||||
get_luks_crypt_dev "$(< "$_x/dev")"
|
get_luks_crypt_dev "$(< "$_x/dev")"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# kdump_get_maj_min <device>
|
||||||
|
# Prints the major and minor of a device node.
|
||||||
|
# Example:
|
||||||
|
# $ get_maj_min /dev/sda2
|
||||||
|
# 8:2
|
||||||
|
kdump_get_maj_min() {
|
||||||
|
local _majmin
|
||||||
|
_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
|
||||||
|
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_all_kdump_crypt_dev()
|
||||||
|
{
|
||||||
|
local _dev _crypt
|
||||||
|
|
||||||
|
for _dev in $(get_block_dump_target); do
|
||||||
|
_crypt=$(get_luks_crypt_dev $(kdump_get_maj_min "$_dev"))
|
||||||
|
[[ -n "$_crypt" ]] && echo $_crypt
|
||||||
|
done
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user