Skip to content

Commit a2b0b01

Browse files
palash-gandhiprakashsurya
authored andcommitted
Extract PKG_ABI from mutated string
1 parent 80907fe commit a2b0b01

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

debian/rules.d/0-common-vars.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ kmake = make ARCH=$(build_arch) \
206206
KERNELRELEASE=$(abi_release)-$* \
207207
CONFIG_DEBUG_SECTION_MISMATCH=y \
208208
KBUILD_BUILD_VERSION="$(uploadnum)" \
209-
CFLAGS_MODULE="-DPKG_ABI=$(abinum)" \
209+
CFLAGS_MODULE='-DPKG_ABI=\"$(abinum)\"' \
210210
PYTHON=$(PYTHON)
211211
ifneq ($(LOCAL_ENV_CC),)
212212
kmake += CC="$(LOCAL_ENV_CC)" DISTCC_HOSTS="$(LOCAL_ENV_DISTCC_HOSTS)"

include/asm-generic/mshyperv.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef _ASM_GENERIC_MSHYPERV_H
1818
#define _ASM_GENERIC_MSHYPERV_H
1919

20+
#include <linux/kernel.h>
2021
#include <linux/types.h>
2122
#include <linux/atomic.h>
2223
#include <linux/bitops.h>
@@ -133,7 +134,7 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
133134
* Preserve the ability to 'make deb-pkg' since PKG_ABI is provided
134135
* by the Ubuntu build rules.
135136
*/
136-
#define PKG_ABI 0
137+
#define PKG_ABI "0"
137138
#endif
138139

139140
/* Generate the guest OS identifier as described in the Hyper-V TLFS */
@@ -143,7 +144,15 @@ static inline u64 hv_generate_guest_id(u64 kernel_version)
143144

144145
guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
145146
guest_id |= (kernel_version << 16);
146-
guest_id |= PKG_ABI;
147+
/*
148+
* Delphix mutates the ABI number by appending a date and the commit hash. Strip it.
149+
*/
150+
char *token;
151+
char *pkg_abi_str = PKG_ABI;
152+
token = strsep(&pkg_abi_str, "-");
153+
unsigned long abi_number = simple_strtoul(token, NULL, 10);
154+
guest_id |= (abi_number << 8);
155+
147156

148157
return guest_id;
149158
}

0 commit comments

Comments
 (0)