summaryrefslogtreecommitdiffstats
path: root/include/hardware/gps.h
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2015-06-01 13:47:52 -0700
committerdestradaa <destradaa@google.com>2015-06-01 14:05:51 -0700
commit6f8f5c5f400ff0d974983133dbc0b74b9e58ec03 (patch)
treed71d8b462d8a674556298bde7236c392b1a7fee0 /include/hardware/gps.h
parentfa216fc29d471da3264421024b7a485f05bfe634 (diff)
downloadhardware_libhardware-6f8f5c5f400ff0d974983133dbc0b74b9e58ec03.zip
hardware_libhardware-6f8f5c5f400ff0d974983133dbc0b74b9e58ec03.tar.gz
hardware_libhardware-6f8f5c5f400ff0d974983133dbc0b74b9e58ec03.tar.bz2
Pack AGpsStatus data structures for 64-bit platforms.
b/21471818 The packing of AGpsStatus_v1 ensures that its size does not collide with the size of AGpsStatus_v2. Change-Id: Ic73a73070c29c0e819cb62667bc14333f448e856
Diffstat (limited to 'include/hardware/gps.h')
-rw-r--r--include/hardware/gps.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index 38353f2..76b6cb7 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -673,6 +673,12 @@ typedef struct {
size_t (*get_internal_state)(char* buffer, size_t bufferSize);
} GpsDebugInterface;
+#pragma pack(push,4)
+// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit
+// environments the size of this legacy definition does not collide with _v2. Implementations should
+// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old
+// implementation is still in use.
+
/** Represents the status of AGPS. */
typedef struct {
/** set to sizeof(AGpsStatus_v1) */
@@ -682,6 +688,8 @@ typedef struct {
AGpsStatusValue status;
} AGpsStatus_v1;
+#pragma pack(pop)
+
/** Represents the status of AGPS augmented with a IPv4 address field. */
typedef struct {
/** set to sizeof(AGpsStatus_v2) */