X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudev-builtin-blkid.c;h=c806bd6ad85802c6b702d608bad994e0e286f12e;hb=67d6621059085963a2a908a3ea99ced3b0ca789e;hp=e57f03e5a18dff4241bad879a37ee5d8f3abfb59;hpb=6df831f25ebc9f55cd939f04392dad9237706e45;p=elogind.git diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index e57f03e5a..c806bd6ad 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -1,7 +1,7 @@ /* * probe disks for filesystems and partitions * - * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 Kay Sievers * Copyright (C) 2011 Karel Zak * * This program is free software: you can redistribute it and/or modify @@ -37,47 +37,66 @@ static void print_property(struct udev_device *dev, bool test, const char *name, s[0] = '\0'; - if (!strcmp(name, "TYPE")) { + if (streq(name, "TYPE")) { udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); - } else if (!strcmp(name, "USAGE")) { + } else if (streq(name, "USAGE")) { udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); - } else if (!strcmp(name, "VERSION")) { + } else if (streq(name, "VERSION")) { udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); - } else if (!strcmp(name, "UUID")) { + } else if (streq(name, "UUID")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); - } else if (!strcmp(name, "UUID_SUB")) { + } else if (streq(name, "UUID_SUB")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); - } else if (!strcmp(name, "LABEL")) { + } else if (streq(name, "LABEL")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); - } else if (!strcmp(name, "PTTYPE")) { + } else if (streq(name, "PTTYPE")) { udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); - } else if (!strcmp(name, "PART_ENTRY_NAME")) { + } else if (streq(name, "PTUUID")) { + udev_builtin_add_property(dev, test, "ID_PART_TABLE_UUID", value); + + } else if (streq(name, "PART_ENTRY_NAME")) { blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_PART_ENTRY_NAME", s); - } else if (!strcmp(name, "PART_ENTRY_TYPE")) { + } else if (streq(name, "PART_ENTRY_TYPE")) { blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_PART_ENTRY_TYPE", s); - } else if (!strncmp(name, "PART_ENTRY_", 11)) { - util_strscpyl(s, sizeof(s), "ID_", name, NULL); + } else if (startswith(name, "PART_ENTRY_")) { + strscpyl(s, sizeof(s), "ID_", name, NULL); udev_builtin_add_property(dev, test, s, value); + + } else if (streq(name, "SYSTEM_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_SYSTEM_ID", s); + + } else if (streq(name, "PUBLISHER_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_PUBLISHER_ID", s); + + } else if (streq(name, "APPLICATION_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_APPLICATION_ID", s); + + } else if (streq(name, "BOOT_SYSTEM_ID")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_BOOT_SYSTEM_ID", s); } } @@ -115,7 +134,6 @@ static int probe_superblocks(blkid_probe pr) static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev *udev = udev_device_get_udev(dev); int64_t offset = 0; bool noraid = false; int fd = -1; @@ -151,10 +169,8 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t } pr = blkid_new_probe(); - if (!pr) { - err = -ENOMEM; + if (!pr) return EXIT_FAILURE; - } blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | @@ -174,9 +190,9 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (err < 0) goto out; - info(udev, "probe %s %sraid offset=%llu\n", - udev_device_get_devnode(dev), - noraid ? "no" : "", (unsigned long long) offset); + log_debug("probe %s %sraid offset=%llu", + udev_device_get_devnode(dev), + noraid ? "no" : "", (unsigned long long) offset); err = probe_superblocks(pr); if (err < 0)