blob: 2e300c20bbc776e2aa1daf9b325c36f2dbc892ac [file] [log] [blame] [edit]
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0+
# Copyright (C) 2017 Omar Sandoval
#
# null_blk helper functions.
_have_null_blk() {
_have_modules null_blk
}
_init_null_blk() {
if [[ -d /sys/kernel/config/nullb ]]; then
find /sys/kernel/config/nullb -mindepth 1 -maxdepth 1 \
-type d -delete
fi
local zoned=""
if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi
if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then
return 1
fi
udevadm settle
return 0
}
_exit_null_blk() {
udevadm settle
modprobe -r null_blk
}