All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <dkiper@net-space.pl>
To: Nick Terrell <terrelln@fb.com>
Cc: David Sterba <dsterba@suse.cz>,
	kernel-team@fb.com, linux-btrfs@vger.kernel.org,
	grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Subject: Re: [PATCH v4 1/2] Import upstream zstd-1.3.6
Date: Tue, 6 Nov 2018 15:48:32 +0100	[thread overview]
Message-ID: <20181106144832.GA9907@router-fw-old.i.net-space.pl> (raw)
In-Reply-To: <20181031175617.230241-2-terrelln@fb.com>

On Wed, Oct 31, 2018 at 10:56:16AM -0700, Nick Terrell wrote:
> Import zstd-1.3.6 from upstream [1]. Only the files need for decompression
> are imported. Additionally makes zstd a module by adding module.c which
> contains the license, and updates Makefile.core.def.
>
> I used the latest zstd release, which includes patches [2] to build cleanly
> in GRUB.
>
> Upstream zstd commit hash: 4fa456d7f12f8b27bd3b2f5dfd4f46898cb31c24
> Upstream zstd commit name: Merge pull request #1354 from facebook/dev
>
> I've included the script used to import zstd-1.3.6 below.
>
> [1] https://github.com/facebook/zstd/releases/tag/v1.3.6
> [2] https://github.com/facebook/zstd/pull/1344
>
> ```
> #!/bin/sh -e
>
> curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz
> curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz.sha256
> sha256sum --check zstd-1.3.6.tar.gz.sha256
> tar xzf zstd-1.3.6.tar.gz
>
> SRC_LIB="zstd-1.3.6/lib"
> DST_LIB="grub-core/lib/zstd"
> rm -rf $DST_LIB
> mkdir -p $DST_LIB
> cp $SRC_LIB/zstd.h $DST_LIB/
> cp $SRC_LIB/common/*.[hc] $DST_LIB/
> cp $SRC_LIB/decompress/*.[hc] $DST_LIB/
> rm $DST_LIB/{pool.[hc],threading.[hc]}
> rm -rf zstd-1.3.6*
> echo SUCCESS!
> ```
>
> Signed-off-by: Nick Terrell <terrelln@fb.com>

I have a few concerns. First of all I can see that you include a lot of
standard headers, e.g. stdlib.h, string.h, stddef.h, etc. Where do they
come from? OS? If yes that is wrong. Additionally, I think that you
should not use standard types, e.g. size_t, because this may not work if
you cross compile. You have to use, e.g. grub_size_t. IMO the simplest
solution would be definition and usage of relevant zstd_* types, e.g.
zstd_size_t. Then e.g. zstd_size_t should be defined as grub_size_t.

[...]

> diff --git a/grub-core/lib/zstd/module.c b/grub-core/lib/zstd/module.c
> new file mode 100644
> index 000000000..e4d0cace8
> --- /dev/null
> +++ b/grub-core/lib/zstd/module.c
> @@ -0,0 +1,3 @@

Could you copy the header e.g. from grub-core/loader/multiboot_mbi2.c?
Of course you have to update the dates accordingly.

> +#include <grub/dl.h>
> +
> +GRUB_MOD_LICENSE ("GPLv3");

Daniel

  reply	other threads:[~2018-11-06 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 17:56 [PATCH v4 0/2] btrfs: Add zstd support to grub btrfs Nick Terrell
2018-10-31 17:56 ` [PATCH v4 1/2] Import upstream zstd-1.3.6 Nick Terrell
2018-11-06 14:48   ` Daniel Kiper [this message]
2018-11-06 19:43     ` Nick Terrell
2018-11-07 11:08       ` Daniel Kiper
2018-10-31 17:56 ` [PATCH v4 2/2] btrfs: Add zstd support to grub btrfs Nick Terrell
2018-11-06 15:06   ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181106144832.GA9907@router-fw-old.i.net-space.pl \
    --to=dkiper@net-space.pl \
    --cc=dsterba@suse.cz \
    --cc=grub-devel@gnu.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.