diff options
| author | Benjamin Gray <bgray@linux.ibm.com> | 2023-02-03 11:39:43 +1100 |
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-02-09 23:56:45 +1100 |
| commit | a974f0c131891027fe8490e654a220151b4caa82 (patch) | |
| tree | c34ee66a72c63ea337253cdcdb399e933843aedf /tools/testing/selftests/powerpc/include | |
| parent | b505063910c134778202dfad9332dfcecb76bab3 (diff) | |
selftests/powerpc: Add generic read/write file util
File read/write is reimplemented in about 5 different ways in the
various PowerPC selftests. This indicates it should be a common util.
Add a common read_file / write_file implementation and convert users
to it where (easily) possible.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230203003947.38033-2-bgray@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/include')
| -rw-r--r-- | tools/testing/selftests/powerpc/include/utils.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h index e222a5858450..70885e5814a8 100644 --- a/tools/testing/selftests/powerpc/include/utils.h +++ b/tools/testing/selftests/powerpc/include/utils.h @@ -33,6 +33,8 @@ void *get_auxv_entry(int type); int pick_online_cpu(void); +int read_file(const char *path, char *buf, size_t count, size_t *len); +int write_file(const char *path, const char *buf, size_t count); int read_debugfs_file(char *debugfs_file, int *result); int write_debugfs_file(char *debugfs_file, int result); int read_sysfs_file(char *debugfs_file, char *result, size_t result_size); |
