Skip to content

Commit 9d903f3

Browse files
huthjasowang
authored andcommitted
net: Drop the legacy "name" parameter from the -net option
It's been deprecated since QEMU v3.1, so it's time to finally remove it. The "id" parameter can simply be used instead. Reviewed-by: Eric Blake <[email protected]> Signed-off-by: Thomas Huth <[email protected]> Signed-off-by: Jason Wang <[email protected]>
1 parent fda43b1 commit 9d903f3

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

docs/system/deprecated.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ The 'file' driver for drives is no longer appropriate for character or host
4747
devices and will only accept regular files (S_IFREG). The correct driver
4848
for these file types is 'host_cdrom' or 'host_device' as appropriate.
4949

50-
``-net ...,name=``\ *name* (since 3.1)
51-
''''''''''''''''''''''''''''''''''''''
52-
53-
The ``name`` parameter of the ``-net`` option is a synonym
54-
for the ``id`` parameter, which should now be used instead.
55-
5650
``-smp`` (invalid topologies) (since 3.1)
5751
'''''''''''''''''''''''''''''''''''''''''
5852

@@ -441,6 +435,15 @@ What follows is a record of recently removed, formerly deprecated
441435
features that serves as a record for users who have encountered
442436
trouble after a recent upgrade.
443437

438+
System emulator command line arguments
439+
--------------------------------------
440+
441+
``-net ...,name=``\ *name* (removed in 5.1)
442+
'''''''''''''''''''''''''''''''''''''''''''
443+
444+
The ``name`` parameter of the ``-net`` option was a synonym
445+
for the ``id`` parameter, which should now be used instead.
446+
444447
QEMU Machine Protocol (QMP) commands
445448
------------------------------------
446449

net/net.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -969,12 +969,10 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
969969
{
970970
Netdev legacy = {0};
971971
const Netdev *netdev;
972-
const char *name;
973972
NetClientState *peer = NULL;
974973

975974
if (is_netdev) {
976975
netdev = object;
977-
name = netdev->id;
978976

979977
if (netdev->type == NET_CLIENT_DRIVER_NIC ||
980978
!net_client_init_fun[netdev->type]) {
@@ -987,12 +985,6 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
987985
const NetLegacyOptions *opts = net->opts;
988986
legacy.id = net->id;
989987
netdev = &legacy;
990-
/* missing optional values have been initialized to "all bits zero" */
991-
name = net->has_id ? net->id : net->name;
992-
993-
if (net->has_name) {
994-
warn_report("The 'name' parameter is deprecated, use 'id' instead");
995-
}
996988

997989
/* Map the old options to the new flat type */
998990
switch (opts->type) {
@@ -1052,7 +1044,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
10521044
}
10531045
}
10541046

1055-
if (net_client_init_fun[netdev->type](netdev, name, peer, errp) < 0) {
1047+
if (net_client_init_fun[netdev->type](netdev, netdev->id, peer, errp) < 0) {
10561048
/* FIXME drop when all init functions store an Error */
10571049
if (errp && !*errp) {
10581050
error_setg(errp, QERR_DEVICE_INIT_FAILED,

qapi/net.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,13 @@
474474
#
475475
# @id: identifier for monitor commands
476476
#
477-
# @name: identifier for monitor commands, ignored if @id is present
478-
#
479477
# @opts: device type specific properties (legacy)
480478
#
481479
# Since: 1.2
482480
##
483481
{ 'struct': 'NetLegacy',
484482
'data': {
485483
'*id': 'str',
486-
'*name': 'str',
487484
'opts': 'NetLegacyOptions' } }
488485

489486
##

0 commit comments

Comments
 (0)