All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Boyer <jwboyer@gmail.com>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: Linux mtd <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH][MTD-UTILS] Set mkfs.jffs2 page size runtime instead of fixed.
Date: Fri, 7 Dec 2007 07:03:54 -0600	[thread overview]
Message-ID: <20071207070354.02e020b2@weaponx> (raw)
In-Reply-To: <Pine.LNX.4.64.0712061232550.28640@lnxricardw.se.axis.com>

On Thu, 6 Dec 2007 12:43:47 +0100 (CET)
Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:

> 
> This patch reads the default PAGE_SIZE from sysconf(), i.e. the system
> mkfs.jffs2 is running on, instead of just setting it to 4096 (which of 
> course is valid for most systems but not all).

This makes sense overall.  I'd like to do it a slightly different way
though.

> This is useful if mkfs.jffs2 is running on the target system, e.g. to 
> create a backup image during firmware upgrade, so that the page size does 
> not have to be set explicitly using a command line parameter.
> 
> The --pagesize option is supported just as before.
> 
> Patch is included both as an attachment for patching and inline for 
> review. (Patch made against git head).
> 
> Signed-off-by Ricard Wanderlöf <ricardw@axis.com> .
> 
> Index: mkfs.jffs2.c
> ===================================================================
> RCS file: /usr/local/cvs/linux/apps/utils/mtdutils/mkfs.jffs2.c,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- mkfs.jffs2.c	17 Oct 2006 11:40:40 -0000	1.2
> +++ mkfs.jffs2.c	6 Dec 2007 07:46:47 -0000	1.3
> @@ -672,9 +672,9 @@
>   	0xff, 0xff, 0xff, 0xff, 0xff
>   };
> 
> -/* We default to 4096, per x86.  When building a fs for
> - * 64-bit arches and whatnot, use the --pagesize=SIZE option */
> -int page_size = 4096;
> +/* We set this at start of main() using sysconf(), -1 means we don't know */
> +/* When building an fs for non-native systems, use --pagesize=SIZE option */
> +int page_size = -1;
> 
>   #include "compr.h"
> 
> @@ -787,6 +787,10 @@
>   	struct stat *statbuf;
>   	unsigned int totcomp = 0;
> 
> +	page_size = sysconf(_SC_PAGESIZE);
> +	if (page_size < 0) /* System doesn't know so ... */
> +		page_size = 4096; /* ... we make an educated guess */
> +

Could we add an additional check here to see if page_size != 4096, and
print a loud warning with the page size that is actually being used and
suggest the --pagesize option if that isn't what is desired?

It's not that we have tons of systems using a page size different than
4KiB, but it's a change in behavior for those that do and I'd like to
at least warn users about it.  Otherwise the patch looks fine.

josh

  reply	other threads:[~2007-12-07 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-06 11:43 [PATCH][MTD-UTILS] Set mkfs.jffs2 page size runtime instead of fixed Ricard Wanderlof
2007-12-07 13:03 ` Josh Boyer [this message]
2007-12-10 20:00   ` Ricard Wanderlof
2007-12-20 11:46   ` [PATCH][MTD-UTILS] Set mkfs.jffs2 page size runtime instead of fixed [respoin] Ricard Wanderlof
2007-12-20 15:43     ` Josh Boyer

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=20071207070354.02e020b2@weaponx \
    --to=jwboyer@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=ricard.wanderlof@axis.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.