]> www.infradead.org Git - users/hch/misc.git/commitdiff
block: add partition uuid into uevent as "PARTUUID"
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Sat, 5 Oct 2024 00:13:43 +0000 (17:13 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 22 Oct 2024 14:15:17 +0000 (08:15 -0600)
Both most common formats have uuid in addition to partition name:
GPT: standard uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DOS: 4 byte disk signature and 1 byte partition xxxxxxxx-xx

Tools from util-linux use the same notation for them.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reviewed-by: Kyle Fortin <kyle.fortin@oracle.com>
[dianders: rebased to modern kernels]
Signed-off-by: Douglas Anderson <dianders@google.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241004171340.v2.1.I938c91d10e454e841fdf5d64499a8ae8514dc004@changeid
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partitions/core.c

index cdad05f9764768a42b2885157b7df3fec6235b56..815ed33caa1b86d22dccf2bf1593f5c85aad7597 100644 (file)
@@ -256,6 +256,8 @@ static int part_uevent(const struct device *dev, struct kobj_uevent_env *env)
        add_uevent_var(env, "PARTN=%u", bdev_partno(part));
        if (part->bd_meta_info && part->bd_meta_info->volname[0])
                add_uevent_var(env, "PARTNAME=%s", part->bd_meta_info->volname);
+       if (part->bd_meta_info && part->bd_meta_info->uuid[0])
+               add_uevent_var(env, "PARTUUID=%s", part->bd_meta_info->uuid);
        return 0;
 }