~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/virtio_byteorder.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_VIRTIO_BYTEORDER_H
  2 #define _LINUX_VIRTIO_BYTEORDER_H
  3 #include <linux/types.h>
  4 #include <uapi/linux/virtio_types.h>
  5 
  6 static inline bool virtio_legacy_is_little_endian(void)
  7 {
  8 #ifdef __LITTLE_ENDIAN
  9         return true;
 10 #else
 11         return false;
 12 #endif
 13 }
 14 
 15 static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val)
 16 {
 17         if (little_endian)
 18                 return le16_to_cpu((__force __le16)val);
 19         else
 20                 return be16_to_cpu((__force __be16)val);
 21 }
 22 
 23 static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val)
 24 {
 25         if (little_endian)
 26                 return (__force __virtio16)cpu_to_le16(val);
 27         else
 28                 return (__force __virtio16)cpu_to_be16(val);
 29 }
 30 
 31 static inline u32 __virtio32_to_cpu(bool little_endian, __virtio32 val)
 32 {
 33         if (little_endian)
 34                 return le32_to_cpu((__force __le32)val);
 35         else
 36                 return be32_to_cpu((__force __be32)val);
 37 }
 38 
 39 static inline __virtio32 __cpu_to_virtio32(bool little_endian, u32 val)
 40 {
 41         if (little_endian)
 42                 return (__force __virtio32)cpu_to_le32(val);
 43         else
 44                 return (__force __virtio32)cpu_to_be32(val);
 45 }
 46 
 47 static inline u64 __virtio64_to_cpu(bool little_endian, __virtio64 val)
 48 {
 49         if (little_endian)
 50                 return le64_to_cpu((__force __le64)val);
 51         else
 52                 return be64_to_cpu((__force __be64)val);
 53 }
 54 
 55 static inline __virtio64 __cpu_to_virtio64(bool little_endian, u64 val)
 56 {
 57         if (little_endian)
 58                 return (__force __virtio64)cpu_to_le64(val);
 59         else
 60                 return (__force __virtio64)cpu_to_be64(val);
 61 }
 62 
 63 #endif /* _LINUX_VIRTIO_BYTEORDER */
 64 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp