From nobody Fri Jul 4 23:57:13 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652378561; cv=none; d=zohomail.com; s=zohoarc; b=ZGpmJzxuEVnAldXo0Haj3wQqdS1vaO/sCsEa3jgD5c7oe9H3/xLPLToVnrnGrUVwElR9eXjpHH8VDo90r/V5Du+1sAbaSnSslb8dAuugEIZmtof87o5Fy8FwQFKZVrOpS0qcZEJb3TgGsGEokB1e9SPRWCqoTZ6uEZu8HdoW5ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652378561; 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=hHrr13SVmPCi8WY8+0M3Fh6bU4tF/bEOWylIC0/I66s=; b=hS4i9g1O81cFNLvfeurWPYh5DRxaItBBgnML6QyQJrVbgnx02meFR2pNRpJPUp44cv6NdyG0jm/NoLwTmTzmfv/+3xCPxN/PYQdjJeiua6QUi6rKRrqTEohAEcZpat5ItkzHR6moI41xPgSfV+8940mgtBYL8MY/I5JOYeLWkCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=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 1652378561987975.0989413159339; Thu, 12 May 2022 11:02:41 -0700 (PDT) Received: from localhost ([::1]:51494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npD96-00038O-U0 for importer2@patchew.org; Thu, 12 May 2022 14:02:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npCZQ-0004y2-8y for qemu-devel@nongnu.org; Thu, 12 May 2022 13:25:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npCZO-0005Bv-Mh for qemu-devel@nongnu.org; Thu, 12 May 2022 13:25:47 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-235-DtPuwUAYNTSFkcRQ1ay_yA-1; Thu, 12 May 2022 13:25:45 -0400 Received: by mail-ed1-f72.google.com with SMTP id r8-20020a056402018800b00428b43999feso3489932edv.5 for ; Thu, 12 May 2022 10:25:44 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m3-20020a170906848300b006f3ef214dc6sm2270964ejx.44.2022.05.12.10.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 10:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652376346; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hHrr13SVmPCi8WY8+0M3Fh6bU4tF/bEOWylIC0/I66s=; b=Uy9H0o+UEacm1WnkheOIpMYA00LRzRSFC+4FLMHTaHTjxwvt9PtLcs0p39wO1fvhOFIrhE BguuGRupvJ/a6uUrP9DKxirklvdrauGC4TaD7+eI8SJEiSrgjLatbQvlPdqXoavmQ9rsWY DM9D3CS+JxjkHwSNPMl2RcZLoJLpZs8= X-MC-Unique: DtPuwUAYNTSFkcRQ1ay_yA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hHrr13SVmPCi8WY8+0M3Fh6bU4tF/bEOWylIC0/I66s=; b=m0rsrDvD1T0Lhfvw7MAlaFGb1922DposJ6wB40GHV/HmCE0iipkT6TAIE5yDQ/mobp H8mNlfRZ1M22v76ZcDyKTgR/CEwOQsvqTAKFaqcPE4WMr8g0b4iQNmDcQDFSy/Kv+9TY Re/6/6fathlqhykIAqjhh2SH1OWp3Rr/5X6YC2gxlLVbJ64Ibx6mBRNx/B4LmQ9fogok gSTSvfnYF4HTsw0ld5LeBIEXJ4rGzD3dpOIEHLbEE+Wj+NcEtplxzrb1+yvqCy7d6JvJ vwHXTCgpaRkIrmZyKVgMpg+zTz6YAK58/+jWekxda0Jv/yrEgzPkdgtHJH5E2NdBqk6v IyVw== X-Gm-Message-State: AOAM5308AbfTwuHwZYijWPo6KriED462x7raFsBriGt0eu5tVz/HFDJz 32oIi0K4hsbHpYnzR673o+MjBIEs5I5eac3mVxdMTdVkQhiydRDb383bEyeC7SujIPDcwhCWZM8 YoIUAWZ9ex+gFz7XPG/sNcYKUmCMgCwi/p13R8mk2nJWQaeED3lebjV6BVIcPaaGJZdY= X-Received: by 2002:aa7:c6da:0:b0:428:24bc:e652 with SMTP id b26-20020aa7c6da000000b0042824bce652mr36194442eds.21.1652376343485; Thu, 12 May 2022 10:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNxZ01JqylR8FKN4+vaYPxcfazHONEnCJFxIOckxUv/qRoS/2bvzVckjgtICvzB4RdQz0dNg== X-Received: by 2002:aa7:c6da:0:b0:428:24bc:e652 with SMTP id b26-20020aa7c6da000000b0042824bce652mr36194424eds.21.1652376343248; Thu, 12 May 2022 10:25:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 17/27] net: slirp: introduce a wrapper struct for QemuTimer Date: Thu, 12 May 2022 19:24:55 +0200 Message-Id: <20220512172505.1065394-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220512172505.1065394-1-pbonzini@redhat.com> References: <20220512172505.1065394-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_LOW=-0.7, 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-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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652378563409100001 This struct will be extended in the next few patches to support the new slirp_handle_timer() call. For that we need to store an additional "int" for each SLIRP timer, in addition to the cb_opaque. Reviewed-by: Samuel Thibault Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- net/slirp.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index bc5e9e4f77..f1e25d741f 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -184,23 +184,32 @@ static int64_t net_slirp_clock_get_ns(void *opaque) return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); } =20 +struct SlirpTimer { + QEMUTimer timer; +} + static void *net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, void *opaque) { - return timer_new_full(NULL, QEMU_CLOCK_VIRTUAL, - SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL, - cb, cb_opaque); + SlirpTimer *t =3D g_new(SlirpTimer, 1); + timer_init_full(&t->timer, NULL, QEMU_CLOCK_VIRTUAL, + SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL, + cb, cb_opaque); + return t; } =20 static void net_slirp_timer_free(void *timer, void *opaque) { - timer_free(timer); + SlirpTimer *t =3D timer; + timer_del(&t->timer); + g_free(t); } =20 static void net_slirp_timer_mod(void *timer, int64_t expire_timer, void *opaque) { - timer_mod(timer, expire_timer); + SlirpTimer *t =3D timer; + timer_mod(&t->timer, expire_timer); } =20 static void net_slirp_register_poll_fd(int fd, void *opaque) --=20 2.36.0