From nobody Tue Feb 10 19:00:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@quicinc.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=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1657804072; cv=none; d=zohomail.com; s=zohoarc; b=LooLrHND8Bzbtc1Zl2YBFeXznc3ftR7CuGD1IHzyttadqFBpPyp883sRECFdA1HXmarV+OKiauBHPN5lmSR8AxBE3lV5W9Rnw6/4346oGwPf59xPf1gtkdNF9fz3FQaXX9NHfuJotBuzf5mDmB0xx3eh7zU6cCvv/EKv6Konk1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657804072; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RIKpd2Q+yGIVTQRutafUU3qoU3iFdQUM9sknwaRG9ho=; b=Qx5jMMKYU5m/Ux8MLU2ABo4voVtx8IZvpqi5PJ5YQdy/kM+d6D+Yx/quSugjpvCF8PD4FHBPME7avhxcQh3Ru0ARxlsKlMt+Tm+LBeLSKtXgLIce1HbCGt4B5RHpQ9xrBNMHs2Vim3bj+LZtcH6Fj2074HB0hGUtcPusDUmFqHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@quicinc.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 1657804072891828.9164255995066; Thu, 14 Jul 2022 06:07:52 -0700 (PDT) Received: from localhost ([::1]:46270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oByZL-0007do-Tg for importer@patchew.org; Thu, 14 Jul 2022 09:07:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBo6I-0003YM-Cw; Wed, 13 Jul 2022 21:57:10 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:17042) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1oBo6D-0000VC-BY; Wed, 13 Jul 2022 21:57:09 -0400 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 13 Jul 2022 18:57:04 -0700 Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 18:57:04 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 13 Jul 2022 18:57:03 -0700 Received: from perseverance.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 13 Jul 2022 18:57:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657763825; x=1689299825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RIKpd2Q+yGIVTQRutafUU3qoU3iFdQUM9sknwaRG9ho=; b=xoypgF2eJUzEwdaOwr6zQM1vtFBE1Um5PBTzduBvZEFEI8I5cNuwvlWb jYbcnslZBpV/KqeH8dT0vu/uP4vBnaTUhec0aYBX/WQfkZEah0p597FNq iUNsFr9TCW8FF+hvXuSgSQ6IG5b2RKol7Sfce+mSBgNiS5BpX1L4ku616 g=; X-QCInternal: smtphost From: Maheswara Kurapati To: , , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= CC: Paolo Bonzini , "Daniel P . Berrange" , Eduardo Habkost , Graeme Gregory , Jae Hyun Yoo , Maheswara Kurapati Subject: [PATCH 1/3] qom/object : add object_property_add_int8_ptr() property for 8 bit signed integers. Date: Wed, 13 Jul 2022 20:56:35 -0500 Message-ID: <20220714015637.817066-2-quic_mkurapat@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220714015637.817066-1-quic_mkurapat@quicinc.com> References: <20220714015637.817066-1-quic_mkurapat@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) 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=199.106.114.38; envelope-from=quic_mkurapat@quicinc.com; helo=alexa-out-sd-01.qualcomm.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 14 Jul 2022 09:02:08 -0400 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" X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1657804074791100001 Content-Type: text/plain; charset="utf-8" Current implementation lacks the support to add signed 8 bit integer property to an Object. This fix adds the necessary infrastructure routines. Signed-off-by: Maheswara Kurapati --- include/qom/object.h | 21 ++++++++++++++++ qom/object.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index ef7258a5e1..60b88ed685 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1764,6 +1764,27 @@ typedef enum { OBJ_PROP_FLAG_READWRITE =3D (OBJ_PROP_FLAG_READ | OBJ_PROP_FLAG_WRITE), } ObjectPropertyFlags; =20 +/** + * object_property_add_int8_ptr: + * @obj: the object to add a property to + * @name: the name of the property + * @v: pointer to value + * @flags: bitwise-or'd ObjectPropertyFlags + * + * Add a signed integer property in memory. This function will add a + * property of type 'int8'. + * + * Returns: The newly added property on success, or %NULL on failure. + */ +ObjectProperty *object_property_add_int8_ptr(Object *obj, const char *name, + const int8_t *v, + ObjectPropertyFlags flags); + +ObjectProperty *object_class_property_add_int8_ptr(ObjectClass *klass, + const char *name, + const int8_t *v, + ObjectPropertyFlags flags); + /** * object_property_add_uint8_ptr: * @obj: the object to add a property to diff --git a/qom/object.c b/qom/object.c index d34608558e..1a0e64157f 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2450,6 +2450,26 @@ static char *object_get_type(Object *obj, Error **er= rp) return g_strdup(object_get_typename(obj)); } =20 +static void property_get_int8_ptr(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + int8_t value =3D *(int8_t *)opaque; + visit_type_int8(v, name, &value, errp); +} + +static void property_set_int8_ptr(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + int8_t *field =3D opaque; + int8_t value; + + if (!visit_type_int8(v, name, &value, errp)) { + return; + } + + *field =3D value; +} + static void property_get_uint8_ptr(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { @@ -2530,6 +2550,46 @@ static void property_set_uint64_ptr(Object *obj, Vis= itor *v, const char *name, *field =3D value; } =20 +ObjectProperty * +object_property_add_int8_ptr(Object *obj, const char *name, + const int8_t *v, + ObjectPropertyFlags flags) +{ + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_int8_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_int8_ptr; + } + + return object_property_add(obj, name, "int8", + getter, setter, NULL, (void *)v); +} + +ObjectProperty * +object_class_property_add_int8_ptr(ObjectClass *klass, const char *name, + const int8_t *v, + ObjectPropertyFlags flags) +{ + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_int8_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_int8_ptr; + } + + return object_class_property_add(klass, name, "int8", + getter, setter, NULL, (void *)v); +} + ObjectProperty * object_property_add_uint8_ptr(Object *obj, const char *name, const uint8_t *v, --=20 2.25.1