···5555 The object directory contains subdirectories for each function5656 that is patched within the object.57575858+What: /sys/kernel/livepatch/<patch>/<object>/patched5959+Date: August 20226060+KernelVersion: 6.1.06161+Contact: live-patching@vger.kernel.org6262+Description:6363+ An attribute which indicates whether the object is currently6464+ patched.6565+5866What: /sys/kernel/livepatch/<patch>/<object>/<function,sympos>5967Date: Nov 20146068KernelVersion: 3.19.0
···6677MAX_RETRIES=60088RETRY_INTERVAL=".1" # seconds99+KLP_SYSFS_DIR="/sys/kernel/livepatch"9101011# Kselftest framework requirement - SKIP code is 41112ksft_skip=4···308307 fi309308310309 cleanup_dmesg_file310310+}311311+312312+# check_sysfs_rights(modname, rel_path, expected_rights) - check sysfs313313+# path permissions314314+# modname - livepatch module creating the sysfs interface315315+# rel_path - relative path of the sysfs interface316316+# expected_rights - expected access rights317317+function check_sysfs_rights() {318318+ local mod="$1"; shift319319+ local rel_path="$1"; shift320320+ local expected_rights="$1"; shift321321+322322+ local path="$KLP_SYSFS_DIR/$mod/$rel_path"323323+ local rights=$(/bin/stat --format '%A' "$path")324324+ if test "$rights" != "$expected_rights" ; then325325+ die "Unexpected access rights of $path: $expected_rights vs. $rights"326326+ fi327327+}328328+329329+# check_sysfs_value(modname, rel_path, expected_value) - check sysfs value330330+# modname - livepatch module creating the sysfs interface331331+# rel_path - relative path of the sysfs interface332332+# expected_value - expected value read from the file333333+function check_sysfs_value() {334334+ local mod="$1"; shift335335+ local rel_path="$1"; shift336336+ local expected_value="$1"; shift337337+338338+ local path="$KLP_SYSFS_DIR/$mod/$rel_path"339339+ local value=`cat $path`340340+ if test "$value" != "$expected_value" ; then341341+ die "Unexpected value in $path: $expected_value vs. $value"342342+ fi311343}