From patchwork Thu Apr 24 19:49:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 883957 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp3619518wrs; Thu, 24 Apr 2025 12:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUCrjTrWaArRNh/8MzbvXX78Y4znnMY5/vdF0N5q0cMOB+4WqDJyrwD8OYOArhb/jWOMQvZiQ==@linaro.org X-Google-Smtp-Source: AGHT+IF3H7YRfoLbC8aaqq7JnQzL/XEEU1cEHMRI9WDVLCPLq7gEXlOk6VWtZKDDjeIAcd/svJE8 X-Received: by 2002:a05:622a:1aa6:b0:477:64dd:5765 with SMTP id d75a77b69052e-47fbbb473a1mr17424291cf.44.1745524286328; Thu, 24 Apr 2025 12:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745524286; cv=none; d=google.com; s=arc-20240605; b=ZaESd1eCM+C/I1LwoFedBcu/yrtrinPpAhaEtdz+dwjHBdyy/kg2qCEZsvS0nLOeIt LYeZlkOKBiJL1GjDaPL1v4yR3H5Xg8tdfgwz+A7IV8CLMXWbE50bY4QqEC15YlP11ayy n/asmp7p4d2nkFDK+ltg9cNHPDUTPxYgx2o5Yg4imi/RRzmc4Xb3Vdg+KJhHc+t9/fpq DcrthhKcHbEloelLNYAwUnbeZS9wLZZWG12hKlIMMeMyQDVjEqnizqXon+fj6FS4rAhs I2d1ZEiZaYeukuQ744ujHDoHTIJr6m/oLm7dGE1F470StfGu7L4cnB/q7c8gHkM9acay 6CVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gAInPnbXVwc6+e5dH8946wooc5VHdtYj4fpx4QEz7pc=; fh=5gGtEWbs/bc4ZS50ZuMZZ2I/Jn5oaYqe3uWxuR8fBxU=; b=bNPgBrBqW6PRKbGyvAzF2eQk888QkIDF3DSVxh5ZykSDzCq/UIx1AlSTEQ+lzeZDcd 2v6ViGHTqhiAqqajknuJcMIo2iGftHfzGbEtqlfW3AmeMffs1NkOSj7TElYApg3PDqPe fPr3rfMd4CkdEkz9+5MN3sye9fYbiNiRpm4HCpsy6lcU/jWVWEvu/4eE4EV5t2aFk/Sn QBcUJ8IeOpM5rnJdfhBrmLG/5nQKQH5W4RfleeqZnAp80RieUFUSV9XodtjNtw4x25GK Dy/ZaCrS+FuQ6+lowb8vICblvxd9bO4UBd9vOQxADA1hInyZpVqPmWOF5+8AMwVq6Gzx EmuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wKMdzNDi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47ea2bab6ccsi22286631cf.661.2025.04.24.12.51.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Apr 2025 12:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wKMdzNDi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u82Zi-0003In-E0; Thu, 24 Apr 2025 15:49:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u82ZU-0003GA-ND for qemu-devel@nongnu.org; Thu, 24 Apr 2025 15:49:23 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u82ZS-0001PI-U6 for qemu-devel@nongnu.org; Thu, 24 Apr 2025 15:49:20 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43cfebc343dso9910925e9.2 for ; Thu, 24 Apr 2025 12:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745524157; x=1746128957; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gAInPnbXVwc6+e5dH8946wooc5VHdtYj4fpx4QEz7pc=; b=wKMdzNDipCnyKvjQmBkItOIIZ7jlQJxTRCDLOCoN34YLDv8HT4Sqru88C1hko301nU fyT8o55vDFvaO2IZB4s+jdn5H1QiV97XqBT1rGzbfnwM0+3eN9oY6rMw0G4Ig4DkluH7 qlqJf5mGmLMIdMDYQ4eUH8Y0XRAnLBc+2asdZoboery0Sx1tgjOaZcErmmRWb2unZL9G B7fk3ckSdI/PxaTNuJcCpThVG+vBGtw597bgsbmQy1CPKcHTn97foL+SvSgilcQ5Q9g5 mUuOAoAlTKj+xggHnz0eIbs3yVW1eBoV40DtEAotsCoKffAGalFyFW1Lzo8odkLyWyc9 SnHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745524157; x=1746128957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gAInPnbXVwc6+e5dH8946wooc5VHdtYj4fpx4QEz7pc=; b=De6HNjMeu+giHb1ZRgql6SgG1789rW2/+Z+GhqHBlZLmsAafaq4lJDV7jT/Gd3oF/1 JtFPOoRsmrLHbWLd+Z9zTzJ+hMc/iL+jMFwRwdqLBgkMUq0vKnzugh+Ux5tJR+PMmmmo JfZ8Z/C3n5DkH+vWJFq9VM9V+U0yR9X2F7vOC+ZtQh5CeEhHbAkPOvvA4uf5E7VbDxOj tMEnjF31Q1P/O0y8vGgwIlBA7jxujCkFJlvkNIuOHjdoBCmYyfbqmL0ZqzIm1Idf8PLT OfalWo/HlSO7IUK4/S9BlGel5IJVz2jmWzITuKRb+TN7Be52YviyZrZIF5tr3Ziskl9u reYQ== X-Gm-Message-State: AOJu0YxfNmbdk0YyE6q+g6FQS+oXW9Cc91xvaadWbTx0Msmd0pCeJDd4 VI40L+/o0Ub6b9cFwV25VUPmhWu0/DrH43zbS50OZ90L5zFbvhvOQqNUBJfnfqHjo49VexFs1j6 C X-Gm-Gg: ASbGncuNZQQlgvvvZum3KF3C2yn6lsbTyGqZ1uMvs/4+oG/6KB2eKxBWOS4vbrEx/0R AtO9ddRng8T1QVSCz03d4/wYWG7JbhYleLYoOYj+GfFL8HHi2NvRja1EbqEgmto8CRitkoaRwJ/ P5oFHVVPY2aJ19jhaQa6EIjRGRQyn47tGf3X3hM+Z1h+C7miESXfBB5H+aQ9ivr49BsvGgztecs yn73waVatCEQMwlf74PqJ4OZZxgR/qcLzC+3fh+gtxFACSQuvxBaESnuIXK77IWXZoyYxDMYtwl Iil4Q/AxUlhL3caHnKmHi/sQNPYNkSchBeu6UdZZvX0U0GPhiiqsky/cCG7W8LL9y5rV8MrzLnj 1BeDe539jBvkfMjU= X-Received: by 2002:a05:600c:a47:b0:43d:fa58:81d4 with SMTP id 5b1f17b1804b1-4409bd8e123mr35290315e9.33.1745524156869; Thu, 24 Apr 2025 12:49:16 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4409d2a13bdsm32016265e9.9.2025.04.24.12.49.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 24 Apr 2025 12:49:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 2/6] qom: Have class_base_init() take a const data argument Date: Thu, 24 Apr 2025 21:49:01 +0200 Message-ID: <20250424194905.82506-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250424194905.82506-1-philmd@linaro.org> References: <20250424194905.82506-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qom/object.h | 2 +- hw/core/machine.c | 2 +- hw/core/qdev.c | 2 +- hw/pci/pci.c | 2 +- qom/object.c | 2 +- rust/qemu-api/src/qom.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 9192265db76..7bb14ca7067 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -487,7 +487,7 @@ struct TypeInfo size_t class_size; void (*class_init)(ObjectClass *klass, void *data); - void (*class_base_init)(ObjectClass *klass, void *data); + void (*class_base_init)(ObjectClass *klass, const void *data); void *class_data; InterfaceInfo *interfaces; diff --git a/hw/core/machine.c b/hw/core/machine.c index 63c6ef93d29..32f43f61698 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1240,7 +1240,7 @@ static void machine_class_init(ObjectClass *oc, void *data) "Memory size configuration"); } -static void machine_class_base_init(ObjectClass *oc, void *data) +static void machine_class_base_init(ObjectClass *oc, const void *data) { MachineClass *mc = MACHINE_CLASS(oc); mc->max_cpus = mc->max_cpus ?: 1; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 2745b5e0929..1e0f47cc848 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -693,7 +693,7 @@ static void device_finalize(Object *obj) g_free(dev->id); } -static void device_class_base_init(ObjectClass *class, void *data) +static void device_class_base_init(ObjectClass *class, const void *data) { DeviceClass *klass = DEVICE_CLASS(class); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 2844ec55560..475b97c649e 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2809,7 +2809,7 @@ static void pci_device_class_init(ObjectClass *klass, void *data) "access to indirect DMA memory"); } -static void pci_device_class_base_init(ObjectClass *klass, void *data) +static void pci_device_class_base_init(ObjectClass *klass, const void *data) { if (!object_class_is_abstract(klass)) { ObjectClass *conventional = diff --git a/qom/object.c b/qom/object.c index 01618d06bd8..dfd59502d11 100644 --- a/qom/object.c +++ b/qom/object.c @@ -55,7 +55,7 @@ struct TypeImpl size_t instance_align; void (*class_init)(ObjectClass *klass, void *data); - void (*class_base_init)(ObjectClass *klass, void *data); + void (*class_base_init)(ObjectClass *klass, const void *data); void *class_data; diff --git a/rust/qemu-api/src/qom.rs b/rust/qemu-api/src/qom.rs index 34d7bc0ef96..03fe6247ff6 100644 --- a/rust/qemu-api/src/qom.rs +++ b/rust/qemu-api/src/qom.rs @@ -492,7 +492,7 @@ pub trait ObjectImpl: ObjectType + IsA { /// the effects of copying the contents of the parent's class struct /// to the descendants. const CLASS_BASE_INIT: Option< - unsafe extern "C" fn(klass: *mut ObjectClass, data: *mut c_void), + unsafe extern "C" fn(klass: *mut ObjectClass, data: *const c_void), > = None; const TYPE_INFO: TypeInfo = TypeInfo {