Fix compile with --disable-tpm
PATCH 1/1 Fix compile with --disable-tpm
--- tpm.c | 7 ++++--- vl.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
tpm.c +4 -3
@@ -30,8 +30,6 @@ void tpm_register_model(enum TpmModel model) tpm_models[model] = true; } -#ifdef CONFIG_TPM -static const TPMBackendClass *tpm_be_find_by_type (enum TpmType type) {
@@ -48,6 +46,8 @@ tpm_be_find_by_type(enum TpmType type)return TPM_BACKEND_CLASS (oc); } +#ifdef CONFIG_TPM +/* * Walk the list of available TPM backend drivers and display them on the * screen.
@@ -208,8 +208,9 @@ TPMInfoList *qmp_query_tpm(Error **errp)continue ; } info =g_new0 (TPMInfoList,1 ); +#ifdef CONFIG_TPM info->value =tpm_backend_query_tpm (drv); - +#endif if (!cur_item) { head = cur_item = info; }else {
vl.c +2 -0
@@ -4905,7 +4905,9 @@ int main(int argc, char **argv, char **envp)res_free ();/* vhost-user must be cleaned up before chardevs. */ +#ifdef CONFIG_TPM tpm_cleanup (); +#endif net_cleanup ();audio_cleanup ();monitor_cleanup ();
Signature · 1 line
2.7.6
Hi Zoltan,
Quoted 44 lines · BALATON Zoltan
Signed-off-by BALATON Zoltan <[email protected]>--- tpm.c | 7 ++++--- vl.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)tpm.c +4
-3@@ -30,8 +30,6 @@ void tpm_register_model(enum TpmModel model) tpm_models[model] = true; } -#ifdef CONFIG_TPM -static const TPMBackendClass *tpm_be_find_by_type (enum TpmType type) {@@ -48,6 +46,8 @@ tpm_be_find_by_type(enum TpmType type)return TPM_BACKEND_CLASS (oc); } +#ifdef CONFIG_TPM +/* * Walk the list of available TPM backend drivers and display them on the * screen. @@ -208,8 +208,9 @@ TPMInfoList *qmp_query_tpm(Error **errp)continue ; } info =g_new0 (TPMInfoList,1 ); +#ifdef CONFIG_TPM info->value =tpm_backend_query_tpm (drv); - +#endif if (!cur_item) { head = cur_item = info; }else {vl.c +0
-0
vl.c int main(int argc, char **argv, char **envp) · line 4913
Quoted 9 lines
vl.c +2
-0@@ -4905,7 +4905,9 @@ int main(int argc, char **argv, char **envp)res_free ();/* vhost-user must be cleaned up before chardevs. */ +#ifdef CONFIG_TPM tpm_cleanup (); +#endif net_cleanup ();audio_cleanup ();monitor_cleanup ();
Can you instead add tpm_cleanup() in stubs/tpm.c?
Regards,
Phil.
Quoted 1 line · Philippe Mathieu-Daudé
On 10/23/2017 07:24 AM, BALATON Zoltan wrote:
[...]
Quoted 15 lines
Quoted 15 lines
info = g_new0(TPMInfoList, 1);tpm.c +2
-1+#ifdef CONFIG_TPM info->value =tpm_backend_query_tpm (drv); - +#endif if (!cur_item) { head = cur_item = info; }else {vl.c +0
-0@@ -4905,7 +4905,9 @@ int main(int argc, char **argv, char **envp)res_free ();
Quoted 9 lines
vl.c int main(int argc, char **argv, char **envp) · line 4913
Quoted 7 lines
vl.c +2
-0/* vhost-user must be cleaned up before chardevs. */ +#ifdef CONFIG_TPM tpm_cleanup (); +#endif net_cleanup ();audio_cleanup ();monitor_cleanup ();Can you instead add
tpm_cleanup()instubs/tpm.c?
and tpm_backend_query_tpm() ;)
Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 1 line · Philippe Mathieu-Daudé
On 10/23/2017 07:24 AM, BALATON Zoltan wrote:
[...]
Quoted 15 lines
Quoted 15 lines
info = g_new0(TPMInfoList, 1);tpm.c +2
-1+#ifdef CONFIG_TPM info->value =tpm_backend_query_tpm (drv); - +#endif if (!cur_item) { head = cur_item = info; }else {vl.c +0
-0@@ -4905,7 +4905,9 @@ int main(int argc, char **argv, char **envp)res_free ();Quoted 9 lines
vl.c int main(int argc, char **argv, char **envp) · line 4913
Quoted 7 lines
vl.c +2
-0/* vhost-user must be cleaned up before chardevs. */ +#ifdef CONFIG_TPM tpm_cleanup (); +#endif net_cleanup ();audio_cleanup ();monitor_cleanup ();Can you instead add
tpm_cleanup()instubs/tpm.c?
Quoted 1 line
and
tpm_backend_query_tpm();)
The v2 I've sent avoids #ifdefs outside tpm.c so isn't that acceptable? Do we still need stubs for these? I don't understand how stubs are compiled so if it's needed can you point me to an example what needs to be done to add stubs for these? (I'm not familiar with this, just tried to fix a compile problem I've met but I don't really know what's the correct way to fix this. I'd expect the author of the patch that broke it to fix it instead or at least review this to avoid breaking it more.)
Regards,
BALATON Zoltan