I've a variable
__be32 x;
I've a function
__u32 foo(void){
__u32 a;
return a;
}
I need to store the return of foo in variable x
.
x=htonl(foo());
Is it correct?
I've a confusion that what are the return types of ntohl()
and htonl()
. Are they opposite of each other?
To check the output, I need to recompile the kernel and I don't want to trouble my system with any errors. So I'm asking here.
You can use the macros defined in kernel.h:
http://www.bruceblinn.com/linuxinfo/ByteOrder.html