public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: MTD mailing list <linux-mtd@lists.infradead.org>
Subject: Re: running out of space dd'ing JFFS2 image to /dev/mtdblock/0
Date: Mon, 31 Jan 2005 17:39:19 +0100	[thread overview]
Message-ID: <20050131163919.GH6694@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0501311109050.13936@localhost.localdomain>

On Mon, 31 January 2005 11:14:49 -0500, Robert P. J. Day wrote:
> 
> first, it's necessary to define a simple standard, so what about
> something like the following?  any size values in *any* of the
> JFFS2-related programs shall be in one of the following formats:
> 
>   ###		(interpreted as bytes)
>   ###KiB	(obvious)
>   ###MiB	(obvious)
> 
> at the moment, this is not being followed.  for instance, mkfs.jffs2
> has the --pad=SIZE option, where a simple number is treated as KiB.
> anyway, you get idea -- it's pretty confusing.
> 
> so, do we at least have some agreement on a standard?  which would
> hold across *all* programs and modules?  i'm not even going to
> *consider* looking at patches to do this unless i'm convinced everyone
> agrees, since changes like this will clearly force people to change
> the way they do some things.  and i know how fond some people are of
> *that* idea. :-)

I agree on a standard, if that helps you:

0x[0-9]...	hex
0[1-9]...	octal
[1-9]...	decimal

If followed by "ki", "Mi", or "Gi", they are multiplied by 1024, etc.

Example code, taken from phram:

static int ustrtoul(const char *cp, char **endp, unsigned int base)
{
	unsigned long result = simple_strtoul(cp, endp, base);

	switch (**endp) {
	case 'G':
		result *= 1024;
	case 'M':
		result *= 1024;
	case 'k':
		result *= 1024;
	/* By dwmw2 editorial decree, "ki", "Mi" or "Gi" are to be used. */
		if ((*endp)[1] == 'i')
			(*endp) += 2;
	}
	return result;
}

static int parse_num32(uint32_t *num32, const char *token)
{
	char *endp;
	unsigned long n;

	n = ustrtoul(token, &endp, 0);
	if (*endp)
		return -EINVAL;

	*num32 = n;
	return 0;
}

This allows different people with different taste to specify numbers
in various simple formats.  If you think you can improve on this,
please send me a patch.

Jörn

-- 
But this is not to say that the main benefit of Linux and other GPL
software is lower-cost. Control is the main benefit--cost is secondary.
-- Bruce Perens

  parent reply	other threads:[~2005-01-31 16:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31 15:14 running out of space dd'ing JFFS2 image to /dev/mtdblock/0 Robert P. J. Day
2005-01-31 15:21 ` Josh Boyer
2005-01-31 15:43   ` Robert P. J. Day
2005-01-31 15:54     ` Artem B. Bityuckiy
2005-01-31 16:14       ` Robert P. J. Day
2005-01-31 16:22         ` Artem B. Bityuckiy
2005-01-31 16:22         ` Thomas Gleixner
2005-01-31 16:26           ` David Woodhouse
2005-01-31 16:51             ` Robert P. J. Day
2005-01-31 17:11               ` Artem B. Bityuckiy
2005-01-31 17:21                 ` Jörn Engel
2005-01-31 17:25                   ` Artem B. Bityuckiy
2005-01-31 17:29                     ` Josh Boyer
2005-01-31 17:38                       ` Jörn Engel
2005-01-31 17:29                     ` Jörn Engel
2005-01-31 17:43                 ` Robert P. J. Day
2005-01-31 17:52                   ` Jörn Engel
2005-01-31 18:22                     ` Robert P. J. Day
2005-01-31 18:31                   ` David Woodhouse
2005-01-31 19:02                     ` Robert P. J. Day
2005-01-31 22:30           ` Robert P. J. Day
2005-01-31 16:39         ` Jörn Engel [this message]
2005-02-01  0:19           ` David Woodhouse
2005-02-01  0:43             ` Josh Boyer
2005-02-01 13:03             ` Jörn Engel
2005-01-31 16:01     ` Jörn Engel

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=20050131163919.GH6694@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=rpjday@mindspring.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox