Skip to contentSkip to conversation

cramfs voodoo

U-Boot-Users New Haavard Skinnemoen 1 participant 2 messages Nov 24, 2007

lore
Share & tools
lore
#0 lore raw

Does anyone know why the following deep voodoo magic in include/cramfs/cramfs_fs.h is needed?

#define CRAMFS_GET_NAMELEN(x) (((u8*)(x))[8] & 0x3f)

#define CRAMFS_GET_OFFSET(x)	((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) |\
				 ((((u32*)(x))[2] & 0xc0000000) >> 30))
#define CRAMFS_SET_NAMELEN(x,y)	(((u8*)(x))[8] = (((0x3f & (y))) | \
						  (0xc0 & ((u8*)(x))[8])))
#define CRAMFS_SET_OFFSET(x,y)	(((u32*)(x))[2] = (((y) & 3) << 30) | \
				 CRAMFS_24((((y) & 0x03ffffff) >> 2)) | \
				 (((u32)(((u8*)(x))[8] & 0x3f)) << 24))

It looks like a workaround for buggy bitfield handling in the compiler, but newer versions of gcc are not@all happy with it and spews warnings like this:

cramfs.c:82: warning: dereferencing type-punned pointer will break strict-aliasing rules

which indicates that the generated code is probably wrong.

Can we get rid of it somehow?

Haavard

#1 lore raw

PATCH 1/1 Make CRAMFS optional (was Re: cramfs voodoo)

Quoted 1 line · On Sat, 24 Nov 2007 22:20:14 +0100 Haavard Skinnemoen <[email protected]>…

Can we get rid of it somehow?

Actually, I think I'd rather get rid of cramfs altogether. How do everyone feel about something like this?

==============[cut here]==============