LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-kernel@vger.kernel.org, Pieter Palmers <pieterp@joow.be>,
	Dan Dennedy <dan@dennedy.org>,
	linux1394-devel@lists.sourceforge.net
Subject: Re: compat_ioctl (was [PATCH update] ieee1394: cycle timer read extension for raw1394/libraw1394)
Date: Sat, 10 Feb 2007 16:47:56 +0100	[thread overview]
Message-ID: <200702101647.59339.arnd@arndb.de> (raw)
In-Reply-To: <45CDD490.2020004@s5r6.in-berlin.de>

On Saturday 10 February 2007 15:20, Stefan Richter wrote:
> 
> I wrote on 2007-02-03:
> > +#define RAW1394_IOC_GET_CYCLE_TIMER          \
> > +     _IOR ('#', 0x30, struct raw1394_cycle_timer)
> ...
> > +/* argument to RAW1394_IOC_GET_CYCLE_TIMER ioctl */
> > +struct raw1394_cycle_timer {
> > +     /* contents of Isochronous Cycle Timer register,
> > +        as in OHCI 1.1 clause 5.13 (also with non-OHCI hosts) */
> > +     __u32 cycle_timer;
> > +
> > +     /* local time in microseconds since Epoch,
> > +        simultaneously read with cycle timer */
> > +     __u64 local_time;
> > +};
> >  #endif /* IEEE1394_RAW1394_H */
> 
> Hmm, is this struct padded on 64bit platforms?
> If so, would
>         struct raw1394_cycle_timer {
>                 __u64 local_time;
>                 __u32 cycle_timer;
>         };
> be padded too?

If one of these two is padded on a given CPU, the other one is as well,
because the structure alignment is defined as the maximum alignment
of one of its members (this is needed so that arrays work).

Both are padded on all 64 bit architectures that Linux runs on, but
on x86, you get the extra twist that the 32 bit version does not
have padding. To express the right structure for compat mode, you 
need something like

#ifdef __x86_64__
typedef u64 compat_u64 __attribute__((packed, aligned(4)));
#else
typedef u64 compat_u64;
#endif
struct raw1394_cycle_timer {
        compat_u64 local_time;
        u32 cycle_timer;
};

	Arnd <><

      reply	other threads:[~2007-02-10 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <45BA5CFD.6070900@joow.be>
2007-01-27 10:21 ` [RFC] cycle timer read extension for raw1394/libraw1394 Stefan Richter
2007-01-27 10:45   ` Pieter Palmers
2007-01-27 12:48     ` Stefan Richter
2007-02-03 12:58       ` [PATCH update] ieee1394: " Stefan Richter
2007-02-03 13:42         ` which header for local_irq_save? (was Re: [PATCH update] ieee1394: cycle timer read extension for raw1394/libraw1394) Stefan Richter
2007-02-03 14:22         ` [PATCH update] ieee1394: cycle timer read extension for raw1394/libraw1394 Pieter Palmers
2007-02-03 15:32           ` Stefan Richter
2007-02-04 12:55             ` Pieter Palmers
2007-02-03 16:42         ` Stefan Richter
2007-02-03 19:03         ` Stefan Richter
2007-02-03 20:18           ` Pieter Palmers
2007-02-10 14:20         ` compat_ioctl (was [PATCH update] ieee1394: cycle timer read extension for raw1394/libraw1394) Stefan Richter
2007-02-10 15:47           ` Arnd Bergmann [this message]

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=200702101647.59339.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=dan@dennedy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=pieterp@joow.be \
    --cc=stefanr@s5r6.in-berlin.de \
    --subject='Re: compat_ioctl (was [PATCH update] ieee1394: cycle timer read extension for raw1394/libraw1394)' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).