mirror of
https://github.com/ipxe/ipxe
synced 2026-02-04 06:59:59 +03:00
[linux] Add a generic function for reading files from sysfs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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 )
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
16
src/include/ipxe/linux_sysfs.h
Normal file
16
src/include/ipxe/linux_sysfs.h
Normal file
@@ -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 */
|
||||
Reference in New Issue
Block a user