mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ira W. Snyder" <iws@ovro.caltech.edu>
To: alacrityvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] shm_signal: clearly specify endianness
Date: Tue,  8 Dec 2009 12:57:33 -0800	[thread overview]
Message-ID: <1260305854-31472-5-git-send-email-iws@ovro.caltech.edu> (raw)
In-Reply-To: <1260305854-31472-1-git-send-email-iws@ovro.caltech.edu>

The shm_signal code uses structures which are designed to be shared between
disparate systems, such as 32-bit and 64-bit, as well as Linux and Windows.

Since shm_signal is primarily intended to be used by qemu/kvm, which
supports virtual guests with a different CPU architecture than the host,
clearly define an endianness for the shared structures.

The endianness is defined to be little-endian, to avoid byte swapping in
the most common case: x86.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
---
 include/linux/shm_signal.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/shm_signal.h b/include/linux/shm_signal.h
index 21cf750..b2efd72 100644
--- a/include/linux/shm_signal.h
+++ b/include/linux/shm_signal.h
@@ -32,8 +32,8 @@
  *-----------
  */
 
-#define SHM_SIGNAL_MAGIC 0x58fa39df
-#define SHM_SIGNAL_VER   1
+#define SHM_SIGNAL_MAGIC cpu_to_le32(0x58fa39df)
+#define SHM_SIGNAL_VER   cpu_to_le32(1)
 
 struct shm_signal_irq {
 	__u8                  enabled;
@@ -47,8 +47,8 @@ enum shm_signal_locality {
 };
 
 struct shm_signal_desc {
-	__u32                 magic;
-	__u32                 ver;
+	__le32                 magic;
+	__le32                 ver;
 	struct shm_signal_irq irq[2];
 };
 
-- 
1.5.4.3


  parent reply	other threads:[~2009-12-08 20:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 20:57 alacrityvm-next: clearly specify ioq endianness Ira W. Snyder
2009-12-08 20:57 ` [PATCH] vbus: fix lots of sparse "dubious signed bitfield" warnings Ira W. Snyder
2009-12-08 20:57 ` [PATCH] vbus: pci-bridge: fix sparse warnings Ira W. Snyder
2009-12-08 20:57 ` [PATCH] vbus-enet: " Ira W. Snyder
2009-12-08 20:57 ` Ira W. Snyder [this message]
2009-12-08 20:57 ` [PATCH] ioq: clearly specify endianness Ira W. Snyder
2009-12-09 18:17 ` [Alacrityvm-devel] alacrityvm-next: clearly specify ioq endianness Gregory Haskins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260305854-31472-5-git-send-email-iws@ovro.caltech.edu \
    --to=iws@ovro.caltech.edu \
    --cc=alacrityvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®