]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
include: Endian fix for shared kernel/user headers
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 2 Sep 2019 19:21:17 +0000 (21:21 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 5 Sep 2019 08:49:48 +0000 (10:49 +0200)
commit743ed43a785795412cdda16e3d25b12cb9228a32
treed7ca959b96ace27c662cab04ddd0fe3bac928564
parent4a1ab1077dc2ec19e9bc76c309620ed50e6c5be6
include: Endian fix for shared kernel/user headers

Endian swapping is done differently in kernel space vs. user space,
but a few header files are shared between those two user cases.

Current code attempts to handle this by re-defining __le16/32/64
before pulling those headers into user space, but this is not
consistenly done: when ceph_fs.h is included via types.h, the
redefinition happens, but when ceph_fs.h is directly included,
the redefinition does not happen.

Fix this by performing the same redefinition directly *in* those
shared headers, when included by user space.

Note that the redefines where also in effect for rbd_types.h,
which is *not* shared with the kernel, so in the file I'm simply
replacing __le16/32/64 with ceph_le16/32/64 in-line.

Also note that it is now no longer possible to include any of
the three files using the redefined macros in C code (as they
make use of C++ features).  However, this currently happens in
exactly one file, src/mds/locks.c, which only uses a few CEPH_CAP_...
constants from the header. To fix this, I've simply duplicated
those definitions, which are unchangeable ABI constants anyway.

Fixes (partially): https://tracker.ceph.com/issues/41605

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
src/include/ceph_fs.h
src/include/msgr.h
src/include/rados.h
src/include/rbd_types.h
src/include/types.h
src/mds/locks.c