[rtems commit] nfsclient: Fix for short enums

Sebastian Huber sebh at rtems.org
Tue Oct 2 13:24:03 UTC 2012


Module:    rtems
Branch:    master
Commit:    3becac2ca38bb01d31564a9bd854d5a4b41e456b
Changeset: http://git.rtems.org/rtems/commit/?id=3becac2ca38bb01d31564a9bd854d5a4b41e456b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Oct  2 09:37:39 2012 +0200

nfsclient: Fix for short enums

The XDR library has a problem on architectures with short enums like the
default ARM EABI.  Short enums means that the size of the enum type is
variable and the smallest integer type to hold all enum values will be
selected.  For many enums this is char.  The XDR library uses int32_t
for enum_t.  There are several evil casts from an enum type to enum_t
which leads to invalid memory accesses on short enum architectures.  A
workaround is to add appropriate dummy enum values.

---

 cpukit/libfs/src/nfsclient/proto/nfs_prot.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cpukit/libfs/src/nfsclient/proto/nfs_prot.h b/cpukit/libfs/src/nfsclient/proto/nfs_prot.h
index de812db..054a77e 100644
--- a/cpukit/libfs/src/nfsclient/proto/nfs_prot.h
+++ b/cpukit/libfs/src/nfsclient/proto/nfs_prot.h
@@ -48,6 +48,7 @@ enum nfsstat {
 	NFSERR_DQUOT = 69,
 	NFSERR_STALE = 70,
 	NFSERR_WFLUSH = 99,
+  _NFSSTAT = 0xffffffff
 };
 typedef enum nfsstat nfsstat;
 
@@ -61,6 +62,7 @@ enum ftype {
 	NFSOCK = 6,
 	NFBAD = 7,
 	NFFIFO = 8,
+  _FTYPE = 0xffffffff
 };
 typedef enum ftype ftype;
 




More information about the vc mailing list