diff options
| author | Vinod Koul <vinod.koul@intel.com> | 2014-06-19 05:11:00 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2014-06-23 06:15:33 -0400 |
| commit | 2da38e0c9465b89518b29328daeb7da0ca1690b7 (patch) | |
| tree | 52194a07ecf750604b7f30394352acd0b78e7232 | |
| parent | 8d42fda9ea9820d271a40f0bf7ed436647f2ddb9 (diff) | |
ALSA: compress: fix the struct alignment to 4 bytes
In 64bit systems the compiler can default align to 8bytes causing mis-match with
32bit usermode. Avoid this is future by ensuring all the structures shared with
usermode are packed and aligned to 4 bytes irrespective of arch used
[coding style fixes by tiwai]
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | include/uapi/sound/compress_offload.h | 14 | ||||
| -rw-r--r-- | include/uapi/sound/compress_params.h | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index 21eed488783f..1964026b5e09 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | struct snd_compressed_buffer { | 39 | struct snd_compressed_buffer { |
| 40 | __u32 fragment_size; | 40 | __u32 fragment_size; |
| 41 | __u32 fragments; | 41 | __u32 fragments; |
| 42 | }; | 42 | } __attribute__((packed, aligned(4))); |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * struct snd_compr_params: compressed stream params | 45 | * struct snd_compr_params: compressed stream params |
| @@ -51,7 +51,7 @@ struct snd_compr_params { | |||
| 51 | struct snd_compressed_buffer buffer; | 51 | struct snd_compressed_buffer buffer; |
| 52 | struct snd_codec codec; | 52 | struct snd_codec codec; |
| 53 | __u8 no_wake_mode; | 53 | __u8 no_wake_mode; |
| 54 | }; | 54 | } __attribute__((packed, aligned(4))); |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | * struct snd_compr_tstamp: timestamp descriptor | 57 | * struct snd_compr_tstamp: timestamp descriptor |
| @@ -70,7 +70,7 @@ struct snd_compr_tstamp { | |||
| 70 | __u32 pcm_frames; | 70 | __u32 pcm_frames; |
| 71 | __u32 pcm_io_frames; | 71 | __u32 pcm_io_frames; |
| 72 | __u32 sampling_rate; | 72 | __u32 sampling_rate; |
| 73 | }; | 73 | } __attribute__((packed, aligned(4))); |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * struct snd_compr_avail: avail descriptor | 76 | * struct snd_compr_avail: avail descriptor |
| @@ -80,7 +80,7 @@ struct snd_compr_tstamp { | |||
| 80 | struct snd_compr_avail { | 80 | struct snd_compr_avail { |
| 81 | __u64 avail; | 81 | __u64 avail; |
| 82 | struct snd_compr_tstamp tstamp; | 82 | struct snd_compr_tstamp tstamp; |
| 83 | } __attribute__((packed)); | 83 | } __attribute__((packed, aligned(4))); |
| 84 | 84 | ||
| 85 | enum snd_compr_direction { | 85 | enum snd_compr_direction { |
| 86 | SND_COMPRESS_PLAYBACK = 0, | 86 | SND_COMPRESS_PLAYBACK = 0, |
| @@ -107,7 +107,7 @@ struct snd_compr_caps { | |||
| 107 | __u32 max_fragments; | 107 | __u32 max_fragments; |
| 108 | __u32 codecs[MAX_NUM_CODECS]; | 108 | __u32 codecs[MAX_NUM_CODECS]; |
| 109 | __u32 reserved[11]; | 109 | __u32 reserved[11]; |
| 110 | }; | 110 | } __attribute__((packed, aligned(4))); |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | * struct snd_compr_codec_caps: query capability of codec | 113 | * struct snd_compr_codec_caps: query capability of codec |
| @@ -119,7 +119,7 @@ struct snd_compr_codec_caps { | |||
| 119 | __u32 codec; | 119 | __u32 codec; |
| 120 | __u32 num_descriptors; | 120 | __u32 num_descriptors; |
| 121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; | 121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; |
| 122 | }; | 122 | } __attribute__((packed, aligned(4))); |
| 123 | 123 | ||
| 124 | /** | 124 | /** |
| 125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the | 125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the |
| @@ -140,7 +140,7 @@ enum { | |||
| 140 | struct snd_compr_metadata { | 140 | struct snd_compr_metadata { |
| 141 | __u32 key; | 141 | __u32 key; |
| 142 | __u32 value[8]; | 142 | __u32 value[8]; |
| 143 | }; | 143 | } __attribute__((packed, aligned(4))); |
| 144 | 144 | ||
| 145 | /** | 145 | /** |
| 146 | * compress path ioctl definitions | 146 | * compress path ioctl definitions |
diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h index 165e7059de75..d9bd9ca0d5b0 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h | |||
| @@ -268,7 +268,7 @@ struct snd_enc_vorbis { | |||
| 268 | __u32 max_bit_rate; | 268 | __u32 max_bit_rate; |
| 269 | __u32 min_bit_rate; | 269 | __u32 min_bit_rate; |
| 270 | __u32 downmix; | 270 | __u32 downmix; |
| 271 | }; | 271 | } __attribute__((packed, aligned(4))); |
| 272 | 272 | ||
| 273 | 273 | ||
| 274 | /** | 274 | /** |
| @@ -284,7 +284,7 @@ struct snd_enc_real { | |||
| 284 | __u32 quant_bits; | 284 | __u32 quant_bits; |
| 285 | __u32 start_region; | 285 | __u32 start_region; |
| 286 | __u32 num_regions; | 286 | __u32 num_regions; |
| 287 | }; | 287 | } __attribute__((packed, aligned(4))); |
| 288 | 288 | ||
| 289 | /** | 289 | /** |
| 290 | * struct snd_enc_flac | 290 | * struct snd_enc_flac |
| @@ -308,12 +308,12 @@ struct snd_enc_real { | |||
| 308 | struct snd_enc_flac { | 308 | struct snd_enc_flac { |
| 309 | __u32 num; | 309 | __u32 num; |
| 310 | __u32 gain; | 310 | __u32 gain; |
| 311 | }; | 311 | } __attribute__((packed, aligned(4))); |
| 312 | 312 | ||
| 313 | struct snd_enc_generic { | 313 | struct snd_enc_generic { |
| 314 | __u32 bw; /* encoder bandwidth */ | 314 | __u32 bw; /* encoder bandwidth */ |
| 315 | __s32 reserved[15]; | 315 | __s32 reserved[15]; |
| 316 | }; | 316 | } __attribute__((packed, aligned(4))); |
| 317 | 317 | ||
| 318 | union snd_codec_options { | 318 | union snd_codec_options { |
| 319 | struct snd_enc_wma wma; | 319 | struct snd_enc_wma wma; |
| @@ -321,7 +321,7 @@ union snd_codec_options { | |||
| 321 | struct snd_enc_real real; | 321 | struct snd_enc_real real; |
| 322 | struct snd_enc_flac flac; | 322 | struct snd_enc_flac flac; |
| 323 | struct snd_enc_generic generic; | 323 | struct snd_enc_generic generic; |
| 324 | }; | 324 | } __attribute__((packed, aligned(4))); |
| 325 | 325 | ||
| 326 | /** struct snd_codec_desc - description of codec capabilities | 326 | /** struct snd_codec_desc - description of codec capabilities |
| 327 | * @max_ch: Maximum number of audio channels | 327 | * @max_ch: Maximum number of audio channels |
| @@ -358,7 +358,7 @@ struct snd_codec_desc { | |||
| 358 | __u32 formats; | 358 | __u32 formats; |
| 359 | __u32 min_buffer; | 359 | __u32 min_buffer; |
| 360 | __u32 reserved[15]; | 360 | __u32 reserved[15]; |
| 361 | }; | 361 | } __attribute__((packed, aligned(4))); |
| 362 | 362 | ||
| 363 | /** struct snd_codec | 363 | /** struct snd_codec |
| 364 | * @id: Identifies the supported audio encoder/decoder. | 364 | * @id: Identifies the supported audio encoder/decoder. |
| @@ -399,6 +399,6 @@ struct snd_codec { | |||
| 399 | __u32 align; | 399 | __u32 align; |
| 400 | union snd_codec_options options; | 400 | union snd_codec_options options; |
| 401 | __u32 reserved[3]; | 401 | __u32 reserved[3]; |
| 402 | }; | 402 | } __attribute__((packed, aligned(4))); |
| 403 | 403 | ||
| 404 | #endif | 404 | #endif |
