Page MenuHomeFreeBSD

D38265.diff
No OneTemporary

D38265.diff

diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -206,4 +206,14 @@
host_mmap(0, size, HOST_PROT_READ | HOST_PROT_WRITE, \
HOST_MAP_PRIVATE | HOST_MAP_ANONYMOUS, -1, 0);
+/*
+ * Translate Linux errno to FreeBSD errno. The two system have idenitcal errors
+ * for 1-34. After that, they differ. Linux also has errno that don't map
+ * exactly to FreeBSD's errno, plus the Linux errno are arch dependent >
+ * 34. Since we just need to do this for simple cases, use the simple mapping
+ * function where -1 to -34 are translated to 1 to 34 and all others are EINVAL.
+ * Pass the linux return value, which will be the -errno.
+ */
+#define host_to_stand_errno(e) ((-e) > 34 ? EINVAL : (-e))
+
#endif
diff --git a/stand/kboot/hostfs.c b/stand/kboot/hostfs.c
--- a/stand/kboot/hostfs.c
+++ b/stand/kboot/hostfs.c
@@ -112,9 +112,8 @@
ssize_t sz;
sz = host_read(hf->hf_fd, start, size);
- if (sz < 0) {
- return (EINVAL);
- }
+ if (sz < 0)
+ return (host_to_stand_errno(sz));
*resid = size - sz;
return (0);

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 18, 1:47 PM (18 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15863053
Default Alt Text
D38265.diff (1 KB)

Event Timeline