X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fudev%2Fudev-builtin-blkid.c;h=03e3dc2867bd814de876e8e142da1b80e469cc53;hp=cf194c00c668bcb349d847056d11df31d2fb63f3;hb=1fa2f38f0f011010bf57522b42fcc168856a7003;hpb=de0671ee7fe465e108f62dcbbbe9366f81dd9e9a diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index cf194c00c..03e3dc286 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -34,8 +34,7 @@ #include "efivars.h" #include "udev.h" -static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) -{ +static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) { char s[256]; s[0] = '\0'; @@ -182,8 +181,7 @@ static int find_gpt_root(struct udev_device *dev, blkid_probe pr, bool test) { return 0; } -static int probe_superblocks(blkid_probe pr) -{ +static int probe_superblocks(blkid_probe pr) { struct stat st; int rc; @@ -215,8 +213,7 @@ static int probe_superblocks(blkid_probe pr) return blkid_do_safeprobe(pr); } -static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { const char *root_partition; int64_t offset = 0; bool noraid = false; @@ -224,6 +221,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t blkid_probe pr; const char *data; const char *name; + const char *prtype = NULL; int nvals; int i; int err = 0; @@ -259,7 +257,8 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | - BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); + BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION | + BLKID_SUBLKS_BADCSUM); if (noraid) blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); @@ -274,13 +273,22 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (err < 0) goto out; - log_debug("probe %s %sraid offset=%"PRIu64, + log_debug("probe %s %sraid offset=%"PRIi64, udev_device_get_devnode(dev), noraid ? "no" : "", offset); err = probe_superblocks(pr); if (err < 0) goto out; + if (blkid_probe_has_value(pr, "SBBADCSUM")) { + if (!blkid_probe_lookup_value(pr, "TYPE", &prtype, NULL)) + log_warning("incorrect %s checksum on %s", + prtype, udev_device_get_devnode(dev)); + else + log_warning("incorrect checksum on %s", + udev_device_get_devnode(dev)); + goto out; + } /* If we are a partition then our parent passed on the root * partition UUID to us */ @@ -317,6 +325,6 @@ out: const struct udev_builtin udev_builtin_blkid = { .name = "blkid", .cmd = builtin_blkid, - .help = "filesystem and partition probing", + .help = "Filesystem and partition probing", .run_once = true, };