From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1H7j-00022z-Cs for qemu-devel@nongnu.org; Thu, 20 Apr 2017 14:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1H7i-0004br-LW for qemu-devel@nongnu.org; Thu, 20 Apr 2017 14:48:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45783) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1H7i-0004bd-FN for qemu-devel@nongnu.org; Thu, 20 Apr 2017 14:48:10 -0400 From: Eduardo Habkost Date: Thu, 20 Apr 2017 15:47:00 -0300 Message-Id: <20170420184705.25018-11-ehabkost@redhat.com> In-Reply-To: <20170420184705.25018-1-ehabkost@redhat.com> References: <20170420184705.25018-1-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 10/15] qdev: Make "hotplugged" property read-only List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Marcel Apfelbaum , Igor Mammedov The "hotplugged" property is user visible, but it was never meant to be set by the user. There are probably multiple ways to break or crash device code by overriding the property. For example, we recently fixed a crash in rtc_set_memory() related to the property (commit 26ef65beab852caf2b1ef4976e3473f2d525164d). There has been some discussion about making management software use "hotplugged=on" on migration, to indicate devices that were hotplugged in the migration source. There were other suggestions to address this, like including the "hotplugged" field in the migration stream instead of requiring it to be set explicitly. Whatever solution we choose in the future, this patch disables setting "hotplugged" explicitly in the command-line by now, because the ability to set the property is unused, untested, and undocumented. Signed-off-by: Eduardo Habkost Message-Id: <20170222192647.19690-1-ehabkost@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Signed-off-by: Eduardo Habkost --- hw/core/qdev.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 1e7fb33246..695d7c4216 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -1037,13 +1037,6 @@ static bool device_get_hotplugged(Object *obj, Error **err) return dev->hotplugged; } -static void device_set_hotplugged(Object *obj, bool value, Error **err) -{ - DeviceState *dev = DEVICE(obj); - - dev->hotplugged = value; -} - static void device_initfn(Object *obj) { DeviceState *dev = DEVICE(obj); @@ -1063,7 +1056,7 @@ static void device_initfn(Object *obj) object_property_add_bool(obj, "hotpluggable", device_get_hotpluggable, NULL, NULL); object_property_add_bool(obj, "hotplugged", - device_get_hotplugged, device_set_hotplugged, + device_get_hotplugged, NULL, &error_abort); class = object_get_class(OBJECT(dev)); -- 2.11.0.259.g40922b1