From nobody Mon Feb 9 22:04:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626108818044950.5656230476237; Mon, 12 Jul 2021 09:53:38 -0700 (PDT) Received: from localhost ([::1]:60034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2zBZ-0006tS-1m for importer@patchew.org; Mon, 12 Jul 2021 12:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2z8m-0000u9-AU for qemu-devel@nongnu.org; Mon, 12 Jul 2021 12:50:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31449) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2z8k-0002Wy-LS for qemu-devel@nongnu.org; Mon, 12 Jul 2021 12:50:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-8Bv8AzHcOkW6N86_xMzsow-1; Mon, 12 Jul 2021 12:50:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 246628042FE; Mon, 12 Jul 2021 16:50:39 +0000 (UTC) Received: from localhost (ovpn-112-230.ams2.redhat.com [10.36.112.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDC2F5D6BA; Mon, 12 Jul 2021 16:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626108641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WTJ9FEHHEZO1BSZakoJS4sd7+cxGKn5F0u8GqKxrbMk=; b=ezvoYwM/C+TiDenABCyONJQL5cnvmMPa3Y5fNw0uAzDjK9FLr/01gGCNbvTIghoGWwUHkL vIxVw2mIUY7xjzJRQ52y7vA+mS72bGPJajcCXcnbgx2h4UWLtEVrcrSHfjTDVwofmItlMo rBdfylmZzy1UKx1btdkdOnnJcWrBRuo= X-MC-Unique: 8Bv8AzHcOkW6N86_xMzsow-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 4/6] trace/simple: pass iter to st_write_event_mapping Date: Mon, 12 Jul 2021 17:49:59 +0100 Message-Id: <20210712165001.429113-5-stefanha@redhat.com> In-Reply-To: <20210712165001.429113-1-stefanha@redhat.com> References: <20210712165001.429113-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, "Dr. David Alan Gilbert" , Markus Armbruster , Gerd Hoffmann , Stefan Hajnoczi , Cleber Rosa , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626108818624100001 Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Pass an iter to st_write_event_mapping, so the function can interate different things depending on how we initialize the iter. Signed-off-by: Gerd Hoffmann Reviewed-by: Stefan Hajnoczi Message-id: 20210601132414.432430-5-kraxel@redhat.com Signed-off-by: Stefan Hajnoczi --- trace/simple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trace/simple.c b/trace/simple.c index 97b6f85168..ec2156d135 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -280,14 +280,12 @@ void trace_record_finish(TraceBufferRecord *rec) } } =20 -static int st_write_event_mapping(void) +static int st_write_event_mapping(TraceEventIter *iter) { uint64_t type =3D TRACE_RECORD_TYPE_MAPPING; - TraceEventIter iter; TraceEvent *ev; =20 - trace_event_iter_init_all(&iter); - while ((ev =3D trace_event_iter_next(&iter)) !=3D NULL) { + while ((ev =3D trace_event_iter_next(iter)) !=3D NULL) { uint64_t id =3D trace_event_get_id(ev); const char *name =3D trace_event_get_name(ev); uint32_t len =3D strlen(name); @@ -309,6 +307,7 @@ static int st_write_event_mapping(void) */ bool st_set_trace_file_enabled(bool enable) { + TraceEventIter iter; bool was_enabled =3D trace_fp; =20 if (enable =3D=3D !!trace_fp) { @@ -333,8 +332,9 @@ bool st_set_trace_file_enabled(bool enable) return was_enabled; } =20 + trace_event_iter_init_all(&iter); if (fwrite(&header, sizeof header, 1, trace_fp) !=3D 1 || - st_write_event_mapping() < 0) { + st_write_event_mapping(&iter) < 0) { fclose(trace_fp); trace_fp =3D NULL; return was_enabled; --=20 2.31.1