Re: [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available
Stefan Berger writes: > On 7/23/20 7:58 AM, Markus Armbruster wrote: >> Help is a bit awkward when no TPM types are built into QEMU: >> >> $ upstream-qemu -tpmdev nonexistent,id=tpm0 > > I hope you don't mind me replacing 'upstream-qemu' with > 'x86_64-softmmu/qemu-system-x86_64'? > >> upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a >> TPM backend type > > > and this one with 'qemu-system-x86_64:' > > >> Supported TPM types (choose only one): >> >> Improve to >> >> upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a >> TPM backend type >> No TPM backend types are available' > > > I hope you don't mind me replacing 'upstream-qemu' with > 'x86_64-softmmu/qemu-system-x86_64'? On the contrary! I meant to replace by qemu-system-x86_64 (no directory part), but forgot. Thanks!
Re: [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available
On 7/23/20 7:58 AM, Markus Armbruster wrote: Help is a bit awkward when no TPM types are built into QEMU: $ upstream-qemu -tpmdev nonexistent,id=tpm0 I hope you don't mind me replacing 'upstream-qemu' with 'x86_64-softmmu/qemu-system-x86_64'? upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type and this one with 'qemu-system-x86_64:' Supported TPM types (choose only one): Improve to upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type No TPM backend types are available' I hope you don't mind me replacing 'upstream-qemu' with 'x86_64-softmmu/qemu-system-x86_64'? Stefan
Re: [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available
On 7/23/20 8:49 AM, Philippe Mathieu-Daudé wrote: On 7/23/20 1:58 PM, Markus Armbruster wrote: Help is a bit awkward when no TPM types are built into QEMU: $ upstream-qemu -tpmdev nonexistent,id=tpm0 upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type Supported TPM types (choose only one): Improve to upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type No TPM backend types are available Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Berger --- tpm.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tpm.c b/tpm.c index f6045bb6da..cab206355a 100644 --- a/tpm.c +++ b/tpm.c @@ -47,18 +47,23 @@ tpm_be_find_by_type(enum TpmType type) */ static void tpm_display_backend_drivers(void) { +bool got_one = false; int i; -fprintf(stderr, "Supported TPM types (choose only one):\n"); - for (i = 0; i < TPM_TYPE__MAX; i++) { const TPMBackendClass *bc = tpm_be_find_by_type(i); if (!bc) { continue; } -fprintf(stderr, "%12s %s\n", TpmType_str(i), bc->desc); +if (!got_one) { +error_printf("Supported TPM types (choose only one):\n"); +got_one = true; +} +error_printf("%12s %s\n", TpmType_str(i), bc->desc); +} +if (!got_one) { +error_printf("No TPM backend types are available\n"); } -fprintf(stderr, "\n"); } /*
Re: [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available
On 7/23/20 1:58 PM, Markus Armbruster wrote: > Help is a bit awkward when no TPM types are built into QEMU: > > $ upstream-qemu -tpmdev nonexistent,id=tpm0 > upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a > TPM backend type > Supported TPM types (choose only one): > > Improve to > > upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a > TPM backend type > No TPM backend types are available > > Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé > --- > tpm.c | 13 + > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tpm.c b/tpm.c > index f6045bb6da..cab206355a 100644 > --- a/tpm.c > +++ b/tpm.c > @@ -47,18 +47,23 @@ tpm_be_find_by_type(enum TpmType type) > */ > static void tpm_display_backend_drivers(void) > { > +bool got_one = false; > int i; > > -fprintf(stderr, "Supported TPM types (choose only one):\n"); > - > for (i = 0; i < TPM_TYPE__MAX; i++) { > const TPMBackendClass *bc = tpm_be_find_by_type(i); > if (!bc) { > continue; > } > -fprintf(stderr, "%12s %s\n", TpmType_str(i), bc->desc); > +if (!got_one) { > +error_printf("Supported TPM types (choose only one):\n"); > +got_one = true; > +} > +error_printf("%12s %s\n", TpmType_str(i), bc->desc); > +} > +if (!got_one) { > +error_printf("No TPM backend types are available\n"); > } > -fprintf(stderr, "\n"); > } > > /* >