summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/linux/linux_api.c11
-rw-r--r--src/interface/linux/linux_sysfs.c4
2 files changed, 7 insertions, 8 deletions
diff --git a/src/interface/linux/linux_api.c b/src/interface/linux/linux_api.c
index 6fa2b0e76..d1f969aa7 100644
--- a/src/interface/linux/linux_api.c
+++ b/src/interface/linux/linux_api.c
@@ -200,14 +200,15 @@ int __asmcall linux_ioctl ( int fd, unsigned long request, ... ) {
}
/**
- * Wrap statx()
+ * Wrap part of fstat()
*
*/
-int __asmcall linux_statx ( int dirfd, const char *pathname, int flags,
- unsigned int mask, struct statx *statxbuf ) {
+int __asmcall linux_fstat_size ( int fd, size_t *size ) {
+ struct stat stat;
int ret;
- ret = statx ( dirfd, pathname, flags, mask, statxbuf );
+ ret = fstat ( fd, &stat );
+ *size = stat.st_size;
if ( ret == -1 )
linux_errno = errno;
return ret;
@@ -531,7 +532,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_fstat_size );
PROVIDE_IPXE_SYM ( linux_poll );
PROVIDE_IPXE_SYM ( linux_nanosleep );
PROVIDE_IPXE_SYM ( linux_usleep );
diff --git a/src/interface/linux/linux_sysfs.c b/src/interface/linux/linux_sysfs.c
index 0b9f1f5d9..463bc2ab9 100644
--- a/src/interface/linux/linux_sysfs.c
+++ b/src/interface/linux/linux_sysfs.c
@@ -40,7 +40,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @ret len Length read, or negative error
*/
int linux_sysfs_read ( const char *filename, userptr_t *data ) {
- struct statx statx;
size_t offset;
size_t len;
ssize_t read;
@@ -57,13 +56,12 @@ int linux_sysfs_read ( const char *filename, userptr_t *data ) {
}
/* Get file length */
- if ( linux_statx ( fd, "", AT_EMPTY_PATH, STATX_SIZE, &statx ) == -1 ) {
+ if ( linux_fstat_size ( fd, &len ) == -1 ) {
rc = -ELINUX ( linux_errno );
DBGC ( filename, "LINUX could not stat %s: %s\n",
filename, linux_strerror ( linux_errno ) );
goto err_stat;
}
- len = statx.stx_size;
/* Allocate buffer */
*data = umalloc ( len );