summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/posix_io.h
diff options
context:
space:
mode:
authorMichael Brown2007-05-18 16:19:22 +0200
committerMichael Brown2007-05-18 16:19:22 +0200
commit86a948ccbe162d584be846228438fc086bce66fa (patch)
tree854748204e505e8bf05f54391f13aaf8351db4cd /src/include/gpxe/posix_io.h
parentAllow construction of PXE status code from internal error number. (diff)
downloadipxe-86a948ccbe162d584be846228438fc086bce66fa.tar.gz
ipxe-86a948ccbe162d584be846228438fc086bce66fa.tar.xz
ipxe-86a948ccbe162d584be846228438fc086bce66fa.zip
Added POSIX-style blocking I/O calls, for use by PXE TFTP API.
Diffstat (limited to 'src/include/gpxe/posix_io.h')
-rw-r--r--src/include/gpxe/posix_io.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/include/gpxe/posix_io.h b/src/include/gpxe/posix_io.h
new file mode 100644
index 00000000..a5cf0c75
--- /dev/null
+++ b/src/include/gpxe/posix_io.h
@@ -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 */