From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D350C433E0 for ; Fri, 19 Mar 2021 13:51:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D02AB64E74 for ; Fri, 19 Mar 2021 13:51:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D02AB64E74 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNFXQ-0006q1-RO for qemu-devel@archiver.kernel.org; Fri, 19 Mar 2021 09:51:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNFTD-0002sP-H8 for qemu-devel@nongnu.org; Fri, 19 Mar 2021 09:47:19 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:34626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNFTA-000726-QH for qemu-devel@nongnu.org; Fri, 19 Mar 2021 09:47:19 -0400 Received: by mail-io1-xd2c.google.com with SMTP id x16so6134019iob.1 for ; Fri, 19 Mar 2021 06:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Hx0oewVIdb++1wTuuUit5ZZl9+wRbl7ICpEspNHIgb4=; b=smiZdvoDY+4Jx8Z2e8wqKEynmjlEFsO3EuwOMh+XCReNtnoIF5L1fAOAaN+vUiFhAh iG9hhbgGYtlfcdHvHXMK4LTf+dBoo46F52uMkjrWQe0fFxv9Y40RLYjcRc3nl5KMTlBg slzOqjb15irhY8jIuUNG7TGCa1zMvEQP4eq3elApSHJugfjyzSimpvj93RkqeF9b97RN DsuugCiUBqLMLcVo7thm9cxkUDDaRWDBH6EZB3V8TdhNUiQ9+FTSBHOHuD90fbozLGPT thprR/FOalh2yMq2ZnjiStnDbsPiN0TiqyWIM1eg62Kb55MWX80jTyJ9LSxxO1AMG48W SKvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Hx0oewVIdb++1wTuuUit5ZZl9+wRbl7ICpEspNHIgb4=; b=BQbAQWALvUdX4Nd5ObQB8mBAfaV2qpuggjU26H6XvnBFveY5OuGCR2w3rBA/rFel9R hDjfPL1/2xWiIByA0CdFV+epB+ws4YeS3dvUWdO1/YlvCiYbxQMEX1AJ8d9U0ml3TSAh eJYJXmbJYIRj0+Kt6uAQKRsD6qorE9L1BvaSCTn4F/Xr0abb02Ufoig25F+Gge300f8r v4dI9n0vjWOqEuAmM9Ohkh4jTr05ofeiox4z5YHVLoywDqDFOvUxV8QxqJmdS+9UvjqN ldiH/kRxY/xo+Cx0YQiW1Ja+fF32bb+2mragBbmW8gS/lNJbRVd93WnB2Ece05HbFI2G n9BA== X-Gm-Message-State: AOAM530PVk1eMI4Oye4QzehlJELDCuBMKGlSDjlBuRPvdquB7/vbH1Q4 JpP6JWdpPPFdCd3oCsHgSBLizxnLRe1UO1XCIjt5ydSVsaA= X-Google-Smtp-Source: ABdhPJyIwb5dMCWVWeLc0lFkdb4FJ8EpCcY53RfmVqzLiHXaWafz1frBr7yDcPPSuLWgMdI98IXkKYUg9MA2B8ZgyTM= X-Received: by 2002:a6b:4109:: with SMTP id n9mr2739746ioa.43.1616161633600; Fri, 19 Mar 2021 06:47:13 -0700 (PDT) MIME-Version: 1.0 References: <20210319132527.3118-1-ma.mandourr@gmail.com> In-Reply-To: <20210319132527.3118-1-ma.mandourr@gmail.com> From: Mahmoud Mandour Date: Fri, 19 Mar 2021 15:47:03 +0200 Message-ID: Subject: Re: [PATCH 0/8] virtiofsd: Changed various allocations to GLib functions To: qemu-devel@nongnu.org, Stefan Hajnoczi , "Dr. David Alan Gilbert" Content-Type: multipart/alternative; boundary="00000000000012099305bde3f44d" Received-SPF: pass client-ip=2607:f8b0:4864:20::d2c; envelope-from=ma.mandourr@gmail.com; helo=mail-io1-xd2c.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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --00000000000012099305bde3f44d Content-Type: text/plain; charset="UTF-8" On Fri, Mar 19, 2021 at 3:25 PM Mahmoud Mandour wrote: > Replaced allocations done using malloc(), calloc(), and realloc() > to their equivalent functions in GLib. > > Memory that is allocated locally and freed when the function exits > are annotated g_autofree so that the deallocation is automatically > handled. Subsequently, I could remove a bunch of free() calls. > > Also, tried to keep the semantics of the code as is, but when the > allocation is a small one, or a crucial one, I replaced the > NULL-checking mechanisms with glib's functions that crash on error. > > This is related to a patch that I had submitted as a part of a > previous series. The previous patch had some errors. Also, I thought > that it's better to split the patch into smaller pieces. > > The previous patch can be found here: > https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg05153.html > > Mahmoud Mandour (8): > virtiofsd: Changed allocations of fuse_req to GLib functions > virtiofds: Changed allocations of iovec to GLib's functions > virtiofsd: Changed fuse_pollhandle allocation to GLib's functions > virtiofsd: Changed allocations of fuse_session to GLib's functions > virtiofsd: Changed allocation of lo_map_elems to GLib's functions > virtiofsd: Changed allocations of fv_VuDev & its internals to GLib > functions > virtiofsd/passthrough_ll.c: Changed local allocations to GLib > functions > virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib > > tools/virtiofsd/fuse_lowlevel.c | 43 +++++++++++--------------------- > tools/virtiofsd/fuse_virtio.c | 34 ++++++++----------------- > tools/virtiofsd/passthrough_ll.c | 21 ++++++---------- > 3 files changed, 34 insertions(+), 64 deletions(-) > > -- > 2.25.1 > > Hello, For some reason, my get_maintainers script auto cc-filling did not work, so I had to manually cc you. Sorry for the inconvenience. Mahmoud --00000000000012099305bde3f44d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Mar 19, 2021 at 3:25= PM Mahmoud Mandour <ma.mandour= r@gmail.com> wrote:
Replaced allocations done using malloc(), calloc(), and realloc(= )
to their equivalent functions in GLib.

Memory that is allocated locally and freed when the function exits
are annotated g_autofree so that the deallocation is automatically
handled. Subsequently, I could remove a bunch of free() calls.

Also, tried to keep the semantics of the code as is, but when the
allocation is a small one, or a crucial one, I replaced the
NULL-checking mechanisms with glib's functions that crash on error.

This is related to a patch that I had submitted as a part of a
previous series. The previous patch had some errors. Also, I thought
that it's better to split the patch into smaller pieces.

The previous patch can be found here:
https://lists.gnu.org/archive/htm= l/qemu-devel/2021-03/msg05153.html

Mahmoud Mandour (8):
=C2=A0 virtiofsd: Changed allocations of fuse_req to GLib functions
=C2=A0 virtiofds: Changed allocations of iovec to GLib's functions
=C2=A0 virtiofsd: Changed fuse_pollhandle allocation to GLib's function= s
=C2=A0 virtiofsd: Changed allocations of fuse_session to GLib's functio= ns
=C2=A0 virtiofsd: Changed allocation of lo_map_elems to GLib's function= s
=C2=A0 virtiofsd: Changed allocations of fv_VuDev & its internals to GL= ib
=C2=A0 =C2=A0 functions
=C2=A0 virtiofsd/passthrough_ll.c: Changed local allocations to GLib
=C2=A0 =C2=A0 functions
=C2=A0 virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib

=C2=A0tools/virtiofsd/fuse_lowlevel.c=C2=A0 | 43 +++++++++++---------------= ------
=C2=A0tools/virtiofsd/fuse_virtio.c=C2=A0 =C2=A0 | 34 ++++++++-------------= ----
=C2=A0tools/virtiofsd/passthrough_ll.c | 21 ++++++----------
=C2=A03 files changed, 34 insertions(+), 64 deletions(-)

--
2.25.1


Hello,
For some reason, my get_maintain= ers script auto cc-filling did not work, so I had to manually cc
= you.=C2=A0
Sorry for the inconvenience.

= Mahmoud=C2=A0
--00000000000012099305bde3f44d--