mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
usb: Remove legacy -usbdevice options (host, serial, disk and net)
The option have been marked as deprecated since QEMU 2.10, and so far nobody complained that the host, serial, disk and net options are urgently required anymore. So let's now get rid at least of this legacy pile, to simplify the usb code quite a bit. This patch removes the usbdevices host, serial, disk and net. These devices use their own complicated parameter parsing mechanisms, so they are just ugly to maintain, without real benefit for the users (the users can use the corresponding "-device" parameters instead which have the same complexity as the "-usbdevice" devices here). Note that the other rather simple -usbdevice options (mouse, tablet, etc.) are not removed yet (the code is really simple here, so it does not hurt much to keep it), as well as the two devices "braille" and "bt" which are easier to use with -usbdevice than with -device. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1515519171-20315-1-git-send-email-thuth@redhat.com [kraxel] delete some usb_host_device_open() leftovers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
2077fef91d
commit
99761176ee
9 changed files with 1 additions and 300 deletions
|
@ -666,63 +666,6 @@ static void usb_msd_bot_realize(USBDevice *dev, Error **errp)
|
|||
usb_msd_handle_reset(dev);
|
||||
}
|
||||
|
||||
static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
|
||||
{
|
||||
static int nr=0;
|
||||
Error *err = NULL;
|
||||
char id[8];
|
||||
QemuOpts *opts;
|
||||
DriveInfo *dinfo;
|
||||
USBDevice *dev;
|
||||
const char *p1;
|
||||
char fmt[32];
|
||||
|
||||
/* parse -usbdevice disk: syntax into drive opts */
|
||||
do {
|
||||
snprintf(id, sizeof(id), "usb%d", nr++);
|
||||
opts = qemu_opts_create(qemu_find_opts("drive"), id, 1, NULL);
|
||||
} while (!opts);
|
||||
|
||||
p1 = strchr(filename, ':');
|
||||
if (p1++) {
|
||||
const char *p2;
|
||||
|
||||
if (strstart(filename, "format=", &p2)) {
|
||||
int len = MIN(p1 - p2, sizeof(fmt));
|
||||
pstrcpy(fmt, len, p2);
|
||||
qemu_opt_set(opts, "format", fmt, &error_abort);
|
||||
} else if (*filename != ':') {
|
||||
error_report("unrecognized USB mass-storage option %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
filename = p1;
|
||||
}
|
||||
if (!*filename) {
|
||||
error_report("block device specification needed");
|
||||
return NULL;
|
||||
}
|
||||
qemu_opt_set(opts, "file", filename, &error_abort);
|
||||
qemu_opt_set(opts, "if", "none", &error_abort);
|
||||
|
||||
/* create host drive */
|
||||
dinfo = drive_new(opts, 0);
|
||||
if (!dinfo) {
|
||||
qemu_opts_del(opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create guest device */
|
||||
dev = usb_create(bus, "usb-storage");
|
||||
qdev_prop_set_drive(&dev->qdev, "drive", blk_by_legacy_dinfo(dinfo),
|
||||
&err);
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
object_unparent(OBJECT(dev));
|
||||
return NULL;
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_usb_msd = {
|
||||
.name = "usb-storage",
|
||||
.version_id = 1,
|
||||
|
@ -855,7 +798,6 @@ static void usb_msd_register_types(void)
|
|||
type_register_static(&usb_storage_dev_type_info);
|
||||
type_register_static(&msd_info);
|
||||
type_register_static(&bot_info);
|
||||
usb_legacy_register("usb-storage", "disk", usb_msd_init);
|
||||
}
|
||||
|
||||
type_init(usb_msd_register_types)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue