public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: ashford@whisperpc.com
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs_progs/mkfs.c more input data verification cleanup
Date: Fri, 23 Jan 2009 19:39:32 -0800 (PST)	[thread overview]
Message-ID: <62563.75.80.183.92.1232768372.squirrel@www.whisperpc.com> (raw)
In-Reply-To: <1232745288-4307-2-git-send-email-cascardo@holoscopio.com>

Yet another patch for mkfs input data verification.

# diff -u mkfs.c- mkfs.c
--- mkfs.c-     2009-01-23 19:26:33.000000000 -0800
+++ mkfs.c      2009-01-23 19:33:07.000000000 -0800
@@ -406,13 +406,23 @@
                exit(1);
        }

-       if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) {
-               fprintf(stderr, "Illegal leafsize %u\n", leafsize);
+       if (leafsize < sectorsize) {
+               printf("Leafsize %u smaller than sectorsize %u - corrected\n",
+                       leafsize, (u32)getpagesize());
+               leafsize = sectorsize;
+       } else if ((leafsize & (sectorsize - 1))) {
+               fprintf(stderr, "Leafsize %u not a multiple of sectorsize %u\n",
+                       leafsize, sectorsize);
                exit(1);
        }

-       if (nodesize < sectorsize || (nodesize & (sectorsize - 1))) {
-               fprintf(stderr, "Illegal nodesize %u\n", nodesize);
+       if (nodesize < sectorsize) {
+               printf("Nodesize %u smaller than sectorsize %u - corrected\n",
+                       nodesize, (u32)getpagesize());
+               nodesize = sectorsize;
+       } else if ((nodesize & (sectorsize - 1))) {
+               fprintf(stderr, "Nodesize %u not a multiple of sectorsize %u\n",
+                       nodesize, sectorsize);
                exit(1);
        }


      reply	other threads:[~2009-01-24  3:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 21:14 [PATCH] Fix typo: s/Coult/Could/ Thadeu Lima de Souza Cascardo
2009-01-23 21:14 ` [PATCH] Add error message explaining why opening a device failed Thadeu Lima de Souza Cascardo
2009-01-24  3:39   ` ashford [this message]

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=62563.75.80.183.92.1232768372.squirrel@www.whisperpc.com \
    --to=ashford@whisperpc.com \
    --cc=linux-btrfs@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