From nobody Sat Apr 5 01:16:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1739155427; cv=none; d=zohomail.com; s=zohoarc; b=IcWNR5Y88SdNHcwK+KhsSEttSrq18ix7qygH2kG1+P8yqspdf6eggWzZQJ4O668zjoUNv8jwlbysGopJ4j+iJQL5hHMMYBJQ1qXLTYXyAD9WUQ8k9fVbq0l8nqOyjdlictgobmxDxNl+71eniO9zCLmZVJKxho1iTIz/K7ngiHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1739155427; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lEjxp81QjE8ihoQ3AU87IG5bKHARMNav+Yo5JMKOQSM=; b=WHdjCE41lonGrDVlPjOlaNTV9tnmE2Xuz0uRAe41+n03o22s7sTi751Q0enQVw31s5BXolCR3rVwGuXJCmcENOPCOlM4TmWO/L7Oiy1bVQC/fT07EUqGKRRHBZFSdbW2ZOIm601GZgQO/bDT37Az/XEXSow0IKc3KZZWi27tUQ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1739155427697420.4990468474907; Sun, 9 Feb 2025 18:43:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1thJjr-000076-TN; Sun, 09 Feb 2025 21:41:35 -0500 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 1thJjo-00005O-Tm; Sun, 09 Feb 2025 21:41:32 -0500 Received: from mgamail.intel.com ([192.198.163.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thJjm-00087n-VJ; Sun, 09 Feb 2025 21:41:32 -0500 Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2025 18:41:29 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by fmviesa001.fm.intel.com with ESMTP; 09 Feb 2025 18:41:27 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1739155291; x=1770691291; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hb1E+rvhbzGMqxScQskJB9sjdylpqfV6pPId6e63v94=; b=TECYSYuRLpxyJ3U0nyltU/OjVP6w0S2wHQEvjQSiEGgj5jL+FxS/bHW9 5oDXr0da9tDSXyx+J+H0tCwNxfApkmQhjA33ADMRAZxrrdu0VK8yGJvAh 9X9VtY3N96luubYcSLi/mwKfvGrBXzG8u30bp6ZAtNPF0VEinSiL99eyh mllLL27u2/d+Bns/laMLfxsjjG+MlOPj/lLLmg4eg/MGvi/4c+stN0pB8 +BkxaWAs4oBgZuFQepZZk0fUSyKnhdJOzjB8pT2aMUQENCkha2PfCXEqm XujU9nohE6bNMKuUzDHmy/Jc0+wiXZmUDU10Wuuf18M8YQDIYc8+vnezv Q==; X-CSE-ConnectionGUID: gaKGANCZTJ+f+Pw+sVpwpg== X-CSE-MsgGUID: q0okhtYBQHGcutl/rmgvtA== X-IronPort-AV: E=McAfee;i="6700,10204,11340"; a="50351245" X-IronPort-AV: E=Sophos;i="6.13,273,1732608000"; d="scan'208";a="50351245" X-CSE-ConnectionGUID: +oR4jyecR3WQe0niqKW6dw== X-CSE-MsgGUID: QLOleOOuS1K0Z9ZIXkeC6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="142938209" From: Zhao Liu To: Paolo Bonzini , Manos Pitsidianakis , Junjie Mao , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org, Zhao Liu Subject: [PATCH v2 02/10] rust/qdev: add the macro to define bit property Date: Mon, 10 Feb 2025 11:00:43 +0800 Message-Id: <20250210030051.2562726-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250210030051.2562726-1-zhao1.liu@intel.com> References: <20250210030051.2562726-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.11; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -57 X-Spam_score: -5.8 X-Spam_bar: ----- X-Spam_report: (-5.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1739155429692019000 Content-Type: text/plain; charset="utf-8" HPET device (Rust device) needs to define the bit type property. Add a variant of define_property macro to define bit type property. Signed-off-by: Zhao Liu --- rust/qemu-api/src/qdev.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rust/qemu-api/src/qdev.rs b/rust/qemu-api/src/qdev.rs index 0041c66ed0cd..28d9be723d89 100644 --- a/rust/qemu-api/src/qdev.rs +++ b/rust/qemu-api/src/qdev.rs @@ -168,6 +168,18 @@ fn class_init(dc: &mut DeviceClass) { =20 #[macro_export] macro_rules! define_property { + ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty, bit =3D $b= itnr:expr, default =3D $defval:expr$(,)*) =3D> { + $crate::bindings::Property { + // use associated function syntax for type checking + name: ::std::ffi::CStr::as_ptr($name), + info: $prop, + offset: $crate::offset_of!($state, $field) as isize, + bitnr: $bitnr, + set_default: true, + defval: $crate::bindings::Property__bindgen_ty_1 { u: $defval = as u64 }, + ..$crate::zeroable::Zeroable::ZERO + } + }; ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty, default = =3D $defval:expr$(,)*) =3D> { $crate::bindings::Property { // use associated function syntax for type checking --=20 2.34.1