Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1ca31ae7cfed3e2a8e48fbf6ed6cac06495b6158
Commit:     1ca31ae7cfed3e2a8e48fbf6ed6cac06495b6158
Parent:     2aef469a35a273609beaa7094d5a07c1f6d75285
Author:     Kristian Høgsberg <[EMAIL PROTECTED]>
AuthorDate: Thu May 31 11:16:43 2007 -0400
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Thu May 31 21:40:15 2007 +0200

    firewire: Change struct fw_cdev_iso_packet to not use bitfields.
    
    The struct is part of the userspace interface and can not use
    bitfields.  This patch replaces the bitfields with a __u32 'control'
    word and provides access macros to set the bits.
    
    Signed-off-by: Kristian Høgsberg <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
---
 drivers/firewire/fw-cdev.c    |   17 ++++++++++++++++-
 include/linux/firewire-cdev.h |   14 ++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 3ab3585..5d402d6 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -677,12 +677,21 @@ static int ioctl_create_iso_context(struct client 
*client, void *buffer)
        return 0;
 }
 
+/* Macros for decoding the iso packet control header. */
+#define GET_PAYLOAD_LENGTH(v)  ((v) & 0xffff)
+#define GET_INTERRUPT(v)       (((v) >> 16) & 0x01)
+#define GET_SKIP(v)            (((v) >> 17) & 0x01)
+#define GET_TAG(v)             (((v) >> 18) & 0x02)
+#define GET_SY(v)              (((v) >> 20) & 0x04)
+#define GET_HEADER_LENGTH(v)   (((v) >> 24) & 0xff)
+
 static int ioctl_queue_iso(struct client *client, void *buffer)
 {
        struct fw_cdev_queue_iso *request = buffer;
        struct fw_cdev_iso_packet __user *p, *end, *next;
        struct fw_iso_context *ctx = client->iso_context;
        unsigned long payload, buffer_end, header_length;
+       u32 control;
        int count;
        struct {
                struct fw_iso_packet packet;
@@ -717,8 +726,14 @@ static int ioctl_queue_iso(struct client *client, void 
*buffer)
        end = (void __user *)p + request->size;
        count = 0;
        while (p < end) {
-               if (__copy_from_user(&u.packet, p, sizeof(*p)))
+               if (get_user(control, &p->control))
                        return -EFAULT;
+               u.packet.payload_length = GET_PAYLOAD_LENGTH(control);
+               u.packet.interrupt = GET_INTERRUPT(control);
+               u.packet.skip = GET_SKIP(control);
+               u.packet.tag = GET_TAG(control);
+               u.packet.sy = GET_SY(control);
+               u.packet.header_length = GET_HEADER_LENGTH(control);
 
                if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
                        header_length = u.packet.header_length;
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index d4455eb..efbe1fd 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -198,13 +198,15 @@ struct fw_cdev_create_iso_context {
        __u32 handle;
 };
 
+#define FW_CDEV_ISO_PAYLOAD_LENGTH(v)  (v)
+#define FW_CDEV_ISO_INTERRUPT          (1 << 16)
+#define FW_CDEV_ISO_SKIP               (1 << 17)
+#define FW_CDEV_ISO_TAG(v)             ((v) << 18)
+#define FW_CDEV_ISO_SY(v)              ((v) << 20)
+#define FW_CDEV_ISO_HEADER_LENGTH(v)   ((v) << 24)
+
 struct fw_cdev_iso_packet {
-       __u16 payload_length;   /* Length of indirect payload. */
-       __u32 interrupt : 1;    /* Generate interrupt on this packet */
-       __u32 skip : 1;         /* Set to not send packet at all. */
-       __u32 tag : 2;
-       __u32 sy : 4;
-       __u32 header_length : 8;        /* Length of immediate header. */
+       __u32 control;
        __u32 header[0];
 };
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to