dump f2fs in gs-common

Bug: 248143736
Test: adb bugreport
Change-Id: Ifcd0b3aaa017d106530c58a1ce2b56d77af1b12d
This commit is contained in:
Adam Shih 2022-09-23 10:54:11 +08:00
parent 1bfa9e6a2f
commit 262892227c
7 changed files with 39 additions and 0 deletions

10
storage/Android.bp Normal file
View File

@ -0,0 +1,10 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
sh_binary {
name: "dump_storage.sh",
src: "dump_storage.sh",
vendor: true,
sub_dir: "dump",
}

10
storage/dump_storage.sh Normal file
View File

@ -0,0 +1,10 @@
#!/vendor/bin/sh
# F2FS
echo "--- F2FS status---"
cat "/sys/kernel/debug/f2fs/status"
echo "\n--- F2FS fsck ---"
cat "/dev/fscklogs/fsck"
echo "\n--- F2FS - fsck time (ms) ---"
getprop ro.boottime.init.fsck.data
echo "\n--- F2FS - checkpoint=disable time (ms) ---"
getprop ro.boottime.init.mount.data

View File

@ -0,0 +1,13 @@
pixel_bugreport(dump_storage)
allow dump_storage vendor_toolbox_exec:file execute_no_trans;
userdebug_or_eng(`
allow dump_storage debugfs_f2fs:dir r_dir_perms;
allow dump_storage debugfs_f2fs:file r_file_perms;
')
get_prop(dump_storage, boottime_public_prop)
dontaudit dump_storage debugfs_f2fs:dir r_dir_perms;
dontaudit dump_storage debugfs_f2fs:file r_file_perms;

1
storage/sepolicy/file.te Normal file
View File

@ -0,0 +1 @@
type debugfs_f2fs, debugfs_type, fs_type;

View File

@ -0,0 +1 @@
/vendor/bin/dump/dump_storage\.sh u:object_r:dump_storage_exec:s0

View File

@ -0,0 +1 @@
genfscon debugfs /f2fs u:object_r:debugfs_f2fs:s0

3
storage/storage.mk Normal file
View File

@ -0,0 +1,3 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/storage/sepolicy
PRODUCT_PACKAGES += dump_storage.sh