diff options
author | Hannes Reinecke | 2014-03-20 11:03:50 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-20 15:26:48 +0100 |
commit | 37f4060225df0591ab8e1dd676dbc8115d900d4f (patch) | |
tree | 47b445e8868687025b4769ada1824a5bdd2e8b8e /libblkid/src/superblocks/ext.c | |
parent | blkid: stop scanning on I/O error (diff) | |
download | kernel-qcow2-util-linux-37f4060225df0591ab8e1dd676dbc8115d900d4f.tar.gz kernel-qcow2-util-linux-37f4060225df0591ab8e1dd676dbc8115d900d4f.tar.xz kernel-qcow2-util-linux-37f4060225df0591ab8e1dd676dbc8115d900d4f.zip |
blkid: convert superblocks to new calling convention
With the previous patch the scanning functions were
modified to return a differentiated return code.
To correctly abort scanning when an I/O error occurs
we need to differentiate between 'error' (= -1) and
'not found' (= 1) in the probe functions.
This patch updates all superblock scanning functions
to the new calling convention.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/superblocks/ext.c')
-rw-r--r-- | libblkid/src/superblocks/ext.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libblkid/src/superblocks/ext.c b/libblkid/src/superblocks/ext.c index 6f6d8a6bc..1de602214 100644 --- a/libblkid/src/superblocks/ext.c +++ b/libblkid/src/superblocks/ext.c @@ -198,9 +198,9 @@ static int probe_jbd(blkid_probe pr, es = ext_get_super(pr, NULL, &fi, NULL); if (!es) - return -BLKID_ERR_PARAM; + return errno ? -errno : 1; if (!(fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) - return -BLKID_ERR_PARAM; + return 1; ext_get_info(pr, 2, es); blkid_probe_set_uuid_as(pr, es->s_uuid, "LOGUUID"); @@ -216,16 +216,16 @@ static int probe_ext2(blkid_probe pr, es = ext_get_super(pr, &fc, &fi, &frc); if (!es) - return -BLKID_ERR_PARAM; + return errno ? -errno : 1; /* Distinguish between ext3 and ext2 */ if (fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) - return -BLKID_ERR_PARAM; + return 1; /* Any features which ext2 doesn't understand */ if ((frc & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) || (fi & EXT2_FEATURE_INCOMPAT_UNSUPPORTED)) - return -BLKID_ERR_PARAM; + return 1; ext_get_info(pr, 2, es); return 0; @@ -239,16 +239,16 @@ static int probe_ext3(blkid_probe pr, es = ext_get_super(pr, &fc, &fi, &frc); if (!es) - return -BLKID_ERR_PARAM; + return errno ? -errno : 1; /* ext3 requires journal */ if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL)) - return -BLKID_ERR_PARAM; + return 1; /* Any features which ext3 doesn't understand */ if ((frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) || (fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) - return -BLKID_ERR_PARAM; + return 1; ext_get_info(pr, 3, es); return 0; @@ -263,14 +263,14 @@ static int probe_ext4dev(blkid_probe pr, es = ext_get_super(pr, &fc, &fi, &frc); if (!es) - return -BLKID_ERR_PARAM; + return errno ? -errno : 1; /* Distinguish from jbd */ if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) - return -BLKID_ERR_PARAM; + return 1; if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)) - return -BLKID_ERR_PARAM; + return 1; ext_get_info(pr, 4, es); return 0; @@ -284,16 +284,16 @@ static int probe_ext4(blkid_probe pr, es = ext_get_super(pr, &fc, &fi, &frc); if (!es) - return -1; + return errno ? -errno : 1; /* Distinguish from jbd */ if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) - return -BLKID_ERR_PARAM; + return 1; /* Ext4 has at least one feature which ext3 doesn't understand */ if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) && !(fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) - return -BLKID_ERR_PARAM; + return 1; /* * If the filesystem is a OK for use by in-development @@ -306,7 +306,7 @@ static int probe_ext4(blkid_probe pr, * ext4dev. */ if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) - return -BLKID_ERR_PARAM; + return 1; ext_get_info(pr, 4, es); return 0; |