On 5/16/07, Urs Thuermann <[EMAIL PROTECTED]> wrote:
This patch adds the CAN core functionality but no protocols or drivers.
No protocol implementations are included here.  They come as separate
patches.  Protocol numbers are already in include/linux/can.h.

Signed-Off-By: Oliver Hartkopp <[EMAIL PROTECTED]>
Signed-Off-By: Urs Thuermann <[EMAIL PROTECTED]>

<SNIP>

+
+/**
+ * struct sockaddr_can - the sockaddr structure for CAN sockets
+ * @can_family:  address family number AF_CAN.
+ * @can_ifindex: CAN network interface index.
+ * @can_addr:    transport protocol specific address, mostly CAN IDs.
+ */
+struct sockaddr_can {
+       sa_family_t can_family;
+       int         can_ifindex;
+       union {
+               struct { canid_t rx_id, tx_id; } tp16;
+               struct { canid_t rx_id, tx_id; } tp20;
+               struct { canid_t rx_id, tx_id; } mcnet;
+               struct { canid_t rx_id, tx_id; } isotp;
+               struct { int     lcu,   type;  } bap;
+       } can_addr;
+};

Can can_ifindex be turned into a unsigned short? That way we would
have it nicely packed, avoiding this hole:

[EMAIL PROTECTED] examples]$ pahole can
/* <1c2> /home/acme/git/pahole/examples/can.c:5 */
struct sockaddr_can {
        sa_family_t                can_family;    /*     0     2 */

        /* XXX 2 bytes hole, try to pack */

        int                        can_ifindex;   /*  4  4 */
        union {
                struct {
                        canid_t    rx_id;         /*  8  4 */
                        canid_t    tx_id;         /* 12  4 */
                } tp16;                           /*     8 */
                struct {
                        canid_t    rx_id;         /*  8  4 */
                        canid_t    tx_id;         /* 12  4 */
                } tp20;                           /*     8 */
                struct {
                        canid_t    rx_id;         /*  8  4 */
                        canid_t    tx_id;         /* 12  4 */
                } mcnet;                          /*     8 */
                struct {
                        canid_t    rx_id;         /*  8  4 */
                        canid_t    tx_id;         /* 12  4 */
                } isotp;                          /*     8 */
                struct {
                        int        lcu;           /*  8  4 */
                        int        type;          /* 12  4 */
                } bap;                            /*     8 */
        } can_addr;                               /*  8  8 */
}; /* size: 16, cachelines: 1 */
  /* sum members: 14, holes: 1, sum holes: 2 */
  /* last cacheline: 16 bytes */
  /* definitions: 1 */

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to