mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 5/6] commands: add new truncate command
Date: Thu, 20 Nov 2025 08:36:23 +0100	[thread overview]
Message-ID: <aR7E9xMyExtL9XQU@pengutronix.de> (raw)
In-Reply-To: <20250320052019.1726331-6-a.fatoum@pengutronix.de>

Hi Ahmad,

On Thu, Mar 20, 2025 at 06:20:18AM +0100, Ahmad Fatoum wrote:
> +		case 's':
> +			size_str = optarg;
> +			if (!size_str)
> +				return COMMAND_ERROR_USAGE;
> +			switch (*size_str) {
> +			case '+':
> +				modify = 1;
> +				size_str++;
> +				break;
> +			case '-':
> +				return COMMAND_ERROR_USAGE;
> +			}
> +			size = strtoull_suffix(size_str, NULL, 10);
> +			break;

...

> +		if (modify) {
> +			struct stat st;
> +
> +			if (fstat(fd, &st) == -1) {
> +				perror("fstat");
> +				ret = 1;
> +				goto close;
> +			}
> +
> +			size = st.st_size + modify * size;

You have taken 'modify' into account here, likely to be able to set it
to -1 in order to decrease the size. Any particular reason you haven't
implemented it?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-11-20  7:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20  5:20 [PATCH 0/6] fs: implement tree and truncate Ahmad Fatoum
2025-03-20  5:20 ` [PATCH 1/6] fs: use filename_create/filename_lookup instead of open-coding Ahmad Fatoum
2025-03-20  5:20 ` [PATCH 2/6] fs: implement O_DIRECTORY Ahmad Fatoum
2025-03-20  5:20 ` [PATCH 3/6] fs: implement opendir in terms of fdopendir Ahmad Fatoum
2025-03-20  5:20 ` [PATCH 4/6] commands: implement tree command Ahmad Fatoum
2025-03-20  5:20 ` [PATCH 5/6] commands: add new truncate command Ahmad Fatoum
2025-11-20  7:36   ` Sascha Hauer [this message]
2025-03-20  5:20 ` [PATCH 6/6] Documentation: devel: add short section on file systems Ahmad Fatoum
2025-03-24  8:35 ` [PATCH 0/6] fs: implement tree and truncate Sascha Hauer

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=aR7E9xMyExtL9XQU@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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