Skip to content

Commit 157f100

Browse files
committed
check: move _get_kernel_option and _check_kernel_option to check
Move the two functions to check for kernel option DEBUG_KMEMLEAK_DEFAULT_OFF check Signed-off-by: Yi Zhang <[email protected]>
1 parent ea34d6a commit 157f100

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

check

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,31 @@ _check_dmesg() {
183183
fi
184184
}
185185

186+
# Retrieve the value of kernel option $1.
187+
_get_kernel_option() {
188+
local f opt=$1 result
189+
190+
for f in /proc/config.gz /boot/config-$(uname -r); do
191+
[ -e "$f" ] || continue
192+
if result=$(zgrep "^CONFIG_${opt}=" "$f"); then
193+
echo "${result#*=}"
194+
return 0
195+
fi
196+
done
197+
198+
return 1
199+
}
200+
201+
# Check if kernel option $1 is defined.
202+
_check_kernel_option() {
203+
case "$(_get_kernel_option "$1")" in
204+
y|m)
205+
return 0;;
206+
esac
207+
208+
return 1
209+
}
210+
186211
_setup_kmemleak() {
187212
local f="/sys/kernel/debug/kmemleak"
188213

common/rc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -211,31 +211,6 @@ _have_kernel_config_file() {
211211
return 0
212212
}
213213

214-
# Retrieve the value of kernel option $1.
215-
_get_kernel_option() {
216-
local f opt=$1 result
217-
218-
for f in /proc/config.gz /boot/config-$(uname -r); do
219-
[ -e "$f" ] || continue
220-
if result=$(zgrep "^CONFIG_${opt}=" "$f"); then
221-
echo "${result#*=}"
222-
return 0
223-
fi
224-
done
225-
226-
return 1
227-
}
228-
229-
# Check if kernel option $1 is defined.
230-
_check_kernel_option() {
231-
case "$(_get_kernel_option "$1")" in
232-
y|m)
233-
return 0;;
234-
esac
235-
236-
return 1
237-
}
238-
239214
# Combine _have_kernel_config_file() and _check_kernel_option().
240215
# Set SKIP_REASONS when _check_kernel_option() returns false.
241216
_have_kernel_option() {

0 commit comments

Comments
 (0)