From 5c8a9905ce3b04a4317d356d5481552fd17b63cb Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 2 Mar 2021 23:37:41 +0000 Subject: [linux] Add a generic function for reading files from sysfs Signed-off-by: Michael Brown --- src/interface/linux/linux_api.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/interface/linux/linux_api.c') diff --git a/src/interface/linux/linux_api.c b/src/interface/linux/linux_api.c index fa694330e..6fa2b0e76 100644 --- a/src/interface/linux/linux_api.c +++ b/src/interface/linux/linux_api.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -198,6 +199,20 @@ int __asmcall linux_ioctl ( int fd, unsigned long request, ... ) { return ret; } +/** + * Wrap statx() + * + */ +int __asmcall linux_statx ( int dirfd, const char *pathname, int flags, + unsigned int mask, struct statx *statxbuf ) { + int ret; + + ret = statx ( dirfd, pathname, flags, mask, statxbuf ); + if ( ret == -1 ) + linux_errno = errno; + return ret; +} + /** * Wrap poll() * @@ -516,6 +531,7 @@ PROVIDE_IPXE_SYM ( linux_read ); PROVIDE_IPXE_SYM ( linux_write ); PROVIDE_IPXE_SYM ( linux_fcntl ); PROVIDE_IPXE_SYM ( linux_ioctl ); +PROVIDE_IPXE_SYM ( linux_statx ); PROVIDE_IPXE_SYM ( linux_poll ); PROVIDE_IPXE_SYM ( linux_nanosleep ); PROVIDE_IPXE_SYM ( linux_usleep ); -- cgit v1.2.3-55-g7522