All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schier <nsc@kernel.org>
To: David Disseldorp <ddiss@suse.de>
Cc: linux-kbuild@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-next@vger.kernel.org
Subject: Re: [PATCH v2 2/7] gen_init_cpio: support -o <output_path> parameter
Date: Mon, 18 Aug 2025 20:40:34 +0200	[thread overview]
Message-ID: <aKNzon8sMXtpNItJ@levanger> (raw)
In-Reply-To: <20250814054818.7266-3-ddiss@suse.de>

On Thu, Aug 14, 2025 at 03:18:00PM +1000, David Disseldorp wrote:
> This is another preparatory change to allow for reflink-optimized
> cpio archives with file data written / cloned via copy_file_range().
> The output file is truncated prior to write, so that it maps to
> usr/gen_initramfs.sh usage. It may make sense to offer an append option
> in future, for easier archive concatenation.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
>  usr/gen_init_cpio.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
> index d8779fe4b8f1f..563594a0662a6 100644
> --- a/usr/gen_init_cpio.c
> +++ b/usr/gen_init_cpio.c
> @@ -110,7 +110,7 @@ static int cpio_trailer(void)
>  	 || push_pad(padlen(offset, 512)) < 0)
>  		return -1;
>  
> -	return 0;
> +	return fsync(outfd);
>  }
>  
>  static int cpio_mkslink(const char *name, const char *target,
> @@ -532,7 +532,7 @@ static int cpio_mkfile_line(const char *line)
>  static void usage(const char *prog)
>  {
>  	fprintf(stderr, "Usage:\n"
> -		"\t%s [-t <timestamp>] [-c] <cpio_list>\n"
> +		"\t%s [-t <timestamp>] [-c] [-o <output_path>] <cpio_list>\n"
>  		"\n"
>  		"<cpio_list> is a file containing newline separated entries that\n"
>  		"describe the files to be included in the initramfs archive:\n"
> @@ -569,7 +569,8 @@ static void usage(const char *prog)
>  		"as mtime for symlinks, directories, regular and special files.\n"
>  		"The default is to use the current time for all files, but\n"
>  		"preserve modification time for regular files.\n"
> -		"-c: calculate and store 32-bit checksums for file data.\n",
> +		"-c: calculate and store 32-bit checksums for file data.\n"
> +		"<output_path>: write cpio to this file instead of stdout\n",

gen_init_cpio writes only a single output file (instead of multiple
files to an output directory), I'd suggest to name the parameter just
'file' or 'output_file'.


I'd like to see the the '... -o ...' patch right after this one.



For compilability, I had to add

#define _LARGEFILE64_SOURCE

or

#define _GNU_SOURCE

as you do in the next patch, in order to get O_LARGEFILE defined.


Kind regards,
Nicolas

  reply	other threads:[~2025-08-18 18:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  5:17 [PATCH v2 0/7] gen_init_cpio: add copy_file_range / reflink support David Disseldorp
2025-08-14  5:17 ` [PATCH v2 1/7] gen_init_cpio: write to fd instead of stdout stream David Disseldorp
2025-08-18 18:40   ` Nicolas Schier
2025-08-14  5:18 ` [PATCH v2 2/7] gen_init_cpio: support -o <output_path> parameter David Disseldorp
2025-08-18 18:40   ` Nicolas Schier [this message]
2025-08-14  5:18 ` [PATCH v2 3/7] gen_init_cpio: attempt copy_file_range for file data David Disseldorp
2025-08-18 18:40   ` Nicolas Schier
2025-08-19  0:20     ` David Disseldorp
2025-08-14  5:18 ` [PATCH v2 4/7] gen_init_cpio: avoid duplicate strlen calls David Disseldorp
2025-08-14  5:18 ` [PATCH v2 5/7] gen_initramfs.sh: use gen_init_cpio -o parameter David Disseldorp
2025-08-18 18:40   ` Nicolas Schier
2025-08-14  5:18 ` [PATCH v2 6/7] docs: initramfs: file data alignment via name padding David Disseldorp
2025-08-14  5:18 ` [PATCH v2 7/7] gen_init_cpio: add -a <data_align> as reflink optimization David Disseldorp
2025-08-18 19:23   ` Nicolas Schier
2025-08-21  8:10     ` David Disseldorp
2025-08-18 18:40 ` [PATCH v2 0/7] gen_init_cpio: add copy_file_range / reflink support Nicolas Schier
2025-08-18 23:46   ` David Disseldorp

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=aKNzon8sMXtpNItJ@levanger \
    --to=nsc@kernel.org \
    --cc=ddiss@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-next@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 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.