sim-card
/
qemu
Archived
10
0
Fork 0

Use new macro QEMU_PACKED for packed structures

Most changes were made using these commands:

git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__((__packed__))'|xargs perl -pi -e 's/__attribute__\(\(__packed__\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((__packed__))'|xargs perl -pi -e 's/__attribute__ \(\(__packed__\)\)/QEMU_PACKED/'
git grep -la '__attribute((packed))'|xargs perl -pi -e 's/__attribute\(\(packed\)\)/QEMU_PACKED/'

Whitespace in linux-user/syscall_defs.h was fixed manually
to avoid warnings from scripts/checkpatch.pl.

Manual changes were also applied to hw/pc.c.

I did not fix indentation with tabs in block/vvfat.c.
The patch will show 4 errors with scripts/checkpatch.pl.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Stefan Weil 2011-08-31 12:38:01 +02:00 committed by Blue Swirl
parent 0f7fdd3475
commit 541dc0d47f
36 changed files with 259 additions and 259 deletions

View File

@ -151,7 +151,7 @@ struct external_lineno {
#define E_FILNMLEN 14 /* # characters in a file name */ #define E_FILNMLEN 14 /* # characters in a file name */
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
struct __attribute__((packed)) external_syment struct QEMU_PACKED external_syment
{ {
union { union {
char e_name[E_SYMNMLEN]; char e_name[E_SYMNMLEN];

View File

@ -1327,7 +1327,7 @@ struct partition {
uint8_t end_cyl; /* end cylinder */ uint8_t end_cyl; /* end cylinder */
uint32_t start_sect; /* starting sector counting from 0 */ uint32_t start_sect; /* starting sector counting from 0 */
uint32_t nr_sects; /* nr of sectors in partition */ uint32_t nr_sects; /* nr of sectors in partition */
} __attribute__((packed)); } QEMU_PACKED;
/* try to guess the disk logical geometry from the MSDOS partition table. Return 0 if OK, -1 if could not guess */ /* try to guess the disk logical geometry from the MSDOS partition table. Return 0 if OK, -1 if could not guess */
static int guess_disk_lchs(BlockDriverState *bs, static int guess_disk_lchs(BlockDriverState *bs,

View File

@ -43,7 +43,7 @@ struct parallels_header {
uint32_t catalog_entries; uint32_t catalog_entries;
uint32_t nb_sectors; uint32_t nb_sectors;
char padding[24]; char padding[24];
} __attribute__((packed)); } QEMU_PACKED;
typedef struct BDRVParallelsState { typedef struct BDRVParallelsState {

View File

@ -26,7 +26,7 @@
#include "block_int.h" #include "block_int.h"
#include "block/qcow2.h" #include "block/qcow2.h"
typedef struct __attribute__((packed)) QCowSnapshotHeader { typedef struct QEMU_PACKED QCowSnapshotHeader {
/* header is 8 byte aligned */ /* header is 8 byte aligned */
uint64_t l1_table_offset; uint64_t l1_table_offset;

View File

@ -56,7 +56,7 @@ typedef struct {
int64_t grain_offset; int64_t grain_offset;
char filler[1]; char filler[1];
char check_bytes[4]; char check_bytes[4];
} __attribute__((packed)) VMDK4Header; } QEMU_PACKED VMDK4Header;
#define L2_CACHE_SIZE 16 #define L2_CACHE_SIZE 16

View File

@ -200,7 +200,7 @@ static int array_index(array_t* array, void* pointer)
} }
/* These structures are used to fake a disk and the VFAT filesystem. /* These structures are used to fake a disk and the VFAT filesystem.
* For this reason we need to use __attribute__((packed)). */ * For this reason we need to use QEMU_PACKED. */
typedef struct bootsector_t { typedef struct bootsector_t {
uint8_t jump[3]; uint8_t jump[3];
@ -224,7 +224,7 @@ typedef struct bootsector_t {
uint8_t signature; uint8_t signature;
uint32_t id; uint32_t id;
uint8_t volume_label[11]; uint8_t volume_label[11];
} __attribute__((packed)) fat16; } QEMU_PACKED fat16;
struct { struct {
uint32_t sectors_per_fat; uint32_t sectors_per_fat;
uint16_t flags; uint16_t flags;
@ -233,12 +233,12 @@ typedef struct bootsector_t {
uint16_t info_sector; uint16_t info_sector;
uint16_t backup_boot_sector; uint16_t backup_boot_sector;
uint16_t ignored; uint16_t ignored;
} __attribute__((packed)) fat32; } QEMU_PACKED fat32;
} u; } u;
uint8_t fat_type[8]; uint8_t fat_type[8];
uint8_t ignored[0x1c0]; uint8_t ignored[0x1c0];
uint8_t magic[2]; uint8_t magic[2];
} __attribute__((packed)) bootsector_t; } QEMU_PACKED bootsector_t;
typedef struct { typedef struct {
uint8_t head; uint8_t head;
@ -253,7 +253,7 @@ typedef struct partition_t {
mbr_chs_t end_CHS; mbr_chs_t end_CHS;
uint32_t start_sector_long; uint32_t start_sector_long;
uint32_t length_sector_long; uint32_t length_sector_long;
} __attribute__((packed)) partition_t; } QEMU_PACKED partition_t;
typedef struct mbr_t { typedef struct mbr_t {
uint8_t ignored[0x1b8]; uint8_t ignored[0x1b8];
@ -261,7 +261,7 @@ typedef struct mbr_t {
uint8_t ignored2[2]; uint8_t ignored2[2];
partition_t partition[4]; partition_t partition[4];
uint8_t magic[2]; uint8_t magic[2];
} __attribute__((packed)) mbr_t; } QEMU_PACKED mbr_t;
typedef struct direntry_t { typedef struct direntry_t {
uint8_t name[8]; uint8_t name[8];
@ -276,7 +276,7 @@ typedef struct direntry_t {
uint16_t mdate; uint16_t mdate;
uint16_t begin; uint16_t begin;
uint32_t size; uint32_t size;
} __attribute__((packed)) direntry_t; } QEMU_PACKED direntry_t;
/* this structure are used to transparently access the files */ /* this structure are used to transparently access the files */

View File

@ -314,7 +314,7 @@ struct virtio_9p_config
uint16_t tag_len; uint16_t tag_len;
/* Variable size tag name */ /* Variable size tag name */
uint8_t tag[0]; uint8_t tag[0];
} __attribute__((packed)); } QEMU_PACKED;
typedef struct V9fsMkState { typedef struct V9fsMkState {
V9fsPDU *pdu; V9fsPDU *pdu;

View File

@ -32,7 +32,7 @@ struct acpi_table_header {
uint32_t oem_revision; /* OEM revision number */ uint32_t oem_revision; /* OEM revision number */
char asl_compiler_id[4]; /* ASL compiler vendor ID */ char asl_compiler_id[4]; /* ASL compiler vendor ID */
uint32_t asl_compiler_revision; /* ASL compiler revision number */ uint32_t asl_compiler_revision; /* ASL compiler revision number */
} __attribute__((packed)); } QEMU_PACKED;
#define ACPI_TABLE_HDR_SIZE sizeof(struct acpi_table_header) #define ACPI_TABLE_HDR_SIZE sizeof(struct acpi_table_header)
#define ACPI_TABLE_PFX_SIZE sizeof(uint16_t) /* size of the extra prefix */ #define ACPI_TABLE_PFX_SIZE sizeof(uint16_t) /* size of the extra prefix */

332
hw/bt.h

File diff suppressed because it is too large Load Diff

View File

@ -59,13 +59,13 @@ struct hpet_fw_entry
uint64_t address; uint64_t address;
uint16_t min_tick; uint16_t min_tick;
uint8_t page_prot; uint8_t page_prot;
} __attribute__ ((packed)); } QEMU_PACKED;
struct hpet_fw_config struct hpet_fw_config
{ {
uint8_t count; uint8_t count;
struct hpet_fw_entry hpet[8]; struct hpet_fw_entry hpet[8];
} __attribute__ ((packed)); } QEMU_PACKED;
extern struct hpet_fw_config hpet_cfg; extern struct hpet_fw_config hpet_cfg;
#endif #endif

View File

@ -244,13 +244,13 @@ typedef struct AHCICmdHdr {
uint32_t status; uint32_t status;
uint64_t tbl_addr; uint64_t tbl_addr;
uint32_t reserved[4]; uint32_t reserved[4];
} __attribute__ ((packed)) AHCICmdHdr; } QEMU_PACKED AHCICmdHdr;
typedef struct AHCI_SG { typedef struct AHCI_SG {
uint64_t addr; uint64_t addr;
uint32_t reserved; uint32_t reserved;
uint32_t flags_size; uint32_t flags_size;
} __attribute__ ((packed)) AHCI_SG; } QEMU_PACKED AHCI_SG;
typedef struct AHCIDevice AHCIDevice; typedef struct AHCIDevice AHCIDevice;
@ -321,7 +321,7 @@ typedef struct NCQFrame {
uint8_t reserved8; uint8_t reserved8;
uint8_t reserved9; uint8_t reserved9;
uint8_t reserved10; uint8_t reserved10;
} __attribute__ ((packed)) NCQFrame; } QEMU_PACKED NCQFrame;
void ahci_init(AHCIState *s, DeviceState *qdev, int ports); void ahci_init(AHCIState *s, DeviceState *qdev, int ports);
void ahci_uninit(AHCIState *s); void ahci_uninit(AHCIState *s);

View File

@ -557,13 +557,13 @@ static void cmd_get_event_status_notification(IDEState *s,
uint8_t reserved3[2]; uint8_t reserved3[2];
uint16_t len; uint16_t len;
uint8_t control; uint8_t control;
} __attribute__((packed)) *gesn_cdb; } QEMU_PACKED *gesn_cdb;
struct { struct {
uint16_t len; uint16_t len;
uint8_t notification_class; uint8_t notification_class;
uint8_t supported_events; uint8_t supported_events;
} __attribute((packed)) *gesn_event_header; } QEMU_PACKED *gesn_event_header;
enum notification_class_request_type { enum notification_class_request_type {
NCR_RESERVED1 = 1 << 0, NCR_RESERVED1 = 1 << 0,

View File

@ -73,7 +73,7 @@ enum {
struct vertex { struct vertex {
int x; int x;
int y; int y;
} __attribute__((packed)); } QEMU_PACKED;
struct MilkymistTMU2State { struct MilkymistTMU2State {
SysBusDevice busdev; SysBusDevice busdev;

View File

@ -78,12 +78,12 @@ struct e820_entry {
uint64_t address; uint64_t address;
uint64_t length; uint64_t length;
uint32_t type; uint32_t type;
} __attribute((__packed__, __aligned__(4))); } QEMU_PACKED __attribute((__aligned__(4)));
struct e820_table { struct e820_table {
uint32_t count; uint32_t count;
struct e820_entry entry[E820_NR_ENTRIES]; struct e820_entry entry[E820_NR_ENTRIES];
} __attribute((__packed__, __aligned__(4))); } QEMU_PACKED __attribute((__aligned__(4)));
static struct e820_table e820_table; static struct e820_table e820_table;
struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};

View File

@ -70,7 +70,7 @@ struct PXA2xxLCDState {
int orientation; int orientation;
}; };
typedef struct __attribute__ ((__packed__)) { typedef struct QEMU_PACKED {
uint32_t fdaddr; uint32_t fdaddr;
uint32_t fsaddr; uint32_t fsaddr;
uint32_t fidr; uint32_t fidr;

View File

@ -209,7 +209,7 @@ static void main_cpu_reset(void *opaque)
env->pc = s->vector; env->pc = s->vector;
} }
static struct __attribute__((__packed__)) static struct QEMU_PACKED
{ {
int mount_root_rdonly; int mount_root_rdonly;
int ramdisk_flags; int ramdisk_flags;

View File

@ -50,7 +50,7 @@ do { fprintf(stderr, "rc4030 ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } whi
typedef struct dma_pagetable_entry { typedef struct dma_pagetable_entry {
int32_t frame; int32_t frame;
int32_t owner; int32_t owner;
} __attribute__((packed)) dma_pagetable_entry; } QEMU_PACKED dma_pagetable_entry;
#define DMA_PAGESIZE 4096 #define DMA_PAGESIZE 4096
#define DMA_REG_ENABLE 1 #define DMA_REG_ENABLE 1

View File

@ -21,19 +21,19 @@
struct smbios_header { struct smbios_header {
uint16_t length; uint16_t length;
uint8_t type; uint8_t type;
} __attribute__((__packed__)); } QEMU_PACKED;
struct smbios_field { struct smbios_field {
struct smbios_header header; struct smbios_header header;
uint8_t type; uint8_t type;
uint16_t offset; uint16_t offset;
uint8_t data[]; uint8_t data[];
} __attribute__((__packed__)); } QEMU_PACKED;
struct smbios_table { struct smbios_table {
struct smbios_header header; struct smbios_header header;
uint8_t data[]; uint8_t data[];
} __attribute__((__packed__)); } QEMU_PACKED;
#define SMBIOS_FIELD_ENTRY 0 #define SMBIOS_FIELD_ENTRY 0
#define SMBIOS_TABLE_ENTRY 1 #define SMBIOS_TABLE_ENTRY 1

View File

@ -26,7 +26,7 @@ struct smbios_structure_header {
uint8_t type; uint8_t type;
uint8_t length; uint8_t length;
uint16_t handle; uint16_t handle;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 0 - BIOS Information */ /* SMBIOS type 0 - BIOS Information */
struct smbios_type_0 { struct smbios_type_0 {
@ -42,7 +42,7 @@ struct smbios_type_0 {
uint8_t system_bios_minor_release; uint8_t system_bios_minor_release;
uint8_t embedded_controller_major_release; uint8_t embedded_controller_major_release;
uint8_t embedded_controller_minor_release; uint8_t embedded_controller_minor_release;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 1 - System Information */ /* SMBIOS type 1 - System Information */
struct smbios_type_1 { struct smbios_type_1 {
@ -55,7 +55,7 @@ struct smbios_type_1 {
uint8_t wake_up_type; uint8_t wake_up_type;
uint8_t sku_number_str; uint8_t sku_number_str;
uint8_t family_str; uint8_t family_str;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 3 - System Enclosure (v2.3) */ /* SMBIOS type 3 - System Enclosure (v2.3) */
struct smbios_type_3 { struct smbios_type_3 {
@ -74,7 +74,7 @@ struct smbios_type_3 {
uint8_t number_of_power_cords; uint8_t number_of_power_cords;
uint8_t contained_element_count; uint8_t contained_element_count;
// contained elements follow // contained elements follow
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 4 - Processor Information (v2.0) */ /* SMBIOS type 4 - Processor Information (v2.0) */
struct smbios_type_4 { struct smbios_type_4 {
@ -94,7 +94,7 @@ struct smbios_type_4 {
uint16_t l1_cache_handle; uint16_t l1_cache_handle;
uint16_t l2_cache_handle; uint16_t l2_cache_handle;
uint16_t l3_cache_handle; uint16_t l3_cache_handle;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 16 - Physical Memory Array /* SMBIOS type 16 - Physical Memory Array
* Associated with one type 17 (Memory Device). * Associated with one type 17 (Memory Device).
@ -107,7 +107,7 @@ struct smbios_type_16 {
uint32_t maximum_capacity; uint32_t maximum_capacity;
uint16_t memory_error_information_handle; uint16_t memory_error_information_handle;
uint16_t number_of_memory_devices; uint16_t number_of_memory_devices;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 17 - Memory Device /* SMBIOS type 17 - Memory Device
* Associated with one type 19 * Associated with one type 19
*/ */
@ -124,7 +124,7 @@ struct smbios_type_17 {
uint8_t bank_locator_str; uint8_t bank_locator_str;
uint8_t memory_type; uint8_t memory_type;
uint16_t type_detail; uint16_t type_detail;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 19 - Memory Array Mapped Address */ /* SMBIOS type 19 - Memory Array Mapped Address */
struct smbios_type_19 { struct smbios_type_19 {
@ -133,7 +133,7 @@ struct smbios_type_19 {
uint32_t ending_address; uint32_t ending_address;
uint16_t memory_array_handle; uint16_t memory_array_handle;
uint8_t partition_width; uint8_t partition_width;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 20 - Memory Device Mapped Address */ /* SMBIOS type 20 - Memory Device Mapped Address */
struct smbios_type_20 { struct smbios_type_20 {
@ -145,18 +145,18 @@ struct smbios_type_20 {
uint8_t partition_row_position; uint8_t partition_row_position;
uint8_t interleave_position; uint8_t interleave_position;
uint8_t interleaved_data_depth; uint8_t interleaved_data_depth;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 32 - System Boot Information */ /* SMBIOS type 32 - System Boot Information */
struct smbios_type_32 { struct smbios_type_32 {
struct smbios_structure_header header; struct smbios_structure_header header;
uint8_t reserved[6]; uint8_t reserved[6];
uint8_t boot_status; uint8_t boot_status;
} __attribute__((__packed__)); } QEMU_PACKED;
/* SMBIOS type 127 -- End-of-table */ /* SMBIOS type 127 -- End-of-table */
struct smbios_type_127 { struct smbios_type_127 {
struct smbios_structure_header header; struct smbios_structure_header header;
} __attribute__((__packed__)); } QEMU_PACKED;
#endif /*QEMU_SMBIOS_H */ #endif /*QEMU_SMBIOS_H */

View File

@ -106,7 +106,7 @@ struct srp_indirect_buf {
struct srp_direct_buf table_desc; struct srp_direct_buf table_desc;
uint32_t len; uint32_t len;
struct srp_direct_buf desc_list[0]; struct srp_direct_buf desc_list[0];
} __attribute__((packed)); } QEMU_PACKED;
enum { enum {
SRP_MULTICHAN_SINGLE = 0, SRP_MULTICHAN_SINGLE = 0,
@ -141,7 +141,7 @@ struct srp_login_rsp {
uint16_t buf_fmt; uint16_t buf_fmt;
uint8_t rsp_flags; uint8_t rsp_flags;
uint8_t reserved2[25]; uint8_t reserved2[25];
} __attribute__((packed)); } QEMU_PACKED;
struct srp_login_rej { struct srp_login_rej {
uint8_t opcode; uint8_t opcode;
@ -177,7 +177,7 @@ struct srp_tsk_mgmt {
uint8_t reserved1[6]; uint8_t reserved1[6];
uint64_t tag; uint64_t tag;
uint8_t reserved2[4]; uint8_t reserved2[4];
uint64_t lun __attribute__((packed)); uint64_t lun QEMU_PACKED;
uint8_t reserved3[2]; uint8_t reserved3[2];
uint8_t tsk_mgmt_func; uint8_t tsk_mgmt_func;
uint8_t reserved4; uint8_t reserved4;
@ -198,7 +198,7 @@ struct srp_cmd {
uint8_t data_in_desc_cnt; uint8_t data_in_desc_cnt;
uint64_t tag; uint64_t tag;
uint8_t reserved2[4]; uint8_t reserved2[4];
uint64_t lun __attribute__((packed)); uint64_t lun QEMU_PACKED;
uint8_t reserved3; uint8_t reserved3;
uint8_t task_attr; uint8_t task_attr;
uint8_t reserved4; uint8_t reserved4;
@ -235,6 +235,6 @@ struct srp_rsp {
uint32_t sense_data_len; uint32_t sense_data_len;
uint32_t resp_data_len; uint32_t resp_data_len;
uint8_t data[0]; uint8_t data[0];
} __attribute__((packed)); } QEMU_PACKED;
#endif /* SCSI_SRP_H */ #endif /* SCSI_SRP_H */

View File

@ -176,56 +176,56 @@ enum {
*/ */
}; };
typedef struct __attribute__ ((__packed__)) CCID_Header { typedef struct QEMU_PACKED CCID_Header {
uint8_t bMessageType; uint8_t bMessageType;
uint32_t dwLength; uint32_t dwLength;
uint8_t bSlot; uint8_t bSlot;
uint8_t bSeq; uint8_t bSeq;
} CCID_Header; } CCID_Header;
typedef struct __attribute__ ((__packed__)) CCID_BULK_IN { typedef struct QEMU_PACKED CCID_BULK_IN {
CCID_Header hdr; CCID_Header hdr;
uint8_t bStatus; /* Only used in BULK_IN */ uint8_t bStatus; /* Only used in BULK_IN */
uint8_t bError; /* Only used in BULK_IN */ uint8_t bError; /* Only used in BULK_IN */
} CCID_BULK_IN; } CCID_BULK_IN;
typedef struct __attribute__ ((__packed__)) CCID_SlotStatus { typedef struct QEMU_PACKED CCID_SlotStatus {
CCID_BULK_IN b; CCID_BULK_IN b;
uint8_t bClockStatus; uint8_t bClockStatus;
} CCID_SlotStatus; } CCID_SlotStatus;
typedef struct __attribute__ ((__packed__)) CCID_Parameter { typedef struct QEMU_PACKED CCID_Parameter {
CCID_BULK_IN b; CCID_BULK_IN b;
uint8_t bProtocolNum; uint8_t bProtocolNum;
uint8_t abProtocolDataStructure[0]; uint8_t abProtocolDataStructure[0];
} CCID_Parameter; } CCID_Parameter;
typedef struct __attribute__ ((__packed__)) CCID_DataBlock { typedef struct QEMU_PACKED CCID_DataBlock {
CCID_BULK_IN b; CCID_BULK_IN b;
uint8_t bChainParameter; uint8_t bChainParameter;
uint8_t abData[0]; uint8_t abData[0];
} CCID_DataBlock; } CCID_DataBlock;
/* 6.1.4 PC_to_RDR_XfrBlock */ /* 6.1.4 PC_to_RDR_XfrBlock */
typedef struct __attribute__ ((__packed__)) CCID_XferBlock { typedef struct QEMU_PACKED CCID_XferBlock {
CCID_Header hdr; CCID_Header hdr;
uint8_t bBWI; /* Block Waiting Timeout */ uint8_t bBWI; /* Block Waiting Timeout */
uint16_t wLevelParameter; /* XXX currently unused */ uint16_t wLevelParameter; /* XXX currently unused */
uint8_t abData[0]; uint8_t abData[0];
} CCID_XferBlock; } CCID_XferBlock;
typedef struct __attribute__ ((__packed__)) CCID_IccPowerOn { typedef struct QEMU_PACKED CCID_IccPowerOn {
CCID_Header hdr; CCID_Header hdr;
uint8_t bPowerSelect; uint8_t bPowerSelect;
uint16_t abRFU; uint16_t abRFU;
} CCID_IccPowerOn; } CCID_IccPowerOn;
typedef struct __attribute__ ((__packed__)) CCID_IccPowerOff { typedef struct QEMU_PACKED CCID_IccPowerOff {
CCID_Header hdr; CCID_Header hdr;
uint16_t abRFU; uint16_t abRFU;
} CCID_IccPowerOff; } CCID_IccPowerOff;
typedef struct __attribute__ ((__packed__)) CCID_SetParameters { typedef struct QEMU_PACKED CCID_SetParameters {
CCID_Header hdr; CCID_Header hdr;
uint8_t bProtocolNum; uint8_t bProtocolNum;
uint16_t abRFU; uint16_t abRFU;

View File

@ -50,6 +50,6 @@ struct virtio_balloon_config
typedef struct VirtIOBalloonStat { typedef struct VirtIOBalloonStat {
uint16_t tag; uint16_t tag;
uint64_t val; uint64_t val;
} __attribute__((packed)) VirtIOBalloonStat; } QEMU_PACKED VirtIOBalloonStat;
#endif #endif

View File

@ -49,7 +49,7 @@ struct virtio_blk_config
uint8_t alignment_offset; uint8_t alignment_offset;
uint16_t min_io_size; uint16_t min_io_size;
uint32_t opt_io_size; uint32_t opt_io_size;
} __attribute__((packed)); } QEMU_PACKED;
/* These two define direction. */ /* These two define direction. */
#define VIRTIO_BLK_T_IN 0 #define VIRTIO_BLK_T_IN 0

View File

@ -72,7 +72,7 @@ struct virtio_net_config
uint8_t mac[ETH_ALEN]; uint8_t mac[ETH_ALEN];
/* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
uint16_t status; uint16_t status;
} __attribute__((packed)); } QEMU_PACKED;
/* This is the first element of the scatter-gather list. If you don't /* This is the first element of the scatter-gather list. If you don't
* specify GSO or CSUM features, you can simply ignore the header. */ * specify GSO or CSUM features, you can simply ignore the header. */

View File

@ -37,7 +37,7 @@ struct virtio_console_config {
uint16_t rows; uint16_t rows;
uint32_t max_nr_ports; uint32_t max_nr_ports;
} __attribute__((packed)); } QEMU_PACKED;
struct virtio_console_control { struct virtio_console_control {
uint32_t id; /* Port number */ uint32_t id; /* Port number */

View File

@ -70,7 +70,7 @@ struct vmsvga_state_s {
union { union {
uint32_t *fifo; uint32_t *fifo;
struct __attribute__((__packed__)) { struct QEMU_PACKED {
uint32_t min; uint32_t min;
uint32_t max; uint32_t max;
uint32_t next_cmd; uint32_t next_cmd;

View File

@ -246,7 +246,7 @@ device_init(scoop_register);
#define MAGIC_CHG(a, b, c, d) ((d << 24) | (c << 16) | (b << 8) | a) #define MAGIC_CHG(a, b, c, d) ((d << 24) | (c << 16) | (b << 8) | a)
static struct __attribute__ ((__packed__)) sl_param_info { static struct QEMU_PACKED sl_param_info {
uint32_t comadj_keyword; uint32_t comadj_keyword;
int32_t comadj; int32_t comadj;

View File

@ -1120,7 +1120,7 @@ struct target_stat64 {
abi_ulong __pad7; /* will be high 32 bits of ctime someday */ abi_ulong __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__((packed)); } QEMU_PACKED;
#ifdef TARGET_ARM #ifdef TARGET_ARM
struct target_eabi_stat64 { struct target_eabi_stat64 {
@ -1151,7 +1151,7 @@ struct target_eabi_stat64 {
abi_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__ ((packed)); } QEMU_PACKED;
#endif #endif
#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
@ -1294,7 +1294,7 @@ struct target_stat {
#endif #endif
}; };
struct __attribute__((__packed__)) target_stat64 { struct QEMU_PACKED target_stat64 {
unsigned long long st_dev; unsigned long long st_dev;
unsigned long long st_ino; unsigned long long st_ino;
unsigned int st_mode; unsigned int st_mode;
@ -1341,7 +1341,7 @@ struct target_stat {
}; };
/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
struct __attribute__((__packed__)) target_stat64 { struct QEMU_PACKED target_stat64 {
uint64_t st_dev; uint64_t st_dev;
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
uint32_t pad0; uint32_t pad0;
@ -1428,7 +1428,7 @@ struct target_stat64 {
abi_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__((packed)); } QEMU_PACKED;
#elif defined(TARGET_ABI_MIPSN64) #elif defined(TARGET_ABI_MIPSN64)
@ -1680,7 +1680,7 @@ struct target_stat {
/* This matches struct stat64 in glibc2.1, hence the absolutely /* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's. * insane amounts of padding around dev_t's.
*/ */
struct __attribute__((__packed__)) target_stat64 { struct QEMU_PACKED target_stat64 {
unsigned long long st_dev; unsigned long long st_dev;
unsigned char __pad0[4]; unsigned char __pad0[4];
@ -2095,7 +2095,7 @@ struct target_flock64 {
unsigned long long l_start; unsigned long long l_start;
unsigned long long l_len; unsigned long long l_len;
int l_pid; int l_pid;
}__attribute__((packed)); } QEMU_PACKED;
#ifdef TARGET_ARM #ifdef TARGET_ARM
struct target_eabi_flock64 { struct target_eabi_flock64 {
@ -2105,7 +2105,7 @@ struct target_eabi_flock64 {
unsigned long long l_start; unsigned long long l_start;
unsigned long long l_len; unsigned long long l_len;
int l_pid; int l_pid;
}__attribute__((packed)); } QEMU_PACKED;
#endif #endif
/* soundcard defines */ /* soundcard defines */

View File

@ -70,12 +70,12 @@ struct m68k_gdb_stat {
gdb_time_t gdb_st_atime; /* time of last access */ gdb_time_t gdb_st_atime; /* time of last access */
gdb_time_t gdb_st_mtime; /* time of last modification */ gdb_time_t gdb_st_mtime; /* time of last modification */
gdb_time_t gdb_st_ctime; /* time of last change */ gdb_time_t gdb_st_ctime; /* time of last change */
} __attribute__((packed)); } QEMU_PACKED;
struct gdb_timeval { struct gdb_timeval {
gdb_time_t tv_sec; /* second */ gdb_time_t tv_sec; /* second */
uint64_t tv_usec; /* microsecond */ uint64_t tv_usec; /* microsecond */
} __attribute__((packed)); } QEMU_PACKED;
#define GDB_O_RDONLY 0x0 #define GDB_O_RDONLY 0x0
#define GDB_O_WRONLY 0x1 #define GDB_O_WRONLY 0x1

4
nbd.h
View File

@ -31,13 +31,13 @@ struct nbd_request {
uint64_t handle; uint64_t handle;
uint64_t from; uint64_t from;
uint32_t len; uint32_t len;
} __attribute__ ((__packed__)); } QEMU_PACKED;
struct nbd_reply { struct nbd_reply {
uint32_t magic; uint32_t magic;
uint32_t error; uint32_t error;
uint64_t handle; uint64_t handle;
} __attribute__ ((__packed__)); } QEMU_PACKED;
enum { enum {
NBD_CMD_READ = 0, NBD_CMD_READ = 0,

View File

@ -91,7 +91,7 @@ struct ip {
uint8_t ip_p; /* protocol */ uint8_t ip_p; /* protocol */
uint16_t ip_sum; /* checksum */ uint16_t ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */ struct in_addr ip_src,ip_dst; /* source and dest address */
} __attribute__((packed)); } QEMU_PACKED;
#define IP_MAXPACKET 65535 /* maximum packet size */ #define IP_MAXPACKET 65535 /* maximum packet size */
@ -153,7 +153,7 @@ struct ip_timestamp {
n_long ipt_time; n_long ipt_time;
} ipt_ta[1]; } ipt_ta[1];
} ipt_timestamp; } ipt_timestamp;
} __attribute__((packed)); } QEMU_PACKED;
/* flag bits for ipt_flg */ /* flag bits for ipt_flg */
#define IPOPT_TS_TSONLY 0 /* timestamps only */ #define IPOPT_TS_TSONLY 0 /* timestamps only */
@ -183,11 +183,11 @@ struct ip_timestamp {
struct mbuf_ptr { struct mbuf_ptr {
struct mbuf *mptr; struct mbuf *mptr;
uint32_t dummy; uint32_t dummy;
} __attribute__((packed)); } QEMU_PACKED;
#else #else
struct mbuf_ptr { struct mbuf_ptr {
struct mbuf *mptr; struct mbuf *mptr;
} __attribute__((packed)); } QEMU_PACKED;
#endif #endif
struct qlink { struct qlink {
void *next, *prev; void *next, *prev;
@ -203,7 +203,7 @@ struct ipovly {
uint16_t ih_len; /* protocol length */ uint16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */ struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */ struct in_addr ih_dst; /* destination internet address */
} __attribute__((packed)); } QEMU_PACKED;
/* /*
* Ip reassembly queue structure. Each fragment * Ip reassembly queue structure. Each fragment
@ -219,7 +219,7 @@ struct ipq {
uint8_t ipq_p; /* protocol of this fragment */ uint8_t ipq_p; /* protocol of this fragment */
uint16_t ipq_id; /* sequence id for reassembly */ uint16_t ipq_id; /* sequence id for reassembly */
struct in_addr ipq_src,ipq_dst; struct in_addr ipq_src,ipq_dst;
} __attribute__((packed)); } QEMU_PACKED;
/* /*
* Ip header, when holding a fragment. * Ip header, when holding a fragment.
@ -229,7 +229,7 @@ struct ipq {
struct ipasfrag { struct ipasfrag {
struct qlink ipf_link; struct qlink ipf_link;
struct ip ipf_ip; struct ip ipf_ip;
} __attribute__((packed)); } QEMU_PACKED;
#define ipf_off ipf_ip.ip_off #define ipf_off ipf_ip.ip_off
#define ipf_tos ipf_ip.ip_tos #define ipf_tos ipf_ip.ip_tos
@ -248,6 +248,6 @@ struct ipasfrag {
struct ipoption { struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */ struct in_addr ipopt_dst; /* first-hop dst if source routed */
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */ int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
} __attribute__((packed)); } QEMU_PACKED;
#endif #endif

View File

@ -199,7 +199,7 @@ struct arphdr {
uint32_t ar_sip; /* sender IP address */ uint32_t ar_sip; /* sender IP address */
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
uint32_t ar_tip; /* target IP address */ uint32_t ar_tip; /* target IP address */
} __attribute__((packed)); } QEMU_PACKED;
#define ARP_TABLE_SIZE 16 #define ARP_TABLE_SIZE 16

View File

@ -348,7 +348,7 @@ int kvm_arch_init_vcpu(CPUState *env)
struct { struct {
struct kvm_cpuid2 cpuid; struct kvm_cpuid2 cpuid;
struct kvm_cpuid_entry2 entries[100]; struct kvm_cpuid_entry2 entries[100];
} __attribute__((packed)) cpuid_data; } QEMU_PACKED cpuid_data;
KVMState *s = env->kvm_state; KVMState *s = env->kvm_state;
uint32_t limit, i, j, cpuid_i; uint32_t limit, i, j, cpuid_i;
uint32_t unused; uint32_t unused;

View File

@ -130,7 +130,7 @@
#define SVM_CR0_SELECTIVE_MASK (1 << 3 | 1) /* TS and MP */ #define SVM_CR0_SELECTIVE_MASK (1 << 3 | 1) /* TS and MP */
struct __attribute__ ((__packed__)) vmcb_control_area { struct QEMU_PACKED vmcb_control_area {
uint16_t intercept_cr_read; uint16_t intercept_cr_read;
uint16_t intercept_cr_write; uint16_t intercept_cr_write;
uint16_t intercept_dr_read; uint16_t intercept_dr_read;
@ -162,14 +162,14 @@ struct __attribute__ ((__packed__)) vmcb_control_area {
uint8_t reserved_5[832]; uint8_t reserved_5[832];
}; };
struct __attribute__ ((__packed__)) vmcb_seg { struct QEMU_PACKED vmcb_seg {
uint16_t selector; uint16_t selector;
uint16_t attrib; uint16_t attrib;
uint32_t limit; uint32_t limit;
uint64_t base; uint64_t base;
}; };
struct __attribute__ ((__packed__)) vmcb_save_area { struct QEMU_PACKED vmcb_save_area {
struct vmcb_seg es; struct vmcb_seg es;
struct vmcb_seg cs; struct vmcb_seg cs;
struct vmcb_seg ss; struct vmcb_seg ss;
@ -214,7 +214,7 @@ struct __attribute__ ((__packed__)) vmcb_save_area {
uint64_t last_excp_to; uint64_t last_excp_to;
}; };
struct __attribute__ ((__packed__)) vmcb { struct QEMU_PACKED vmcb {
struct vmcb_control_area control; struct vmcb_control_area control;
struct vmcb_save_area save; struct vmcb_save_area save;
}; };

View File

@ -698,7 +698,7 @@ typedef struct LowCore
/* align to the top of the prefix area */ /* align to the top of the prefix area */
uint8_t pad18[0x2000-0x1400]; /* 0x1400 */ uint8_t pad18[0x2000-0x1400]; /* 0x1400 */
} __attribute__((packed)) LowCore; } QEMU_PACKED LowCore;
/* STSI */ /* STSI */
#define STSI_LEVEL_MASK 0x00000000f0000000ULL #define STSI_LEVEL_MASK 0x00000000f0000000ULL

View File

@ -773,7 +773,7 @@ void test_fops(double a, double b)
void fpu_clear_exceptions(void) void fpu_clear_exceptions(void)
{ {
struct __attribute__((packed)) { struct QEMU_PACKED {
uint16_t fpuc; uint16_t fpuc;
uint16_t dummy1; uint16_t dummy1;
uint16_t fpus; uint16_t fpus;
@ -924,7 +924,7 @@ void test_fbcd(double a)
void test_fenv(void) void test_fenv(void)
{ {
struct __attribute__((packed)) { struct QEMU_PACKED {
uint16_t fpuc; uint16_t fpuc;
uint16_t dummy1; uint16_t dummy1;
uint16_t fpus; uint16_t fpus;
@ -934,7 +934,7 @@ void test_fenv(void)
uint32_t ignored[4]; uint32_t ignored[4];
long double fpregs[8]; long double fpregs[8];
} float_env32; } float_env32;
struct __attribute__((packed)) { struct QEMU_PACKED {
uint16_t fpuc; uint16_t fpuc;
uint16_t fpus; uint16_t fpus;
uint16_t fptag; uint16_t fptag;
@ -1279,7 +1279,7 @@ void test_segs(void)
struct { struct {
uint32_t offset; uint32_t offset;
uint16_t seg; uint16_t seg;
} __attribute__((packed)) segoff; } QEMU_PACKED segoff;
ldt.entry_number = 1; ldt.entry_number = 1;
ldt.base_addr = (unsigned long)&seg_data1; ldt.base_addr = (unsigned long)&seg_data1;
@ -1441,7 +1441,7 @@ void test_misc(void)
/* XXX: see if Intel Core2 and AMD64 behavior really /* XXX: see if Intel Core2 and AMD64 behavior really
differ. Here we implemented the Intel way which is not differ. Here we implemented the Intel way which is not
compatible yet with QEMU. */ compatible yet with QEMU. */
static struct __attribute__((packed)) { static struct QEMU_PACKED {
uint64_t offset; uint64_t offset;
uint16_t seg; uint16_t seg;
} desc; } desc;