* [Qemu-devel] [PATCH 01/20] qdev: add print_options callback
@ 2011-02-02 21:46 Alon Levy
2011-02-03 10:21 ` Alon Levy
0 siblings, 1 reply; 5+ messages in thread
From: Alon Levy @ 2011-02-02 21:46 UTC (permalink / raw)
To: qemu-devel
another callback added to PropertyInfo, for later use by PROP_TYPE_ENUM.
Allows printing of runtime computed options when doing:
qemu -device foo,?
---
hw/qdev.c | 10 +++++++++-
hw/qdev.h | 1 +
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index c7fec44..0b2ad3d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -187,7 +187,15 @@ int qdev_device_help(QemuOpts *opts)
if (!prop->info->parse) {
continue; /* no way to set it, don't show */
}
- error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+ if (prop->info->print_options) {
+ char buf[256];
+ int ret;
+ ret = prop->info->print_options(info, prop, buf, sizeof(buf) - 3);
+ error_printf("%s.%s=%s%s\n", info->name, prop->name, buf,
+ ret == sizeof(buf) - 3 ? "..." : "" );
+ } else {
+ error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+ }
}
return 1;
}
diff --git a/hw/qdev.h b/hw/qdev.h
index 9808f85..fa3221b 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -109,6 +109,7 @@ struct PropertyInfo {
enum PropertyType type;
int (*parse)(DeviceState *dev, Property *prop, const char *str);
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
+ int (*print_options)(DeviceInfo *info, Property *prop, char *dest, size_t len);
void (*free)(DeviceState *dev, Property *prop);
};
--
1.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 01/20] qdev: add print_options callback
2011-02-02 21:46 [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
@ 2011-02-03 10:21 ` Alon Levy
0 siblings, 0 replies; 5+ messages in thread
From: Alon Levy @ 2011-02-03 10:21 UTC (permalink / raw)
To: qemu-devel
Please ignore, duplicate of 01/20 already on the list. It took so long for
01/20 to appear on the list that I thought it was lost.
Alon
On Wed, Feb 02, 2011 at 11:46:07PM +0200, Alon Levy wrote:
> another callback added to PropertyInfo, for later use by PROP_TYPE_ENUM.
> Allows printing of runtime computed options when doing:
> qemu -device foo,?
> ---
> hw/qdev.c | 10 +++++++++-
> hw/qdev.h | 1 +
> 2 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index c7fec44..0b2ad3d 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -187,7 +187,15 @@ int qdev_device_help(QemuOpts *opts)
> if (!prop->info->parse) {
> continue; /* no way to set it, don't show */
> }
> - error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + if (prop->info->print_options) {
> + char buf[256];
> + int ret;
> + ret = prop->info->print_options(info, prop, buf, sizeof(buf) - 3);
> + error_printf("%s.%s=%s%s\n", info->name, prop->name, buf,
> + ret == sizeof(buf) - 3 ? "..." : "" );
> + } else {
> + error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + }
> }
> return 1;
> }
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 9808f85..fa3221b 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -109,6 +109,7 @@ struct PropertyInfo {
> enum PropertyType type;
> int (*parse)(DeviceState *dev, Property *prop, const char *str);
> int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
> + int (*print_options)(DeviceInfo *info, Property *prop, char *dest, size_t len);
> void (*free)(DeviceState *dev, Property *prop);
> };
>
> --
> 1.7.4
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 00/20] usb-ccid (v16)
@ 2011-02-02 20:28 Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
0 siblings, 1 reply; 5+ messages in thread
From: Alon Levy @ 2011-02-02 20:28 UTC (permalink / raw)
To: qemu-devel
This patchset adds three new devices, usb-ccid, ccid-card-passthru and
ccid-card-emulated, providing a CCID bus, a simple passthru protocol
implementing card requiring a client, and a standalone emulated card.
It also introduces a new directory libcaccard with CAC card emulation,
CAC is a type of ISO 7816 smart card.
Tree for pull: git://anongit.freedesktop.org/~alon/qemu usb_ccid.v16
v15-v16 changes:
* split vscard_common introducing patch for ease of review
* sum of commit logs for the v15-v16 commits: (whitespace fixes
removed for space, see original commit messages in later patches)
* usb-ccid:
* fix abort on client answer after card remove
* enable migration
* remove side affect code from asserts
* return consistent self-powered state
* mask out reserved bits in ccid_set_parameters
* add missing abRFU in SetParameters (no affect on linux guest)
* vscard_common.h protocol change:
* VSCMsgInit capabilities and magic
* removed ReaderResponse, will use Error instead with code==VSC_SUCCESS.
* added Flush and FlushComplete, remove Reconnect.
* define VSCARD_MAGIC
* added error code VSC_SUCCESS.
* ccid-card-passthru
* return correct size
* return error instead of assert if client sent too large ATR
* don't assert if client sent too large a size, but add asserts for indices to buffer
* reset vscard_in indices on chardev disconnect
* handle init from client
* error if no chardev supplied
* use ntoh, hton
* eradicate reader_id_t
* remove Reconnect usage (removed from VSCARD protocol)
* send VSC_SUCCESS on card insert/remove and reader add/remove
* ccid-card-emulated
* fix error reporting in initfn
v14-v15 changes:
* add patch with --enable-smartcard and --disable-smartcard and only
disable ccid-card-emulated if nss not found.
* add patch with description strings
* s/libcaccard/libcacard/ in docs/ccid.txt
v13-v14 changes:
- support device_del/device_add on ccid-card-* and usb-ccid
* usb-ccid:
* lose card reference when card device deleted
* check slot number and deny adding a slot if one is already added.
* ccid-card-*: use qdev_simple_unplug_cb in both emulated and passthru ccid cards,
the exitfn already takes care of triggering card removal in the usb dev.
* libcacard:
* remove double include of config-host.mak
* add replay of card events to libcacard to support second and more emulation
* don't initialize more then once (doesn't support it right now, so one
thread, NSS thread, is left when device_del is done)
* add VCARD_EMUL_INIT_ALREADY_INITED
* ccid-card-emulated:
* take correct mutexes on signaling to fix deadlocks on device_del
* allow card insertion/removal event without proper reader insertion event
v12-v13 changes:
* libcacard:
* fix Makefile clean to remove vscclient
* fix double include of config-host in Makefile
* usb-ccid: remove attach/detach logic, usb is always attached. Guest
doesn't care if there is a reader attached with no card anyway.
* ccid-card-passthru: don't close chr_dev on removal, makes it possible
to use device_del/device_add to create remove/insertion for debugging.
v11-v12 changes:
* fix out of tree build
v10-v11 changes:
* fix last patch that removed one of the doc files.
* updated flow table in docs/ccid.txt
v8-v10 changes:
* usb-ccid:
* add slot for future use (Gerd)
* ifdef ENABLE_MIGRATION for migration support on account of usb
migration not being ready in general. (Gerd)
* verbosified commit messages. (Gerd)
* put libcacard docs in libcacard commit. (Gerd)
v8-v9 changes:
* Blue Swirl comments:
* white space fixes
* enabled by default, disabled only if missing nss
* forgotten fix from v8 (don't build libcacard.so)
* added a note about device being little endian
* library renamed from libcaccard to libcacard
* squashed both of libcacard patches, they touched different files anyway.
v7-v8 changes:
* Blue Swirl comments:
* usb-ccid: deannonymize some structs
* usb-ccid: coding style change - answer_t and bulk_in_t fixed
* usb-ccid: handle endianess conversion between guest and host
* usb-ccid: s/ccid_bulk_in_copy_out/ccid_bulk_in_copy_to_guest/
* ccid-card-emulated: fix segfault if backend not specified
* ccid-card-emulated: let last reader inserted win
* libcaccard: remove double vscard_common.h
v6->v7 changes:
* external libcaccard became internal directory libcaccard
* statically link object files into qemu
* produce libcaccard.so for usage by external projects
* applied coding style to new code (please check me)
- did not use the qemu options parsing for libcaccard, since
it seems to draw large amounts of qemu code (monitor for instance).
v5->v6 changes:
* really remove static debug (I apologize for claiming to have done so before)
v4->v5 changes:
* rebased to latest
* remove static debug in card devices
* fix --enable-smartcard to link
* stall instead of assert when exceeding BULK_OUT_DATA_SIZE
* make ccid_reserve_recv_buf for too large len discard message, not exit
* make ccid_reserve_recv_buf return void*
* fix typo
* remove commented code in VMState
v3->v4:
* remove ccid field in CCIDBus
* remove static debug in bus
* add back docs
v2->v3:
* split into bus (usb-ccid.c, uses ccid.h) and card (ccid-card-passthru.c).
* removed documentation (being revised).
v1->v2:
* all QSIMPLEQ turned into fixed sized rings
* all allocated buffers turned into fixed size buffers
* added migration support
* added a message to tell client qemu has migrated to ip:port
* for lack of monitor commands ip:port are 0:0, which causes the updated
vscclient to connect to one port higher on the same host. will add monitor
commands in a separate patch. tested with current setup.
Alon Levy (19):
qdev: add print_options callback
qdev: add data pointer to Property
qdev-properties: add PROP_TYPE_ENUM
qdev-properties: parse_enum: don't cast a void*
usb-ccid: add CCID bus
usb-ccid: review fixes (v15-v16)
introduce libcacard/vscard_common.h
libcacard/vscard_common.h update (v15->v16)
ccid: add passthru card device
ccid-card-passthru: review fixes (v15->v16)
libcacard: fixes from review (v15->v16)
ccid: add ccid-card-emulated device (v2)
ccid-card-emulated: use PROP_TYPE_ENUM for backend
ccid-card-emulated: review fixes (v15->v16)
ccid: add docs
ccid: configure: add --enable/disable and nss only disable
ccid: add qdev description strings
smartcard,configure: add --enable-smartcard-nss, report only nss
smartcard,configure: report only nss
Robert Relyea (1):
libcacard: initial commit after coding style fixes
Makefile | 6 +-
Makefile.objs | 7 +
Makefile.target | 2 +
configure | 59 ++
docs/ccid.txt | 135 +++++
docs/libcacard.txt | 483 +++++++++++++++
hw/ccid-card-emulated.c | 551 ++++++++++++++++++
hw/ccid-card-passthru.c | 328 +++++++++++
hw/ccid.h | 42 ++
hw/qdev-properties.c | 60 ++
hw/qdev.c | 10 +-
hw/qdev.h | 17 +
hw/usb-ccid.c | 1353 +++++++++++++++++++++++++++++++++++++++++++
libcacard/Makefile | 14 +
libcacard/cac.c | 411 +++++++++++++
libcacard/cac.h | 20 +
libcacard/card_7816.c | 780 +++++++++++++++++++++++++
libcacard/card_7816.h | 60 ++
libcacard/card_7816t.h | 163 ++++++
libcacard/event.c | 112 ++++
libcacard/eventt.h | 28 +
libcacard/link_test.c | 20 +
libcacard/mutex.h | 59 ++
libcacard/passthru.c | 612 +++++++++++++++++++
libcacard/passthru.h | 50 ++
libcacard/vcard.c | 350 +++++++++++
libcacard/vcard.h | 85 +++
libcacard/vcard_emul.h | 62 ++
libcacard/vcard_emul_nss.c | 1192 +++++++++++++++++++++++++++++++++++++
libcacard/vcard_emul_type.c | 60 ++
libcacard/vcard_emul_type.h | 29 +
libcacard/vcardt.h | 66 +++
libcacard/vevent.h | 26 +
libcacard/vreader.c | 526 +++++++++++++++++
libcacard/vreader.h | 54 ++
libcacard/vreadert.h | 23 +
libcacard/vscard_common.h | 167 ++++++
libcacard/vscclient.c | 743 ++++++++++++++++++++++++
38 files changed, 8762 insertions(+), 3 deletions(-)
create mode 100644 docs/ccid.txt
create mode 100644 docs/libcacard.txt
create mode 100644 hw/ccid-card-emulated.c
create mode 100644 hw/ccid-card-passthru.c
create mode 100644 hw/ccid.h
create mode 100644 hw/usb-ccid.c
create mode 100644 libcacard/Makefile
create mode 100644 libcacard/cac.c
create mode 100644 libcacard/cac.h
create mode 100644 libcacard/card_7816.c
create mode 100644 libcacard/card_7816.h
create mode 100644 libcacard/card_7816t.h
create mode 100644 libcacard/event.c
create mode 100644 libcacard/eventt.h
create mode 100644 libcacard/link_test.c
create mode 100644 libcacard/mutex.h
create mode 100644 libcacard/passthru.c
create mode 100644 libcacard/passthru.h
create mode 100644 libcacard/vcard.c
create mode 100644 libcacard/vcard.h
create mode 100644 libcacard/vcard_emul.h
create mode 100644 libcacard/vcard_emul_nss.c
create mode 100644 libcacard/vcard_emul_type.c
create mode 100644 libcacard/vcard_emul_type.h
create mode 100644 libcacard/vcardt.h
create mode 100644 libcacard/vevent.h
create mode 100644 libcacard/vreader.c
create mode 100644 libcacard/vreader.h
create mode 100644 libcacard/vreadert.h
create mode 100644 libcacard/vscard_common.h
create mode 100644 libcacard/vscclient.c
--
1.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 01/20] qdev: add print_options callback
2011-02-02 20:28 [Qemu-devel] [PATCH 00/20] usb-ccid (v16) Alon Levy
@ 2011-02-02 20:28 ` Alon Levy
2011-02-03 16:39 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Alon Levy @ 2011-02-02 20:28 UTC (permalink / raw)
To: qemu-devel
another callback added to PropertyInfo, for later use by PROP_TYPE_ENUM.
Allows printing of runtime computed options when doing:
qemu -device foo,?
---
hw/qdev.c | 10 +++++++++-
hw/qdev.h | 1 +
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index c7fec44..0b2ad3d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -187,7 +187,15 @@ int qdev_device_help(QemuOpts *opts)
if (!prop->info->parse) {
continue; /* no way to set it, don't show */
}
- error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+ if (prop->info->print_options) {
+ char buf[256];
+ int ret;
+ ret = prop->info->print_options(info, prop, buf, sizeof(buf) - 3);
+ error_printf("%s.%s=%s%s\n", info->name, prop->name, buf,
+ ret == sizeof(buf) - 3 ? "..." : "" );
+ } else {
+ error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
+ }
}
return 1;
}
diff --git a/hw/qdev.h b/hw/qdev.h
index 9808f85..fa3221b 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -109,6 +109,7 @@ struct PropertyInfo {
enum PropertyType type;
int (*parse)(DeviceState *dev, Property *prop, const char *str);
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
+ int (*print_options)(DeviceInfo *info, Property *prop, char *dest, size_t len);
void (*free)(DeviceState *dev, Property *prop);
};
--
1.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 01/20] qdev: add print_options callback
2011-02-02 20:28 ` [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
@ 2011-02-03 16:39 ` Anthony Liguori
2011-02-03 20:54 ` Alon Levy
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2011-02-03 16:39 UTC (permalink / raw)
To: Alon Levy; +Cc: qemu-devel
On 02/02/2011 02:28 PM, Alon Levy wrote:
> another callback added to PropertyInfo, for later use by PROP_TYPE_ENUM.
> Allows printing of runtime computed options when doing:
> qemu -device foo,?
> ---
> hw/qdev.c | 10 +++++++++-
> hw/qdev.h | 1 +
> 2 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index c7fec44..0b2ad3d 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -187,7 +187,15 @@ int qdev_device_help(QemuOpts *opts)
> if (!prop->info->parse) {
> continue; /* no way to set it, don't show */
> }
> - error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + if (prop->info->print_options) {
> + char buf[256];
> + int ret;
> + ret = prop->info->print_options(info, prop, buf, sizeof(buf) - 3);
> + error_printf("%s.%s=%s%s\n", info->name, prop->name, buf,
> + ret == sizeof(buf) - 3 ? "..." : "" );
> + } else {
> + error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> + }
> }
> return 1;
> }
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 9808f85..fa3221b 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -109,6 +109,7 @@ struct PropertyInfo {
> enum PropertyType type;
> int (*parse)(DeviceState *dev, Property *prop, const char *str);
> int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
> + int (*print_options)(DeviceInfo *info, Property *prop, char *dest, size_t len);
>
I'm not clear what the different between print and print_options is and
why two callbacks are needed. Can you explain and comments to the patch
clarifying why two interfaces are needed. Even better would be if one
interface could handle it.
Regards,
Anthony Liguori
> void (*free)(DeviceState *dev, Property *prop);
> };
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 01/20] qdev: add print_options callback
2011-02-03 16:39 ` Anthony Liguori
@ 2011-02-03 20:54 ` Alon Levy
0 siblings, 0 replies; 5+ messages in thread
From: Alon Levy @ 2011-02-03 20:54 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
On Thu, Feb 03, 2011 at 10:39:40AM -0600, Anthony Liguori wrote:
> On 02/02/2011 02:28 PM, Alon Levy wrote:
> >another callback added to PropertyInfo, for later use by PROP_TYPE_ENUM.
> >Allows printing of runtime computed options when doing:
> > qemu -device foo,?
> >---
> > hw/qdev.c | 10 +++++++++-
> > hw/qdev.h | 1 +
> > 2 files changed, 10 insertions(+), 1 deletions(-)
> >
> >diff --git a/hw/qdev.c b/hw/qdev.c
> >index c7fec44..0b2ad3d 100644
> >--- a/hw/qdev.c
> >+++ b/hw/qdev.c
> >@@ -187,7 +187,15 @@ int qdev_device_help(QemuOpts *opts)
> > if (!prop->info->parse) {
> > continue; /* no way to set it, don't show */
> > }
> >- error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> >+ if (prop->info->print_options) {
> >+ char buf[256];
> >+ int ret;
> >+ ret = prop->info->print_options(info, prop, buf, sizeof(buf) - 3);
> >+ error_printf("%s.%s=%s%s\n", info->name, prop->name, buf,
> >+ ret == sizeof(buf) - 3 ? "..." : "" );
> >+ } else {
> >+ error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> >+ }
> > }
> > return 1;
> > }
> >diff --git a/hw/qdev.h b/hw/qdev.h
> >index 9808f85..fa3221b 100644
> >--- a/hw/qdev.h
> >+++ b/hw/qdev.h
> >@@ -109,6 +109,7 @@ struct PropertyInfo {
> > enum PropertyType type;
> > int (*parse)(DeviceState *dev, Property *prop, const char *str);
> > int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
> >+ int (*print_options)(DeviceInfo *info, Property *prop, char *dest, size_t len);
>
> I'm not clear what the different between print and print_options is
> and why two callbacks are needed. Can you explain and comments to
There is a difference in usage - the existing print is called when we do info during
execution, it shows the status of the device. print_options is given a DeviceInfo
and not a DeviceState and responds with the list we print for a command line invocation:
"qemu -device foo,? ", It is used to allow possible options that depend on available
runtime libraries or other resources. It also allows relatively easy implementation for
data that could be known at compile time, like names for enums, used by the next patches.
> the patch clarifying why two interfaces are needed. Even better
> would be if one interface could handle it.
>
> Regards,
>
> Anthony Liguori
>
>
> > void (*free)(DeviceState *dev, Property *prop);
> > };
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-03 20:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-02 21:46 [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
2011-02-03 10:21 ` Alon Levy
-- strict thread matches above, loose matches on Subject: below --
2011-02-02 20:28 [Qemu-devel] [PATCH 00/20] usb-ccid (v16) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
2011-02-03 16:39 ` Anthony Liguori
2011-02-03 20:54 ` Alon Levy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).