From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A36F0A0524; Wed, 2 Jun 2021 17:46:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 299474069F; Wed, 2 Jun 2021 17:46:52 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id E477740689 for <dev@dpdk.org>; Wed, 2 Jun 2021 17:46:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622648810; 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: in-reply-to:in-reply-to:references:references; bh=ai0M4+0Y9/jchSkHgOPJdCMtHpe5M8SOuryzgzasY8Y=; b=No1H/TF7HQWZ3rt3xu+chxq3ORLC1X+HA3b+A7eTfXwhdRNBSoGyI3jk93qEAWtkwZeLsq ALmD39bykp66IQmkhDZaQ6kzMJteC5/xiIx1an2bq166hE7XFLtoWEMPxqUZqe+nR8IhdH uaAIvwJt6geGq6hWAjfgwK/jWCUgobo= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-ymHG-gTGNoOGlNJ3zuQB_g-1; Wed, 02 Jun 2021 11:46:49 -0400 X-MC-Unique: ymHG-gTGNoOGlNJ3zuQB_g-1 Received: by mail-vs1-f72.google.com with SMTP id x76-20020a677c4f0000b0290258a100e1c0so717029vsc.17 for <dev@dpdk.org>; Wed, 02 Jun 2021 08:46:48 -0700 (PDT) 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:cc; bh=ai0M4+0Y9/jchSkHgOPJdCMtHpe5M8SOuryzgzasY8Y=; b=Wn9grRceafFwe+pCu5kPW1PUPoVacl7DLWyHrjc0g6cnA1RFlGbVJXtV8eXMC9JcGR hr+WjoGAZfpWue6mvxDffvxkBD+IlOy8Q6bf2HFPzUmk+yTEYqNouCGE+bedJLO/Iif9 9bM3lGeZZvem/Ta4XYVZGUYcyTmeQIuwJ1Jv6SPTVzCI6Dly63zSRY/b1Dp7k+T9ecnT 3dxD/cyP3pJIbmFLnmDf8NDO80t1Ac1beI8/jgwoGO3UtWuGIAEBqKX2QXOEcIwzFHMK QhgryZfEtGX0GYvnifT9stiB/HjdFnj/f4bgQh0JKFPpl8FI5+ED0DDGeZ8kMuYutRp+ UUqg== X-Gm-Message-State: AOAM531jRVyfxLouusbRZXNOLyFLrpNspYAm/zzLgIQzcX614xxs7Dlf TxSPj+x8BF39UJSverD3RBqmbFaLE6vogjVSZpX8B5MUtktHD+D41eHSwR5uPA68cOsHyjJLns9 eB834j4KF61F1n3k+xAw= X-Received: by 2002:a05:6102:67a:: with SMTP id z26mr9584099vsf.10.1622648808578; Wed, 02 Jun 2021 08:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnEAE+ask4pKlMCBoLqdX1hLi4mlf26WiNbeYDLvIgg+JZVI/lY03oxGAM5mYh/qZp3CyvjS+cweMmYmPflS4= X-Received: by 2002:a05:6102:67a:: with SMTP id z26mr9584061vsf.10.1622648808379; Wed, 02 Jun 2021 08:46:48 -0700 (PDT) MIME-Version: 1.0 References: <20210602095836.24901-1-david.marchand@redhat.com> <20210602095836.24901-3-david.marchand@redhat.com> <CALBAE1MmZbpotdLiuVdFSYeyM7hCU7Tw+UYoGHfYT5n6Z6jQrw@mail.gmail.com> In-Reply-To: <CALBAE1MmZbpotdLiuVdFSYeyM7hCU7Tw+UYoGHfYT5n6Z6jQrw@mail.gmail.com> From: David Marchand <david.marchand@redhat.com> Date: Wed, 2 Jun 2021 17:46:36 +0200 Message-ID: <CAJFAV8zErW9ORREXfBh2oq8Rq5Od93NriNnpgYEhKt21AqWa-A@mail.gmail.com> To: Jerin Jacob <jerinjacobk@gmail.com> Cc: dpdk-dev <dev@dpdk.org>, Aaron Conole <aconole@redhat.com>, Michael Santana <maicolgabriel@hotmail.com>, Bruce Richardson <bruce.richardson@intel.com>, Rasesh Mody <rmody@marvell.com>, Shahed Shaikh <shshaikh@marvell.com>, Qiming Yang <qiming.yang@intel.com>, Qi Zhang <qi.z.zhang@intel.com>, Heinrich Kuhn <heinrich.kuhn@netronome.com>, Devendra Singh Rawat <dsinghrawat@marvell.com>, Igor Russkikh <irusskikh@marvell.com>, Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>, Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>, Dmitry Malloy <dmitrym@microsoft.com>, Pallavi Kadam <pallavi.kadam@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 2/2] eal: handle compressed firmwares X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> On Wed, Jun 2, 2021 at 1:13 PM Jerin Jacob <jerinjacobk@gmail.com> wrote: > > +static int > > +firmware_read(const char *name, void **buf, size_t *bufsz) > > +{ > > + const size_t blocksize = 4096; > > + int ret = -1; > > + int err; > > +#ifdef RTE_HAS_LIBARCHIVE > > > I think, better to have small inline functions for libarchive variant > vs normal file accessors > in the group for open, access, read etc to avoid the ifdef clutter and > manage with one ifdef. That may be a bit artificial, since there is no reuse of such helpers for now. I'll have a try and see how it looks. > > +int > > +rte_firmware_read(const char *name, void **buf, size_t *bufsz) > > +{ > > + char path[PATH_MAX]; > > + int ret; > > + > > + ret = firmware_read(name, buf, bufsz); > > + if (ret < 0) { > > + snprintf(path, sizeof(path), "%s.xz", name); > > + path[PATH_MAX - 1] = '\0'; > > +#ifndef RTE_HAS_LIBARCHIVE > > See above There is nothing to abstract here. If you don't have libarchive, returning the .xz content to a driver is wrong. I prefer to leave this block as is. > > > + if (access(path, F_OK) == 0) { > > + RTE_LOG(WARNING, EAL, "libarchive not available, %s cannot be decompressed\n", > > + path); > > + } > > +#else > > + ret = firmware_read(path, buf, bufsz); > > +#endif > > > -- David Marchand