diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-03-02 23:37:41 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-03-02 23:59:30 +0000 |
commit | 5c8a9905ce3b04a4317d356d5481552fd17b63cb (patch) | |
tree | 5b9c13b219632bb6171fe6acc5dcfd505ae1c27d /src/include | |
parent | 976839ae4c01530a6a931be7b2386a3abee328b9 (diff) | |
download | ipxe-5c8a9905ce3b04a4317d356d5481552fd17b63cb.tar.gz |
[linux] Add a generic function for reading files from sysfs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ipxe/errfile.h | 1 | ||||
-rw-r--r-- | src/include/ipxe/linux_api.h | 3 | ||||
-rw-r--r-- | src/include/ipxe/linux_sysfs.h | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h index b5c5d185e..3daf7bde7 100644 --- a/src/include/ipxe/errfile.h +++ b/src/include/ipxe/errfile.h @@ -388,6 +388,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define ERRFILE_efi_autoboot ( ERRFILE_OTHER | 0x00530000 ) #define ERRFILE_efi_autoexec ( ERRFILE_OTHER | 0x00540000 ) #define ERRFILE_efi_cachedhcp ( ERRFILE_OTHER | 0x00550000 ) +#define ERRFILE_linux_sysfs ( ERRFILE_OTHER | 0x00560000 ) /** @} */ diff --git a/src/include/ipxe/linux_api.h b/src/include/ipxe/linux_api.h index 040b52f8c..ab2e8014d 100644 --- a/src/include/ipxe/linux_api.h +++ b/src/include/ipxe/linux_api.h @@ -46,6 +46,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <linux/ioctl.h> #include <linux/poll.h> #include <linux/fs.h> +#include <linux/stat.h> #define MAP_FAILED ( ( void * ) -1 ) #endif @@ -65,6 +66,8 @@ extern ssize_t __asmcall linux_read ( int fd, void *buf, size_t count ); extern ssize_t __asmcall linux_write ( int fd, const void *buf, size_t count ); extern int __asmcall linux_fcntl ( int fd, int cmd, ... ); extern int __asmcall linux_ioctl ( int fd, unsigned long request, ... ); +extern int __asmcall linux_statx ( int dirfd, const char *pathname, int flags, + unsigned int mask, struct statx *statxbuf ); extern int __asmcall linux_poll ( struct pollfd *fds, unsigned int nfds, int timeout ); extern int __asmcall linux_nanosleep ( const struct timespec *req, diff --git a/src/include/ipxe/linux_sysfs.h b/src/include/ipxe/linux_sysfs.h new file mode 100644 index 000000000..d97b649c0 --- /dev/null +++ b/src/include/ipxe/linux_sysfs.h @@ -0,0 +1,16 @@ +#ifndef _IPXE_LINUX_SYSFS_H +#define _IPXE_LINUX_SYSFS_H + +/** @file + * + * Linux sysfs files + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <ipxe/uaccess.h> + +extern int linux_sysfs_read ( const char *filename, userptr_t *data ); + +#endif /* _IPXE_LINUX_SYSFS_H */ |