]> err.no Git - util-linux/commitdiff
libblkid: set minimal size for jfs, reiser, swap and zfs
authorKarel Zak <kzak@redhat.com>
Tue, 19 Jan 2010 00:12:06 +0000 (01:12 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 16 Feb 2010 08:58:56 +0000 (09:58 +0100)
.. and don't probe for swap or ext. journal on tiny disks.

Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/blkidP.h
shlibs/blkid/src/superblocks/jfs.c
shlibs/blkid/src/superblocks/reiserfs.c
shlibs/blkid/src/superblocks/superblocks.c
shlibs/blkid/src/superblocks/swap.c
shlibs/blkid/src/superblocks/zfs.c

index 4a3ae200b107f457ff9ffd4d26ecb0c875e67e74..55850349a7878508718f778c68d29b615cb4eb84 100644 (file)
@@ -155,6 +155,7 @@ struct blkid_idinfo
        const char      *name;          /* fs, raid or partition table name */
        int             usage;          /* BLKID_USAGE_* flag */
        int             flags;          /* BLKID_IDINFO_* flags */
+       int             minsz;          /* minimal device size */
 
                                        /* probe function */
        int             (*probefunc)(blkid_probe pr, const struct blkid_idmag *mag);
index e6e4450534efb990eab2948500a467eb41c52cf5..9a49c67469c49983034680548b7351057b23ef15 100644 (file)
@@ -61,6 +61,7 @@ const struct blkid_idinfo jfs_idinfo =
        .name           = "jfs",
        .usage          = BLKID_USAGE_FILESYSTEM,
        .probefunc      = probe_jfs,
+       .minsz          = 16 * 1024 * 1024,
        .magics         =
        {
                { .magic = "JFS1", .len = 4, .kboff = 32 },
index 4222a30751217d9ff49cb8cd037f6198a64fa789..921f5237edc95daeeef5e6c1186e15d0246c24d7 100644 (file)
@@ -98,6 +98,7 @@ const struct blkid_idinfo reiser_idinfo =
        .name           = "reiserfs",
        .usage          = BLKID_USAGE_FILESYSTEM,
        .probefunc      = probe_reiser,
+       .minsz          = 4096 * 512,   /* not sure, this is minimal size of journal */
        .magics         =
        {
                { .magic = "ReIsErFs",  .len = 8, .kboff = 8,  .sboff = 0x34 },
@@ -114,6 +115,7 @@ const struct blkid_idinfo reiser4_idinfo =
        .name           = "reiser4",
        .usage          = BLKID_USAGE_FILESYSTEM,
        .probefunc      = probe_reiser4,
+       .minsz          = 4096 * 512,   /* not sure, this is minimal size of journal */
        .magics         =
        {
                { .magic = "ReIsEr4", .len = 7, .kboff = 64 },
index dbb48562da33331e3883732b90f1bdd6437b3099..689f31bd7b85dbd86a7b73dcb2afd595f5c035ef 100644 (file)
@@ -331,10 +331,15 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
                        continue;
 
                id = idinfos[i];
+
+               if (id->minsz && id->minsz > pr->size)
+                       continue;       /* the device is too small */
+
                mag = id->magics ? &id->magics[0] : NULL;
 
-               /* don't probe for RAIDs on floppies */
-               if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr))
+               /* don't probe for RAIDs, swap or journal on floppies */
+               if ((id->usage & (BLKID_USAGE_RAID | BLKID_USAGE_OTHER)) &&
+                   blkid_probe_is_tiny(pr))
                        continue;
 
                DBG(DEBUG_LOWPROBE, printf("[%d] %s:\n", i, id->name));
index 4fb4ab7a0da6f3dd2d8bae43f5b92e27672ae449..8aaa6f31428a10d5034cc0c69bab14990505d994 100644 (file)
@@ -99,6 +99,7 @@ const struct blkid_idinfo swap_idinfo =
        .name           = "swap",
        .usage          = BLKID_USAGE_OTHER,
        .probefunc      = probe_swap,
+       .minsz          = 10 * 4096,    /* 10 pages */
        .magics         =
        {
                { "SWAP-SPACE", 10, 0,  0xff6 },
@@ -121,6 +122,7 @@ const struct blkid_idinfo swsuspend_idinfo =
        .name           = "swsuspend",
        .usage          = BLKID_USAGE_OTHER,
        .probefunc      = probe_swsuspend,
+       .minsz          = 10 * 4096,    /* 10 pages */
        .magics         =
        {
                { "S1SUSPEND", 9, 0, 0xff6 },
index 2d626427f4b8e2884c694eff00066df0f3c26954..0f580262218f1fa40b358245409b0f27d4a6061b 100644 (file)
@@ -54,6 +54,7 @@ const struct blkid_idinfo zfs_idinfo =
        .name           = "zfs",
        .usage          = BLKID_USAGE_FILESYSTEM,
        .probefunc      = probe_zfs,
+       .minsz          = 64 * 1024 * 1024,
        .magics         =
        {
                { .magic = "\0\0\x02\xf5\xb0\x07\xb1\x0c", .len = 8, .kboff = 8 },