Hi Ralf,
I performed the command for both the LE and BE.
The resulting files indeed show a difference near the lines where it goes wrong.
But not sure what to change to get a bit further.
Little Endian:
First the unchanged command:
Code:
cd /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28
/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPSEL -DBUG_ALIGNMENT -G 0 -mno-abicalls -fno-pic -mlong-calls -Wa,--trap -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -finline-limit=100000 -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__LITTLE_ENDIAN_BYTEORDER -D__LITTLE_ENDIAN_BITFIELD -D__LITTLE_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls -O2 -c -o build_freetz/netdisk/udev.o netdisk/udev.c
netdisk/udev.c: In function 'v_udev_connecting_func':
netdisk/udev.c:1257:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'udev_write_dib':
netdisk/udev.c:1478:21: warning: variable 'ioreq' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_atapi_process':
netdisk/udev.c:1862:13: warning: variable 'lunsize' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:2149:12: warning: variable 'bufferoffset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_check_passthrough':
netdisk/udev.c:3017:11: warning: variable 'sector_offset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3251:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3275:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_process':
netdisk/udev.c:4501:27: warning: variable 'modeH' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:4498:12: warning: variable 'parameterlen' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:4956:76: warning: array subscript is above array bounds [-Warray-bounds]
The changed command (-E)
Code:
/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPSEL -DBUG_ALIGNMENT -G 0 -mno-abicalls -fno-pic -mlong-calls -Wa,--trap -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -finline-limit=100000 -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__LITTLE_ENDIAN_BYTEORDER -D__LITTLE_ENDIAN_BITFIELD -D__LITTLE_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls -O2 -E -o build_freetz/netdisk/udev.i-le netdisk/udev.c
In the resulting udev.i-le the line where the BE goes wrong is at 12973 (search for readCapacityData.LogicalBlockAddress)
Big Endian:
In the resulting udev.i-be the line where the first error is shown (error: 'else' without a previous 'if') is at 12982
If I open the udev.i-xx files with Notepad++ I see a difference in the pairs of {}
udev.i-be (line 12977 to 12980):
if(logicalBlockAddress < 0xffffffff) {
*&readCapacityData.LogicalBlockAddress = *&logicalBlockAddress; };
do {} while(0);
do {} while(0);
udev.i-le (line 12968 to 12971):
if(logicalBlockAddress < 0xffffffff) {
{ PFOUR_BYTE d = (PFOUR_BYTE)(&readCapacityData.LogicalBlockAddress); PFOUR_BYTE s = (PFOUR_BYTE)(&logicalBlockAddress); d->bytes.Byte3 = s->bytes.Byte0; d->bytes.Byte2 = s->bytes.Byte1; d->bytes.Byte1 = s->bytes.Byte2; d->bytes.Byte0 = s->bytes.Byte3; };
do {} while(0);
do {} while(0);
udev.c (line 4176 to 4179):
if(logicalBlockAddress < 0xffffffff) {
REVERSE_BYTES_32(&readCapacityData.LogicalBlockAddress, &logicalBlockAddress);
debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress ORGINAL 0x%x", logicalBlockAddress);
debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress 0x%x", readCapacityData.LogicalBlockAddress);
Edit1 (13-10-2013: 1:08am):
Looks it goes wrong with the REVERSE_BYTES_32 function.
I did a 'grep -i REVERSE_BYTES_32 *, grep -i REVERSE_BYTES_32 */*, grep -i REVERSE_BYTES_32 */*/*' and only found 3 lines in udev.c. Where should this function be defined? (see below)
Same is true for the REVERSE_BYTES_64 function a few lines below (udev.c line 4214, udev.i-le line 13006, udev.i-be line 13015).