linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lasse Collin <lasse.collin@tukaani.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Lasse Collin <lasse.collin@tukaani.org>,
	Jia Tan <jiat0218@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 05/11] xz: Fix comments and coding style
Date: Wed, 20 Mar 2024 20:38:38 +0200	[thread overview]
Message-ID: <20240320183846.19475-6-lasse.collin@tukaani.org> (raw)
In-Reply-To: <20240320183846.19475-1-lasse.collin@tukaani.org>

- Update the URL of the .xz file format specification.
- Fix comments that were no longer in sync with the code below them.
- Fix language errors.
- Fix coding style.

Reviewed-by: Jia Tan <jiat0218@gmail.com>
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
---
 lib/decompress_unxz.c | 20 ++++++++++----------
 lib/xz/Kconfig        |  3 ++-
 lib/xz/xz_stream.h    |  2 +-
 scripts/Makefile.lib  | 13 ++++++++-----
 4 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
index 34bb7efc0412..46aa3be13fc5 100644
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -102,7 +102,7 @@
 #ifdef STATIC
 #	define XZ_PREBOOT
 #else
-#include <linux/decompress/unxz.h>
+#	include <linux/decompress/unxz.h>
 #endif
 #ifdef __KERNEL__
 #	include <linux/decompress/mm.h>
@@ -219,7 +219,7 @@ void *memmove(void *dest, const void *src, size_t size)
 #endif
 
 /*
- * Since we need memmove anyway, would use it as memcpy too.
+ * Since we need memmove anyway, we could use it as memcpy too.
  * Commented out for now to avoid breaking things.
  */
 /*
@@ -389,17 +389,17 @@ STATIC int INIT unxz(unsigned char *in, long in_size,
 }
 
 /*
- * This macro is used by architecture-specific files to decompress
+ * This function is used by architecture-specific files to decompress
  * the kernel image.
  */
 #ifdef XZ_PREBOOT
-STATIC int INIT __decompress(unsigned char *buf, long len,
-			   long (*fill)(void*, unsigned long),
-			   long (*flush)(void*, unsigned long),
-			   unsigned char *out_buf, long olen,
-			   long *pos,
-			   void (*error)(char *x))
+STATIC int INIT __decompress(unsigned char *in, long in_size,
+			     long (*fill)(void *dest, unsigned long size),
+			     long (*flush)(void *src, unsigned long size),
+			     unsigned char *out, long out_size,
+			     long *in_used,
+			     void (*error)(char *x))
 {
-	return unxz(buf, len, fill, flush, out_buf, pos, error);
+	return unxz(in, in_size, fill, flush, out, in_used, error);
 }
 #endif
diff --git a/lib/xz/Kconfig b/lib/xz/Kconfig
index aef086a6bf2f..6b80453d8f54 100644
--- a/lib/xz/Kconfig
+++ b/lib/xz/Kconfig
@@ -5,7 +5,8 @@ config XZ_DEC
 	help
 	  LZMA2 compression algorithm and BCJ filters are supported using
 	  the .xz file format as the container. For integrity checking,
-	  CRC32 is supported. See Documentation/staging/xz.rst for more information.
+	  CRC32 is supported. See Documentation/staging/xz.rst for more
+	  information.
 
 if XZ_DEC
 
diff --git a/lib/xz/xz_stream.h b/lib/xz/xz_stream.h
index 55f9f6f94b78..242500bd025d 100644
--- a/lib/xz/xz_stream.h
+++ b/lib/xz/xz_stream.h
@@ -18,7 +18,7 @@
 
 /*
  * See the .xz file format specification at
- * https://tukaani.org/xz/xz-file-format.txt
+ * https://xz.tukaani.org/format/xz-file-format.txt
  * to understand the container format.
  */
 
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1bd59b8db05f..986c79c5af89 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -500,14 +500,17 @@ quiet_cmd_uimage = UIMAGE  $@
 
 # XZ
 # ---------------------------------------------------------------------------
-# Use xzkern to compress the kernel image and xzmisc to compress other things.
+# Use xzkern or xzkern_with_size to compress the kernel image and xzmisc to
+# compress other things.
 #
 # xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage
 # of the kernel decompressor. A BCJ filter is used if it is available for
-# the target architecture. xzkern also appends uncompressed size of the data
-# using size_append. The .xz format has the size information available at
-# the end of the file too, but it's in more complex format and it's good to
-# avoid changing the part of the boot code that reads the uncompressed size.
+# the target architecture.
+#
+# xzkern_with_size also appends uncompressed size of the data using
+# size_append. The .xz format has the size information available at the end
+# of the file too, but it's in more complex format and it's good to avoid
+# changing the part of the boot code that reads the uncompressed size.
 # Note that the bytes added by size_append will make the xz tool think that
 # the file is corrupt. This is expected.
 #
-- 
2.44.0


  parent reply	other threads:[~2024-03-20 18:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 18:38 [PATCH 00/11] xz: Updates to license, filters, and compression options Lasse Collin
2024-03-20 18:38 ` [PATCH 01/11] MAINTAINERS: Add XZ Embedded maintainers Lasse Collin
2024-03-20 18:38 ` [PATCH 02/11] LICENSES: Add 0BSD license text Lasse Collin
2024-03-20 18:38 ` [PATCH 03/11] xz: Switch from public domain to BSD Zero Clause License (0BSD) Lasse Collin
2024-03-20 18:38 ` [PATCH 04/11] xz: Documentation/staging/xz.rst: Revise thoroughly Lasse Collin
2024-03-20 18:38 ` Lasse Collin [this message]
2024-03-20 18:38 ` [PATCH 06/11] xz: Cleanup CRC32 edits from 2018 Lasse Collin
2024-03-20 18:38 ` [PATCH 07/11] xz: Optimize for-loop conditions in the BCJ decoders Lasse Collin
2024-03-20 18:38 ` [PATCH 08/11] xz: Add ARM64 BCJ filter Lasse Collin
2024-03-20 18:38 ` [PATCH 09/11] xz: Add RISC-V " Lasse Collin
2024-03-20 18:38 ` [PATCH 10/11] xz: Use 128 MiB dictionary and force single-threaded mode Lasse Collin
2024-03-20 18:38 ` [PATCH 11/11] xz: Adjust arch-specific options for better kernel compression Lasse Collin
2024-03-31  0:42   ` angel.lkml
2024-04-03 19:59     ` Lasse Collin
2024-04-04 14:01       ` Lasse Collin
2024-03-29 19:24 ` [PATCH 00/11] xz: Updates to license, filters, and compression options Jonathan Bennett
2024-03-29 19:32 ` Kees Cook
2024-03-29 20:51   ` [tech-board] " Jonathan Corbet
2024-03-30  0:37     ` Kees Cook
2024-03-30  2:56     ` [tech-board] " Andrew Morton
2024-03-30 12:48       ` Lasse Collin
2024-03-30 13:54         ` Kees Cook

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=20240320183846.19475-6-lasse.collin@tukaani.org \
    --to=lasse.collin@tukaani.org \
    --cc=akpm@linux-foundation.org \
    --cc=jiat0218@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).