[systemd-devel] PATCH: fix sparse warnings

Frederic Crozat fcrozat at suse.com
Mon Mar 19 06:48:57 PDT 2012


Le vendredi 16 mars 2012 à 14:32 +0100, Frederic Crozat a écrit :
> Le mercredi 14 mars 2012 à 11:36 -0700, Josh Triplett a écrit :
> > On Wed, Mar 14, 2012 at 06:58:32PM +0100, Lennart Poettering wrote:
> > > On Wed, 07.03.12 06:34, Josh Triplett (josh at joshtriplett.org) wrote:
> > > > I've attached a header file which should provide all the endianness
> > > > checking you need.  Just include it in place of endian.h everywhere you
> > > > currently include endian.h.  I stuck an all-permissive MIT license on
> > > > it, for maximum possible reuse.
> > > 
> > > This looks really cool! Thanks a lot for this. One comment, before we
> > > stick this into systemd:
> > > 
> > > > #ifndef SPARSE_ENDIAN_H
> > > > #define SPARSE_ENDIAN_H
> > > > 
> > > > #include <endian.h>
> > > > #include <stdint.h>
> > > > 
> > > > #ifdef __CHECKER__
> > > > #define __bitwise __attribute__((bitwise))
> > > > #define __force __attribute__((force))
> > > > #else
> > > > #define __bitwise
> > > > #define __force
> > > > #endif
> > > > 
> > > > typedef uint16_t __bitwise le16;
> > > > typedef uint16_t __bitwise be16;
> > > > typedef uint32_t __bitwise le32;
> > > > typedef uint32_t __bitwise be32;
> > > > typedef uint64_t __bitwise le64;
> > > > typedef uint64_t __bitwise be64;
> > > 
> > > Can we add a suffix _t here? I much prefer le16_t over le16, since this
> > > is a type.
> > 
> > Sure, feel free.  I used the unsuffixed names to match the kernel's type
> > names and the names used in the conversion functions, but the endianness
> > checking will obviously work with whatever names you prefer. :)
> > 
> > The following sed line will give you the names you want:
> > 
> > sed -i 's/\<[bl]e\(16\|32\|64\)\>/&_t/g' sparse-endian.h
> 
> Here is a patch integrating your header (modified as wanted by Lennart)
> and the changes in various locations of journal to use le64_t.
> 
> It also fixes some potential endianness errors, please review it
> carefully.

Quick follow-up on this patch :

I've tested patched systemd on both x86 and ppc, reading journals
generated from one platform on the other and vice-versa and it worked
fine.

So, with this patch, it seems we fixed the last endianness issue in
journal code.
-- 
Frederic Crozat <fcrozat at suse.com>
SUSE



More information about the systemd-devel mailing list