mirror of
https://github.com/apache/nuttx.git
synced 2025-12-07 18:12:33 +08:00
net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
@@ -221,8 +221,8 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
/* From this, we can get the offset to the list of relocation entries */
|
||||
|
||||
offset = ntohl(hdr->h_relocstart);
|
||||
nrelocs = ntohs(hdr->h_reloccount);
|
||||
offset = NTOHL(hdr->h_relocstart);
|
||||
nrelocs = NTOHS(hdr->h_reloccount);
|
||||
binfo("offset: %08lx nrelocs: %d\n", (long)offset, nrelocs);
|
||||
|
||||
/* The value of the relocation list that we get from the header is a
|
||||
@@ -395,8 +395,8 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
* this module and the number of symbols imported by this module.
|
||||
*/
|
||||
|
||||
offset = ntohl(hdr->h_importsymbols);
|
||||
nimports = ntohs(hdr->h_importcount);
|
||||
offset = NTOHL(hdr->h_importsymbols);
|
||||
nimports = NTOHS(hdr->h_importcount);
|
||||
binfo("Imports offset: %08" PRIx32 " nimports: %d\n", offset, nimports);
|
||||
|
||||
/* The import[] table resides within the D-Space allocation. If
|
||||
|
||||
@@ -137,9 +137,9 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* network order.
|
||||
*/
|
||||
|
||||
datastart = ntohl(loadinfo->header.h_datastart);
|
||||
dataend = ntohl(loadinfo->header.h_dataend);
|
||||
bssend = ntohl(loadinfo->header.h_bssend);
|
||||
datastart = NTOHL(loadinfo->header.h_datastart);
|
||||
dataend = NTOHL(loadinfo->header.h_dataend);
|
||||
bssend = NTOHL(loadinfo->header.h_bssend);
|
||||
|
||||
/* And put this information into the loadinfo structure as well.
|
||||
*
|
||||
@@ -150,12 +150,12 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* bsssize = the address range from dataend up to bssend.
|
||||
*/
|
||||
|
||||
loadinfo->entryoffs = ntohl(loadinfo->header.h_entry);
|
||||
loadinfo->entryoffs = NTOHL(loadinfo->header.h_entry);
|
||||
loadinfo->isize = datastart;
|
||||
|
||||
loadinfo->datasize = dataend - datastart;
|
||||
loadinfo->bsssize = bssend - dataend;
|
||||
loadinfo->stacksize = ntohl(loadinfo->header.h_stacksize);
|
||||
loadinfo->stacksize = NTOHL(loadinfo->header.h_stacksize);
|
||||
|
||||
/* This is the initial dspace size. We'll re-calculate this later
|
||||
* after the memory has been allocated.
|
||||
@@ -167,7 +167,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* this later).
|
||||
*/
|
||||
|
||||
loadinfo->relocstart = ntohl(loadinfo->header.h_relocstart);
|
||||
loadinfo->relocstart = NTOHL(loadinfo->header.h_relocstart);
|
||||
loadinfo->reloccount = ntohs(loadinfo->header.h_reloccount);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user