Skip to contentSkip to conversation

byteorder of image_header_t members?

U-Boot-Users Applied Steven Scholz 2 participants 5 messages Jun 10, 2005 – Mar 12, 2006

lore
Share & tools
lore
#0 lore raw

Hi there,

if uint32_t members of image_header_t are stored in network byteorder, then all references of these members should use ntohl(), right?

So should we fix this for instance:

#~> grep "\->ih_magic" *
cmd_autoscript.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {
cmd_bootm.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {

Quoted 1 line
Quoted 1 line
Quoted 1 line

cmd_bootm.c: if (hdr->ih_magic != IH_MAGIC) { <<<

cmd_bootm.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {
cmd_bootm.c: (ntohl(hdr->ih_magic) != IH_MAGIC))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

cmd_doc.c: if (hdr->ih_magic == IH_MAGIC) { <<<
cmd_fdc.c: if (hdr->ih_magic != IH_MAGIC) { <<<

cmd_fpga.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {
cmd_ide.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {
cmd_nand.c: if (ntohl(hdr->ih_magic) == IH_MAGIC) {
cmd_scsi.c: if (ntohl(hdr->ih_magic) == IH_MAGIC) {
cmd_usb.c: if (ntohl(hdr->ih_magic) != IH_MAGIC) {

Signature · 1 line
Steven
#1 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

if uint32_t members of image_header_t are stored in network byteorder, then all references of these members should use ntohl(), right?

Right.

Quoted 3 lines

So should we fix this for instance:

Quoted 1 line
Quoted 1 line
Quoted 1 line

cmd_bootm.c: if (hdr->ih_magic != IH_MAGIC) { <<<

Done.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

cmd_doc.c: if (hdr->ih_magic == IH_MAGIC) { <<<
cmd_fdc.c: if (hdr->ih_magic != IH_MAGIC) { <<<

Looking forward to see your patch... :-)

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
As far as the laws of mathematics refer to reality, they are not cer-
tain, and as far as they are certain, they do not refer  to  reality.
                                                   -- Albert Einstein
#2 lore raw
In reply to Steven Scholz

Hi there,

Quoted 4 lines · I wrote:

if uint32_t members of image_header_t are stored in network byteorder, then all references of these members should use ntohl(), right?

So should we fix this for instance:

Maybe you want to consider the attached patch.

* Patch by Steven Scholz, 10 Jun 2005:
Adding loads of ntohl() in image header handling (for the sake of readability)

--
Steven

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: u-boot_htonl.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20050610/f9900e57/attachment.txt

#3 lore raw

Hi,

Quoted 5 lines · I wrote:

Maybe you want to consider the attached patch.

* Patch by Steven Scholz, 10 Jun 2005:
Adding loads of ntohl() in image header handling (for the sake of readability)

Still in the patch queue? Or rejected/discarded?

--
Steven

#4 lore raw
In reply to Steven Scholz
Quoted 4 lines · In message <[email protected]> you wrote:

* Patch by Steven Scholz, 10 Jun 2005:
Adding loads of ntohl() in image header handling (for the sake of readability)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
                - Mark Twain