mirror of
https://github.com/ipxe/ipxe
synced 2025-12-28 02:28:57 +03:00
Added POSIX-style blocking I/O calls, for use by PXE TFTP API.
This commit is contained in:
31
src/include/gpxe/posix_io.h
Normal file
31
src/include/gpxe/posix_io.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _GPXE_POSIX_IO_H
|
||||
#define _GPXE_POSIX_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* POSIX-like I/O
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/uaccess.h>
|
||||
|
||||
extern int open ( const char *uri_string );
|
||||
extern ssize_t read_user ( int fd, userptr_t buffer,
|
||||
off_t offset, size_t len );
|
||||
extern ssize_t fsize ( int fd );
|
||||
extern int close ( int fd );
|
||||
|
||||
/**
|
||||
* Read data from file
|
||||
*
|
||||
* @v fd File descriptor
|
||||
* @v buf Data buffer
|
||||
* @v len Maximum length to read
|
||||
* @ret len Actual length read, or negative error number
|
||||
*/
|
||||
static inline ssize_t read ( int fd, void *buf, size_t len ) {
|
||||
return read_user ( fd, virt_to_user ( buf ), 0, len );
|
||||
}
|
||||
|
||||
#endif /* _GPXE_POSIX_IO_H */
|
||||
Reference in New Issue
Block a user