RE: [07/22] Cyclades PC300 driver: ioctl() fixes for mixed 64/32-bit systems

From: David Laight
Date: Mon Jan 30 2012 - 06:44:34 EST



> +struct pc300_net_stats {
> + u64 rx_packets;
...
> + u64 rx_compressed;
> + u64 tx_compressed;
> +};
> +
> typedef struct pc300stats {
> int hw_type;
> u32 line_on;
> u32 line_off;
> - struct net_device_stats gen_stats;
> + /* Use this instead of net_device_stats, since passing
> + * net_device_stats breaks 32-bit user processes on
> 64-bit kernels,
> + * and rtnetlink is unreasonably complicated just to get
> + * some statistics.
> + */
> + struct pc300_net_stats net_stats;
> falc_t te_stats;
> } pc300stats_t;

Since 'struct net_device_stats' looks like a common structure,
maybe the 64bit version should be added in the same place??

...
> +struct pc300hw_user {
> + int type; /* RSV, X21, etc. */
> + int bus; /* Bus (PCI, PMC, etc.) */
> + int nchan; /* number of channels */
> + int irq; /* interrupt request level */
> + u32 clock; /* Board clock */
> + u8 cpld_id; /* CPLD ID (TE only) */
> + u16 cpld_reg1; /* CPLD reg 1 (TE only) */

You should probably make all the fields fixed sized types and
ensure there is no implicit padding added between fields.

David


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/