Skip to content

Commit 3e6eb04

Browse files
palash-gandhiDelphix Engineering
authored and
Delphix Engineering
committed
Extract PKG_ABI from mutated string
1 parent efadd4d commit 3e6eb04

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
@@ -207,7 +207,7 @@ kmake = make ARCH=$(build_arch) \
207207
KERNELRELEASE=$(abi_release)-$(target_flavour) \
208208
CONFIG_DEBUG_SECTION_MISMATCH=y \
209209
KBUILD_BUILD_VERSION="$(uploadnum)" \
210-
CFLAGS_MODULE="-DPKG_ABI=$(abinum)" \
210+
CFLAGS_MODULE='-DPKG_ABI=\"$(abinum)\"' \
211211
PYTHON=$(PYTHON)
212212
ifneq ($(LOCAL_ENV_CC),)
213213
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
@@ -18,6 +18,7 @@
1818
#ifndef _ASM_GENERIC_MSHYPERV_H
1919
#define _ASM_GENERIC_MSHYPERV_H
2020

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

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

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

149158
return guest_id;
150159
}

0 commit comments

Comments
 (0)